io
tags question: http://stackoverflow.com/q/26824398
tags question: http://stackoverflow.com/q/26787105
tags question: http://stackoverflow.com/q/26765821
tag name: io
tags question: http://stackoverflow.com/q/26831190
tags question: http://stackoverflow.com/q/26794630
tags question: http://stackoverflow.com/q/26826151
tags question: http://stackoverflow.com/q/26726424
tags question: http://stackoverflow.com/q/26820222
tags question: http://stackoverflow.com/q/26820077
tags question: http://stackoverflow.com/q/26674079
tags question: http://stackoverflow.com/q/26812962
tags question: http://stackoverflow.com/q/26694322
type: Tag
tags question: http://stackoverflow.com/q/26775025
tags question: http://stackoverflow.com/q/26674037
tags question: http://stackoverflow.com/q/26733306
tags question: http://stackoverflow.com/q/26818105
tags question: http://stackoverflow.com/q/26702904
tags question: http://stackoverflow.com/q/26722140
tags question: http://stackoverflow.com/q/26773766
tags question: http://stackoverflow.com/q/26805166
tags question: http://stackoverflow.com/q/26786630
tags question: http://stackoverflow.com/q/26683949

java
tags question: http://stackoverflow.com/q/26721442
tags question: http://stackoverflow.com/q/26831978
tags question: http://stackoverflow.com/q/26739497
tags question: http://stackoverflow.com/q/26726036
tags question: http://stackoverflow.com/q/26699911
tags question: http://stackoverflow.com/q/26723776
tags question: http://stackoverflow.com/q/26753386
tags question: http://stackoverflow.com/q/26698136
tags question: http://stackoverflow.com/q/26826959
tags question: http://stackoverflow.com/q/26782887
tags question: http://stackoverflow.com/q/26753899
tags question: http://stackoverflow.com/q/26679786
tags question: http://stackoverflow.com/q/26820042
tags question: http://stackoverflow.com/q/26760159
tags question: http://stackoverflow.com/q/26811325
tags question: http://stackoverflow.com/q/26676304
tags question: http://stackoverflow.com/q/26772788
tags question: http://stackoverflow.com/q/26726225
tags question: http://stackoverflow.com/q/26818528
tags question: http://stackoverflow.com/q/26774764
tags question: http://stackoverflow.com/q/26741614
tags question: http://stackoverflow.com/q/26733141
tags question: http://stackoverflow.com/q/26739984
tags question: http://stackoverflow.com/q/26825331
tags question: http://stackoverflow.com/q/26685807
tags question: http://stackoverflow.com/q/26791270
tags question: http://stackoverflow.com/q/26767829
tags question: http://stackoverflow.com/q/26690130
tags question: http://stackoverflow.com/q/26724976
tags question: http://stackoverflow.com/q/26693121
tags question: http://stackoverflow.com/q/26682775
tags question: http://stackoverflow.com/q/26784730
tags question: http://stackoverflow.com/q/26820980
tags question: http://stackoverflow.com/q/26752443
tags question: http://stackoverflow.com/q/26818684
tags question: http://stackoverflow.com/q/26687140
tags question: http://stackoverflow.com/q/26727812
tags question: http://stackoverflow.com/q/26737628
tags question: http://stackoverflow.com/q/26778689
tags question: http://stackoverflow.com/q/26702389
tags question: http://stackoverflow.com/q/26697174
tags question: http://stackoverflow.com/q/26772060
tags question: http://stackoverflow.com/q/26699782
tags question: http://stackoverflow.com/q/26742027
tags question: http://stackoverflow.com/q/26699178
tags question: http://stackoverflow.com/q/26801562
tags question: http://stackoverflow.com/q/26681593
tags question: http://stackoverflow.com/q/26751930
tags question: http://stackoverflow.com/q/26733246
tags question: http://stackoverflow.com/q/26784812
tags question: http://stackoverflow.com/q/26746989
tags question: http://stackoverflow.com/q/26801877
tags question: http://stackoverflow.com/q/26682604
tags question: http://stackoverflow.com/q/26823755
tags question: http://stackoverflow.com/q/26739579
tags question: http://stackoverflow.com/q/26779839
tags question: http://stackoverflow.com/q/26786298
tags question: http://stackoverflow.com/q/26690053
tags question: http://stackoverflow.com/q/26697344
tags question: http://stackoverflow.com/q/26814411
tags question: http://stackoverflow.com/q/26743595
tags question: http://stackoverflow.com/q/26773310
tags question: http://stackoverflow.com/q/26713780
tags question: http://stackoverflow.com/q/26705396
tags question: http://stackoverflow.com/q/26757824
tags question: http://stackoverflow.com/q/26771090
tags question: http://stackoverflow.com/q/26720133
tags question: http://stackoverflow.com/q/26713387
tags question: http://stackoverflow.com/q/26748928
tags question: http://stackoverflow.com/q/26698043
tags question: http://stackoverflow.com/q/26712932
tags question: http://stackoverflow.com/q/26705559
tags question: http://stackoverflow.com/q/26762058
tags question: http://stackoverflow.com/q/26769498
tags question: http://stackoverflow.com/q/26763938
tags question: http://stackoverflow.com/q/26809438
tags question: http://stackoverflow.com/q/26746588
tags question: http://stackoverflow.com/q/26766011
tags question: http://stackoverflow.com/q/26689970
tags question: http://stackoverflow.com/q/26829279

http://stackoverflow.com/q/26761083
has comment: http://stackoverflow.com/comment/42104915
type: Question
tagged with: object
has body: How many objects are created in the following code? String a, b, c; a = "1234"; b = a; c = a + b; I was been told the answer is 2, because only a and b point to their own data. c is only created from using a and b. However, isn't the act of declaring a variable considered creating it? Is this question vague? I said 3.
has comment: http://stackoverflow.com/comment/42104854
accepted answer: http://stackoverflow.com/a/26761828
tagged with: java
has comment: http://stackoverflow.com/comment/42103885
upvote count: 4
answer count: 2
downvote count: 0
score: 4
favorite count: 0
has title: Java: How many objects are created in the code?
has comment: http://stackoverflow.com/comment/42105505
possible better answer: http://stackoverflow.com/a/26761460
has answer: http://stackoverflow.com/a/26761828
has answer: http://stackoverflow.com/a/26761460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42103561
has comment: http://stackoverflow.com/comment/42103901
has comment: http://stackoverflow.com/comment/42105179

http://stackoverflow.com/q/26729224
has answer: http://stackoverflow.com/a/26729385
possible better answer: http://stackoverflow.com/a/26729328
type: Question
has answer: http://stackoverflow.com/a/26729328
accepted answer: http://stackoverflow.com/a/26729385
tagged with: java
has title: How to perform a task once download manger has completed multiple downloads
tagged with: broadcastreceiver
answer count: 2
has comment: http://stackoverflow.com/comment/42046774
has body: i need to download multiple images when my application starts up. I'm able to download the images properly but the problem im facing is how do i perform a task like move to another activity(where the pics are displayed) or in this case( for testing purposes) change the text of a textview once ALL the downloads are complete. In my code it changes the text view even if one download is complete,which is not what i want. How do i achieve this? public class MainActivity extends ActionBarActivity { TextView testtv; String[] imagenames; String BASEURL; private long enqueue; private DownloadManager dm = null; @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BASEURL = getResources().getString(R.string.base_URL); imagenames = getResources().getStringArray(R.array.pic_name); testtv = (TextView) findViewById(R.id.testtv); File Path = getExternalFilesDir(null); File noMedia = new File(Path + "/.nomedia"); if (!noMedia.exists()) { try { noMedia.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Path.mkdirs(); for (int index = 0; index &lt; imagenames.length; index++) { File image = new File(Path + "/" + imagenames[index]); if (image.exists()) { testtv.setText("file exists"); } else { Boolean result = isDownloadManagerAvailable(getApplicationContext()); if (result) { downloadFile(imagenames[index]); } } } } @SuppressLint("NewApi") public void downloadFile(String imagename) { // TODO Auto-generated method stub String DownloadUrl = BASEURL + imagename; DownloadManager.Request request = new DownloadManager.Request( Uri.parse(DownloadUrl)); request.setDescription("P3 Resources"); // appears the same // in Notification // bar while // downloading request.setTitle("P3 Resources"); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificati…
score: 0
tagged with: android
type: AnsweredQuestion
tagged with: android-download-manager

http://stackoverflow.com/comment/42204100
score: 2
comment on: http://stackoverflow.com/q/26816496
type: Comment
type: QuestionComment
has text: For REST-style services, you should map a specific request to your controller. I haven't come across anything that maps multiple request to one method. GET a record and GET all records should have different URL mapping. It's the uniqueness of the resource you are GETting. That's the REST. Think about Amazon Prime Instant Video for instance. When you select the Amazon Prime Instant video category, leave the search box empty, and press ENTER - do you see a simply URL pointing to AMAZON PRIME video or does it have a request string in it? Every request mapping should be different.

eclipse
tags question: http://stackoverflow.com/q/26793262
tags question: http://stackoverflow.com/q/26762897
tags question: http://stackoverflow.com/q/26733307
tags question: http://stackoverflow.com/q/26677788
tags question: http://stackoverflow.com/q/26812967
tags question: http://stackoverflow.com/q/26718480
tags question: http://stackoverflow.com/q/26822505
tags question: http://stackoverflow.com/q/26802370
tag name: eclipse
tags question: http://stackoverflow.com/q/26832050
tags question: http://stackoverflow.com/q/26734416
tags question: http://stackoverflow.com/q/26713813
tags question: http://stackoverflow.com/q/26764404
tags question: http://stackoverflow.com/q/26715973
tags question: http://stackoverflow.com/q/26749661
tags question: http://stackoverflow.com/q/26683732
tags question: http://stackoverflow.com/q/26827345
tags question: http://stackoverflow.com/q/26799471
tags question: http://stackoverflow.com/q/26688700
tags question: http://stackoverflow.com/q/26740644
tags question: http://stackoverflow.com/q/26790642
tags question: http://stackoverflow.com/q/26789928
tags question: http://stackoverflow.com/q/26799171
tags question: http://stackoverflow.com/q/26707810
tags question: http://stackoverflow.com/q/26729809
tags question: http://stackoverflow.com/q/26737270
tags question: http://stackoverflow.com/q/26748915
tags question: http://stackoverflow.com/q/26685231
tags question: http://stackoverflow.com/q/26731276
tags question: http://stackoverflow.com/q/26715354
tags question: http://stackoverflow.com/q/26766013
tags question: http://stackoverflow.com/q/26831798
tags question: http://stackoverflow.com/q/26681676
tags question: http://stackoverflow.com/q/26810319
tags question: http://stackoverflow.com/q/26712025
tags question: http://stackoverflow.com/q/26721704
tags question: http://stackoverflow.com/q/26703347
tags question: http://stackoverflow.com/q/26817999
tags question: http://stackoverflow.com/q/26774246
tags question: http://stackoverflow.com/q/26759638
tags question: http://stackoverflow.com/q/26787863
tags question: http://stackoverflow.com/q/26696847
tags question: http://stackoverflow.com/q/26763208
tags question: http://stackoverflow.com/q/26711957
tags question: http://stackoverflow.com/q/26802795
tags question: http://stackoverflow.com/q/26816710
tags question: http://stackoverflow.com/q/26779520
tags question: http://stackoverflow.com/q/26714060
tags question: http://stackoverflow.com/q/26691682
tags question: http://stackoverflow.com/q/26760102
tags question: http://stackoverflow.com/q/26801708
tags question: http://stackoverflow.com/q/26752667
tags question: http://stackoverflow.com/q/26743524
tags question: http://stackoverflow.com/q/26720156
tags question: http://stackoverflow.com/q/26773325
tags question: http://stackoverflow.com/q/26798990
tags question: http://stackoverflow.com/q/26695673
tags question: http://stackoverflow.com/q/26692136
tags question: http://stackoverflow.com/q/26822288
tags question: http://stackoverflow.com/q/26770669
tags question: http://stackoverflow.com/q/26720653
tags question: http://stackoverflow.com/q/26807683
tags question: http://stackoverflow.com/q/26675368
tags question: http://stackoverflow.com/q/26702344
tags question: http://stackoverflow.com/q/26707123
tags question: http://stackoverflow.com/q/26803063
tags question: http://stackoverflow.com/q/26678346
tags question: http://stackoverflow.com/q/26730453
tags question: http://stackoverflow.com/q/26760759
tags question: http://stackoverflow.com/q/26825360
tags question: http://stackoverflow.com/q/26719491
tags question: http://stackoverflow.com/q/26706644
tags question: http://stackoverflow.com/q/26789225
tags question: http://stackoverflow.com/q/26674183
tags question: http://stackoverflow.com/q/26735645
tags question: http://stackoverflow.com/q/26821764
tags question: http://stackoverflow.com/q/26678548
tags question: http://stackoverflow.com/q/26693640
tags question: http://stackoverflow.com/q/26746398
tags question: http://stackoverflow.com/q/26739993

http://stackoverflow.com/q/26748908
has answer: http://stackoverflow.com/a/26748955
tagged with: int
score: 0
answer count: 2
tagged with: while-loop
tagged with: nested
has answer: http://stackoverflow.com/a/70342121
has body: I am trying to compare the digits of two integers to tell if they have distinct digits or not. I am having trouble on my hasDistinctIntegers method. It doesn't often evaluate to what it should. True if the number does not have repeating digits, false if it does. I believe my other methods are working correctly, but I could really use another set of eyes! Here is what I have so far: public static void main(String[] args) { System.out.println(hasDistinctDigits(12345)); } public static boolean hasDistinctDigits(int number) { boolean returner = true; int count1 = 0; int digit = 0; int curNum = number; while (count1 &lt; numDigits(number)) { int count2 = 0; digit = getDigit(curNum, count1); curNum = curNum / 10; while (count2 &lt; numDigits(curNum)) { if (digit == getDigit(curNum, count2)) { returner = false; } count2++; } count1++; } return returner; } public static int numDigits(int number) { int count = 0; while (number != 0) { number /= 10; count++; } return count; } public static int getDigit(int number, int i) { int digit = 0; int count = 0; int originalNum = number; while (count &lt;= i) { if (count == i) { digit = number % 10; } number /= 10; count++; } if (i &gt; numDigits(originalNum)) { return -1; } else { return digit; } } public static int indexOf(int number, int digit) { int count = 0; int index = -1; while (count &lt; numDigits(number)) { if (getDigit(number, count) == digit) { index = count; } count++; } return index; } Thanks in advance for any tips/advice!
accepted answer: http://stackoverflow.com/a/26748955
possible better answer: http://stackoverflow.com/a/70342121
type: AnsweredQuestion
has title: Comparing digits of integers
tagged with: java
tagged with: loops
type: Question

http://stackoverflow.com/comment/42143458
score: 0
type: QuestionComment
has text: I will try to simplify the entities so I can post them, this may take a while...
type: Comment
comment on: http://stackoverflow.com/q/26776052

http://stackoverflow.com/comment/42078809
comment on: http://stackoverflow.com/q/26746812
type: Comment
type: QuestionComment
has text: `this.requestFocusInWindow();` is a bad idea within the `paintComponent` method. Painting should paint the current state and never change the state of the component
score: 1

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

http://stackoverflow.com/q/26816061
score: 0
type: UnansweredQuestion
tagged with: java
has body: Am using picketlink for an application and I would greatly appreciate if any one could help me out. The application has many Groups (Admin, Customer Service etc) and each group can have many Roles (like Create a new User, Create a new employee, Launch a payroll process etc) A user can be assigned to one or more groups, and a group to one or more roles. Normally I thought that a user assigned to a group will inherit all the roles of the group. If I use BasicModel.hasRole for a user assigned to a group, it returns true for all roles assigned to that group, which is as expected. However when using @RolesAllowed annotation on my rest end points, it will always return access denied exception for the same user. If there any workaround anyone can suggest? I want @RolesAllowed to allow users within a group having the allowed roles to pass through. Or is there any other annotation I can use?
type: Question
tagged with: picketlink
has answer: http://stackoverflow.com/a/28217578
answer count: 1
has title: Picketlink @RolesAllowed for roles assigned to groups

http://stackoverflow.com/comment/42210066
has text: Your code is still a mess, and this is an infinite loop (or a loop that is never executed) : `while(ticketloop =='y');`. Plus, you have curly brackets at random places in your code when there is absolutely no reason to have a block. You really need to be more organized if you want to program.
type: AnswerComment
comment on: http://stackoverflow.com/a/26819316
type: Comment
score: 0

http://stackoverflow.com/comment/41990128
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26697855
type: AnswerComment
has text: @RishiPandey Adding an object to the list doesn't add a copy of that object, it stores a reference to the original object in the list.

http://stackoverflow.com/comment/48032778
type: Comment
type: QuestionComment
has text: What I said. It's recommended to have one thread per socket. Maybe even two: one for reading, one for writing.
score: 0
comment on: http://stackoverflow.com/q/26702185

http://stackoverflow.com/q/26735479
tagged with: http-redirect
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42057598
has comment: http://stackoverflow.com/comment/42061345
has answer: http://stackoverflow.com/a/26738396
score: 0
has comment: http://stackoverflow.com/comment/42061309
answer count: 1
tagged with: httpurlconnection
has title: When does URL redirect happen?
has body: I have a URL that redirects to another one, that redirects to another one, and I'm trying to get the end domain. I thought that the redirection would happen when connecting, but running this code tells me otherwise: public static void main(String[] args) { System.out.println(resolveEndDomain("http://goo.gl/ELHEjl")); } private static String resolveEndDomain(String deepLink) { HttpURLConnection httpConnection = null; try { httpConnection = (HttpURLConnection) new URL(deepLink).openConnection(); //httpConnection.getResponseCode(); } catch (Exception e) { e.printStackTrace(); } return httpConnection.getURL().getHost(); } So, if I run it, it will just give me goo.gl. But if I uncomment the line to get the response code, it goes and fetches it from the end domain, and prints www.thomann.de. The same occurs if I use getHeaderFields(), getContent() or similar, but connect() doesn't seem to help. I'm not interested in any of those responses so, how can I make it go and resolve the redirections? When does the connection effectively occur?
has comment: http://stackoverflow.com/comment/42061427
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42057860

http://stackoverflow.com/comment/42224830
comment on: http://stackoverflow.com/a/26828466
type: AnswerComment
score: 0
type: Comment
has text: yes, process method runs on the EDT.JAVA DOC mentioned that process method is invoked asynchronously(Occurring at regular intervals) . so how it takes all the EDT's time.

http://stackoverflow.com/comment/42041200
has text: (Note that the above JSON is an "array" containing two "objects".) (You are apparently trying to parse first into an "object", and that's not right.)
comment on: http://stackoverflow.com/q/26725806
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42097589
has text: The trouble with the Spliterator is that it splits your entire `ArrayList` down the middle, then again as necessary to saturate all CPUs. So you don't get to control the batch size. The authors are also strongly discouraging the use of the ForkJoinPool for tasks which are not computationally intensive and especially so for tasks which cause the threads to block on I/O. Manually splitting into batches and submitting to a classical Executor Service would be their advice.
type: Comment
comment on: http://stackoverflow.com/a/26746047
type: AnswerComment
score: 0

http://stackoverflow.com/a/26698926
type: Answer
type: AcceptedAnswer
has body: Assuming there are no problems with the math, I'd change the last line to return Math.abs(yf - this.y) &lt; SOME_SMALL_CONSTANT; since, given the imprecise nature of floating point arithmetics, your method would probably never return true. I'd play with the value of SOME_SMALL_NUMBER to see what give you decent results.
accepted answer of: http://stackoverflow.com/q/26698897
score: 0
answers question: http://stackoverflow.com/q/26698897

http://stackoverflow.com/q/26708011
answer count: 1
score: -1
favorite count: 0
tagged with: idl
has title: invoke mozIAsyncLivemarks.idl with Java
accepted answer: http://stackoverflow.com/a/26717685
tagged with: c++
type: AnsweredQuestion
has body: How can I Programmatically , directly, invoke mozIAsyncLivemarks.idl with Java? It seems that an IDL comes from C++. While I'm aware of Rome, I'd like to use Firefox if possible. If it's not possible, or extremely difficult, to do this with Java, that would be an acceptable answer as well. This is somewhat like using CORBA? http://mxr.mozilla.org/mozilla-central/source/toolkit/components/places/mozIAsyncLivemarks.idl http://docs.oracle.com/javase/8/docs/technotes/guides/idl/GShome.html
tagged with: java
downvote count: 1
type: Question
upvote count: 0
tagged with: firefox
tagged with: corba
has answer: http://stackoverflow.com/a/26717685
linked to: http://stackoverflow.com/q/670630

http://stackoverflow.com/q/26692214
has title: How to change run as java application settings in Eclipse
answer count: 3
has comment: http://stackoverflow.com/comment/41980419
has comment: http://stackoverflow.com/comment/41980505
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26692626
has comment: http://stackoverflow.com/comment/41980265
has comment: http://stackoverflow.com/comment/41980819
possible better answer: http://stackoverflow.com/a/26692308
upvote count: 2
has answer: http://stackoverflow.com/a/26692308
tagged with: runsettings
has body: I am doing a Java project in Eclipse on Windows. I implemented some methods and tried to test them. But, in Eclipse run or run as seem to be empty. When I try to right click to my project on package explorer and choose run as Java Application, a pop-up shows up and says Select Java Application. But the list under it looks like completely strange to me. And in the same pop-up, at the bottom there is a package name which is not my projects's package. Actually it is exactly the same package where I copied some methods with copy paste. (I changed them in my project). But it seems to be run settings somehow became default or something. This is a school hw and my teacher gave me some files with method definitions. I created a project in Eclipse and copied the files into src folder. So, the question is, how can I change this and run my own project? Thanks in advance... NOTES: My project is a Java project. I am trying to connect from Eclipse to MySQL using JDBC and run some queries. Connector jar file is on place. Path settings seem to be right. EDIT: My teacher wants me to implement an interface named ICPL. So I created a java file named CPL. My teacher also gave me a separate Main.java file.
has comment: http://stackoverflow.com/comment/41980621
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26692596
tagged with: java
tagged with: application-settings
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26692626
has comment: http://stackoverflow.com/comment/41980554
type: Question

http://stackoverflow.com/q/26755460
has comment: http://stackoverflow.com/comment/42094181
has comment: http://stackoverflow.com/comment/42094413
type: Question
has comment: http://stackoverflow.com/comment/42094311
tagged with: java
has answer: http://stackoverflow.com/a/26756314
tagged with: eclipse
has body: I have a JSF 2 application that depends on a external JAR file. Such a JAR file is generated by other project in the same Eclipse workingset. This architecture was chosen for the sake of modularity, so I have some domain core services in a JAR. My application depend on that JAR file and uses it in order to provide end user services. In the JSF2 application I have a simple managed bean, as seen below: package ufprJSF; import java.util.Collection; import javax.faces.bean.*; import unidades.dominio.Cargo; import unidades.dominio.repository.CargoRepository; @ManagedBean public class CargoBean { private CargoRepository cargoRepository; private Collection&lt;Cargo&gt; todos; public Collection&lt;Cargo&gt; getTodos() { return todos; } public String listarTodos() { return "cargos?faces-redirect=true"; } } The home page of the application shows a menu that has some links, one of them linked to the listarTodos() method of the above presented bean. That method just redirects to another page of the application. If I try to run the application in a local TomCat 8 server, I receive: HTTP Status 404 - /ufprJSF/index.xhtml type Status report message /ufprJSF/index.xhtml description The requested resource is not available. Apache Tomcat/8.0.14 The index.xhtml does not use the above bean, it just shows a menu with a link to listarTodos() method of that bean. The console shows the following (among many other lines in the stack): Caused by: java.lang.ClassNotFoundException: unidades.dominio.repository.CargoRepository at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1293) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1145) ... 33 more The project compiles, so during the compile time, the referenced interface is found, what leads me to believe that the dependencies of the JSF2 application are correctly setup. The JAR that contains such a type shows under Referenced Libraries node in the Eclipse package exp…
score: 0
has comment: http://stackoverflow.com/comment/42094571
answer count: 1
tagged with: jar
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26756314
has title: How to use interfaces declared in an external JAR in a JSF application hosted in a local TomCat server
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/a/26787986
score: 2
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26787863
has comment: http://stackoverflow.com/comment/42159251
has body: You only need one Scanner. Your variable names are a little confusing (and I would prefer more limited lexical scope). Finally, you could use a loop. Like, Scanner scan = new Scanner(System.in); System.out.println("How many times will you play?"); int plays = scan.nextInt(); for (int playCount = 0; playCount &lt; plays; playCount++) { System.out.println("How many numbers will you enter?"); int numbers = scan.nextInt(); int sum = 0; for (int count = 0; count &lt; numbers; count++) { System.out.println("Enter a number"); int num = scan.nextInt(); sum += num; } System.out.println("The sum of the numbers entered is:" + sum); }

http://stackoverflow.com/comment/41981158
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26692761
type: Comment
has text: do you need those curly brackets?

http://stackoverflow.com/comment/41949043
has text: So if it is a webapp, spring context shoulb be initialized during startup by using ContextLoaderListener defined in your web.xml. In this case you can create some kind of service, which will be using you repository, or controller. Just define it in your application context and set repository as a dependency using setter or constructor injection.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26674664
type: Comment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/26740262
tags question: http://stackoverflow.com/q/26813045
tags question: http://stackoverflow.com/q/26761157
tags question: http://stackoverflow.com/q/26716022
tags question: http://stackoverflow.com/q/26831425
tags question: http://stackoverflow.com/q/26784835
tags question: http://stackoverflow.com/q/26763216
tags question: http://stackoverflow.com/q/26780747
tags question: http://stackoverflow.com/q/26721936
tags question: http://stackoverflow.com/q/26721835
tags question: http://stackoverflow.com/q/26728753
tags question: http://stackoverflow.com/q/26794743
tags question: http://stackoverflow.com/q/26817904
type: Tag
tags question: http://stackoverflow.com/q/26719214
tags question: http://stackoverflow.com/q/26718524
tags question: http://stackoverflow.com/q/26756589
tags question: http://stackoverflow.com/q/26789341
tags question: http://stackoverflow.com/q/26757650
tags question: http://stackoverflow.com/q/26676748
tags question: http://stackoverflow.com/q/26702605
tags question: http://stackoverflow.com/q/26782881
tags question: http://stackoverflow.com/q/26795483
tags question: http://stackoverflow.com/q/26769381
tags question: http://stackoverflow.com/q/26829908
tags question: http://stackoverflow.com/q/26675116
tags question: http://stackoverflow.com/q/26712392
tags question: http://stackoverflow.com/q/26809421
tags question: http://stackoverflow.com/q/26717850
tags question: http://stackoverflow.com/q/26736503
tags question: http://stackoverflow.com/q/26707689
tags question: http://stackoverflow.com/q/26807061
tags question: http://stackoverflow.com/q/26795382
tags question: http://stackoverflow.com/q/26767683
tag name: html
tags question: http://stackoverflow.com/q/26817540
tags question: http://stackoverflow.com/q/26742442
tags question: http://stackoverflow.com/q/26683831
tags question: http://stackoverflow.com/q/26800231
tags question: http://stackoverflow.com/q/26812561
tags question: http://stackoverflow.com/q/26795598
tags question: http://stackoverflow.com/q/26787173

http://stackoverflow.com/a/26784352
has body: The problem is that most of the OS want a size of 32x32, if it's bigger it will try to resize it to the correct size, so it can happens that it isn't displayed correctly. So you could assume that the correct size should be 32x32. You could use: getBestCursorSize(int preferredWidth, int preferredHeight) It returns the closest supported cursor dimension of the desired size. Take a look in the API => http://docs.oracle.com/javase/7/docs/api/java/awt/Toolkit.html#getBestCursorSize%28int,%20int%2 As a good and safe solution you should just resize your Image with Photoshop, GIMP or another good program, to the size which is supported.
answers question: http://stackoverflow.com/q/26783591
upvote count: 2
has comment: http://stackoverflow.com/comment/42148141
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42159609
downvote count: 0
has comment: http://stackoverflow.com/comment/42159597

http://stackoverflow.com/comment/42184254
type: Comment
has text: That would give you the client's IP. I've corrected my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/26805446
score: 0

http://stackoverflow.com/q/26815471
downvote count: 10
has comment: http://stackoverflow.com/comment/42201975
has comment: http://stackoverflow.com/comment/42202054
favorite count: 0
has comment: http://stackoverflow.com/comment/42202017
tagged with: c++
has comment: http://stackoverflow.com/comment/42202019
has title: c slower than java when summing a billion integers
has comment: http://stackoverflow.com/comment/42209449
has comment: http://stackoverflow.com/comment/42201910
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42202059
has comment: http://stackoverflow.com/comment/42202332
has comment: http://stackoverflow.com/comment/42201938
has comment: http://stackoverflow.com/comment/42202278
tagged with: java
has comment: http://stackoverflow.com/comment/42202570
has comment: http://stackoverflow.com/comment/42202078
type: Question
score: 9
answer count: 2
has body: This is the case: cat sum100000000.cpp &amp;&amp; cat sum100000000.java #include &lt;cstdio&gt; using namespace std; int main(){ long N=1000000000,sum=0; for( long i=0; i&lt;N; i++ ) sum+= i; printf("%ld\n",sum); } public class sum100000000 { public static void main(String[] args) { long sum=0; for(long i = 0; i &lt; 1000000000; i++) sum += i; System.out.println(sum); } } This is the result: time ./a.out &amp;&amp; time java sum100000000 499999999500000000 real 0m2.675s user 0m2.673s sys 0m0.002s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 499999999500000000 real 0m0.439s user 0m0.470s sys 0m0.027s Not seeing anything unusual in the disassembled binary. but seems c binary is significantly slower. which I couldn't understand. My guess is that there might be some problem with the toolchain clang -v Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix uname -a Darwin MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 Add: c / cpp compiled without any special binary. This is not changing the result anyways. gcc sum1b.cpp clang sum1b.cpp Add: for those concerned with llvm, really not changing anything $ gcc sum100000000.cpp &amp;&amp; time ./a.out gcc sum100000000.cpp &amp;&amp; time ./a.out 499999999500000000 real 0m2.722s user 0m2.717s sys 0m0.003s Modification: O2 is a lot faster: but that looks like a cheat $ otool -tV a.out otool -tV a.out a.out: (__TEXT,__text) section _main: 0000000100000f50 pushq %rbp 0000000100000f51 movq %rsp, %rbp 0000000100000f54 leaq 0x37(%rip), %rdi ## literal pool for: "%ld " 0000000100000f5b movabsq $0x6f05b59b5e49b00, %rsi 0000000100000f65 xorl %eax, %eax 0000000100000f67 callq 0x100000f70 ## symbol stub for: _printf 0000000100000f6c xorl %eax, %eax 0000000100000f6e popq %rbp 0000000100000f6f ret I am convinced now that this is related with Optimisation, so now the question more on what did …
has comment: http://stackoverflow.com/comment/42209481
has comment: http://stackoverflow.com/comment/42202049
upvote count: 19
has comment: http://stackoverflow.com/comment/42202006
possible better answer: http://stackoverflow.com/a/26906187
has comment: http://stackoverflow.com/comment/42202080
has answer: http://stackoverflow.com/a/26815565
accepted answer: http://stackoverflow.com/a/26815565
has answer: http://stackoverflow.com/a/26906187
has comment: http://stackoverflow.com/comment/42202048
has comment: http://stackoverflow.com/comment/42202197
has comment: http://stackoverflow.com/comment/42223909
has comment: http://stackoverflow.com/comment/42202072

http://stackoverflow.com/q/26821167
favorite count: 0
has answer: http://stackoverflow.com/a/26821334
type: UnansweredQuestion
has body: Q: How can I determine what commands DrJava is actually executing when I click "Compile"? CONTEXT: I wrote a simple test program which used an external .jar. I added the path to that .jar in DrJava via Edit > Preferences > Resource Locations > Extra Classpath > Add. I want to know how javac is actually called from DrJava. E.g., is it javac -cp &lt;path to the .jar&gt; myprogram.java or javac -cp .;&lt;path to the .jar&gt; myprogram.java or something else?
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to determine what commands DrJava is executing?
answer count: 1
downvote count: 0
tagged with: drjava

http://stackoverflow.com/a/26753269
has body: You can bind using name value pair instead of path. Change your html element with &lt;form id="myId"&gt; &lt;input name="${accountType.field}.name.firstName" value=""/&gt; &lt;/form&gt; and post this form
type: Answer
has comment: http://stackoverflow.com/comment/42094874
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26736258
accepted answer of: http://stackoverflow.com/q/26736258
has comment: http://stackoverflow.com/comment/42090361
has comment: http://stackoverflow.com/comment/42090247
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26690416
tags question: http://stackoverflow.com/q/26682544
tags question: http://stackoverflow.com/q/26798718
tags question: http://stackoverflow.com/q/26787140
tags question: http://stackoverflow.com/q/26828930
tags question: http://stackoverflow.com/q/26732542
tags question: http://stackoverflow.com/q/26764397
tags question: http://stackoverflow.com/q/26823214
tags question: http://stackoverflow.com/q/26737628
tags question: http://stackoverflow.com/q/26805800
tags question: http://stackoverflow.com/q/26708338
type: Tag
tags question: http://stackoverflow.com/q/26768971
tags question: http://stackoverflow.com/q/26769963
tags question: http://stackoverflow.com/q/26770789
tags question: http://stackoverflow.com/q/26715644
tags question: http://stackoverflow.com/q/26782414
tags question: http://stackoverflow.com/q/26752874
tags question: http://stackoverflow.com/q/26684654
tags question: http://stackoverflow.com/q/26831171
tags question: http://stackoverflow.com/q/26700478
tags question: http://stackoverflow.com/q/26802450
tags question: http://stackoverflow.com/q/26798838
tags question: http://stackoverflow.com/q/26789798
tags question: http://stackoverflow.com/q/26747706
tags question: http://stackoverflow.com/q/26787601
tags question: http://stackoverflow.com/q/26726913
tags question: http://stackoverflow.com/q/26742028
tags question: http://stackoverflow.com/q/26772036
tags question: http://stackoverflow.com/q/26695864
tags question: http://stackoverflow.com/q/26701829
tags question: http://stackoverflow.com/q/26790174
tags question: http://stackoverflow.com/q/26738219
tags question: http://stackoverflow.com/q/26788979
tags question: http://stackoverflow.com/q/26757876
tags question: http://stackoverflow.com/q/26802041
tags question: http://stackoverflow.com/q/26722626
tags question: http://stackoverflow.com/q/26694109
tags question: http://stackoverflow.com/q/26830686
tags question: http://stackoverflow.com/q/26791829
tags question: http://stackoverflow.com/q/26719503
tags question: http://stackoverflow.com/q/26687918
tags question: http://stackoverflow.com/q/26681861
tags question: http://stackoverflow.com/q/26728236
tags question: http://stackoverflow.com/q/26736471
tags question: http://stackoverflow.com/q/26681471
tags question: http://stackoverflow.com/q/26733028
tags question: http://stackoverflow.com/q/26765305
tags question: http://stackoverflow.com/q/26797838
tags question: http://stackoverflow.com/q/26767453
tags question: http://stackoverflow.com/q/26784835
tags question: http://stackoverflow.com/q/26798374
tags question: http://stackoverflow.com/q/26796051
tags question: http://stackoverflow.com/q/26816798
tags question: http://stackoverflow.com/q/26823002
tags question: http://stackoverflow.com/q/26755269
tags question: http://stackoverflow.com/q/26790924
tag name: xml
tags question: http://stackoverflow.com/q/26816216
tags question: http://stackoverflow.com/q/26713536
tags question: http://stackoverflow.com/q/26789341
tags question: http://stackoverflow.com/q/26731460
tags question: http://stackoverflow.com/q/26711957
tags question: http://stackoverflow.com/q/26726158
tags question: http://stackoverflow.com/q/26743601
tags question: http://stackoverflow.com/q/26732672
tags question: http://stackoverflow.com/q/26694115
tags question: http://stackoverflow.com/q/26791857
tags question: http://stackoverflow.com/q/26714143
tags question: http://stackoverflow.com/q/26687909
tags question: http://stackoverflow.com/q/26780414
tags question: http://stackoverflow.com/q/26777867
tags question: http://stackoverflow.com/q/26734740
tags question: http://stackoverflow.com/q/26768822
tags question: http://stackoverflow.com/q/26807015
tags question: http://stackoverflow.com/q/26829138
tags question: http://stackoverflow.com/q/26716474
tags question: http://stackoverflow.com/q/26822077
tags question: http://stackoverflow.com/q/26692969
tags question: http://stackoverflow.com/q/26715456

http://stackoverflow.com/comment/42109034
has text: I found out why hibernate was making the join. Take a look at my parameters in option 1. I'm passing the entity (existingAccount) from controller because I needed it there for validation purposes. Now, if I pass only username instead and find the account here, in changePassword method, it works fine aka no joins. Doesn't really solve my problem because as I said, I need existingAccount in the controller and creating another (exactly the same) sql in service layer is pointless so yeah, I will definitely stick to option 2.
comment on: http://stackoverflow.com/a/26762047
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26781550
type: Question
has answer: http://stackoverflow.com/a/26781624
tagged with: hashcode
accepted answer: http://stackoverflow.com/a/26781637
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42141425
has comment: http://stackoverflow.com/comment/42140474
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/26783608
possible better answer: http://stackoverflow.com/a/26781600
has answer: http://stackoverflow.com/a/26781600
has comment: http://stackoverflow.com/comment/42163237
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26781790
has comment: http://stackoverflow.com/comment/42142157
has comment: http://stackoverflow.com/comment/42140804
upvote count: 3
has answer: http://stackoverflow.com/a/26781644
has body: I want to know why new Integer(i).hashCode() or new Long(i).hashCode() returns i but when hashCode() is invoked by some other object say new Double(345).hashCode(), it returns a random number. Why?
downvote count: 2
has title: why does new Integer(i).hashCode() return i?
has answer: http://stackoverflow.com/a/26781637

http://stackoverflow.com/comment/42072150
score: 0
type: AnswerComment
has text: OK I'll give that a try sorry if I sound ignorant but what would be put in the parenthesis where the ... is? I have the url listed in UserFunctions.java Also what's weird though is that it works fine in the source code project I downloaded from androidhive.info
comment on: http://stackoverflow.com/a/26743196
type: Comment

http://stackoverflow.com/comment/41995279
score: 2
has text: http://stackoverflow.com/questions/24110620/the-type-java-util-mapentry-cannot-be-resolved-it-is-indirectly-referenced-fro
comment on: http://stackoverflow.com/q/26700824
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26716677
answer count: 2
possible better answer: http://stackoverflow.com/a/26716851
has comment: http://stackoverflow.com/comment/42023763
downvote count: 0
has answer: http://stackoverflow.com/a/26716851
tagged with: string
linked to: http://stackoverflow.com/q/16645083
score: 6
has comment: http://stackoverflow.com/comment/42023943
has comment: http://stackoverflow.com/comment/42023967
tagged with: groovy
tagged with: regex
upvote count: 6
favorite count: 0
tagged with: python
has comment: http://stackoverflow.com/comment/42023618
has title: Groovy: Why does split()ing an empty string by space return a list of one empty string?
has body: I was expecting an empty list but I got: assert 1 == "".split(/\s+/).size() and assert 0 == "".split().size()
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26717072
has comment: http://stackoverflow.com/comment/42024161
tagged with: java
accepted answer: http://stackoverflow.com/a/26717072
type: Question

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/26735488
tags question: http://stackoverflow.com/q/26718736
tags question: http://stackoverflow.com/q/26682340
tag name: jfreechart

http://stackoverflow.com/comment/42197059
has text: yes, your are right. but hadoop-mapreduce-examples*.jar and hadoop-mapreduce-examples-2.4.1.jar what is the difference?
comment on: http://stackoverflow.com/q/26807547
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26820081
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26820129
tagged with: android
possible better answer: http://stackoverflow.com/a/26820129
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26820394
tagged with: java
type: Question
has body: In this example SwipeRefreshLayout swipeLayout; swipeLayout.setProgressBackgroundColor(android.R.color.holo_blue_bright); but in android studio I get this error : Can not Resolve method 'setProgressBackgroundColor(int )' but in android doc this is a public method!! why I get this error?!
has title: why setProgressBackgroundColor can not resolve error?
accepted answer: http://stackoverflow.com/a/26820394

http://stackoverflow.com/comment/42211217
comment on: http://stackoverflow.com/q/26820638
type: QuestionComment
score: 0
has text: Whoops! I've been messing around with the code so much that I forgot to change that back. It should read g.fillRect(intialX, initialY, 100, 100); I just edited it.
type: Comment

http://stackoverflow.com/q/26741967
tagged with: pattern-matching
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26747410
tagged with: wildcard-mapping
upvote count: 1
linked to: http://stackoverflow.com/q/26235071
has comment: http://stackoverflow.com/comment/42072803
type: Question
has title: Wrong URL match in action mapping
tagged with: struts2
accepted answer: http://stackoverflow.com/a/26747410
has comment: http://stackoverflow.com/comment/42069795
has body: true HomePartner {1} {2} false /WEB-INF/pages/load.xhtml Why localhost:8080/partner/partnerName matches with this action?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42071803
favorite count: 0

http://stackoverflow.com/q/26743519
has answer: http://stackoverflow.com/a/26743565
answer count: 5
tagged with: jbutton
type: AnsweredQuestion
has body: I have a dice program in Java that roll 5 dice by clicking a "Roll" button. I am trying to make the button so that after it is clicked 3 times, it is disables and can not be clicked unless it is closed and re-opened. Thank you! topPanel.add(button1); int i = 0; button1.setToolTipText("Click this button to roll the dice."); button1.setForeground(Color.red); button1.setContentAreaFilled(false); button1.setFocusPainted(false); button1.setBorderPainted(false); if (i &gt;= 3) { button1.setEnabled(false); } else { i++; } button1.setFont(new Font("Arial", Font.BOLD, 15)); button1.setPreferredSize(new Dimension(40, 25)); button1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { die1.roll(); die1.draw(dk); die2.roll(); die2.draw(dk); die3.roll(); die3.draw(dk); die4.roll(); die4.draw(dk); die5.roll(); die5.draw(dk);
has answer: http://stackoverflow.com/a/26743676
tagged with: java
possible better answer: http://stackoverflow.com/a/26743838
type: Question
tagged with: dice
has comment: http://stackoverflow.com/comment/42072691
score: 0
has title: Limit Number of Times JButton can be clicked?
has comment: http://stackoverflow.com/comment/42072757
has answer: http://stackoverflow.com/a/26743658
accepted answer: http://stackoverflow.com/a/26743658
has answer: http://stackoverflow.com/a/26743639
has answer: http://stackoverflow.com/a/26743838

http://stackoverflow.com/a/26811553
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26811401
downvote count: 0
has body: I'm not sure what the use case would be for this. Why not just have the User, in Ruby terms, 'mixin', the SecurePasswords trait and override password within it's class definition? Coming from Ruby, this might be more difficult to get, but Scala is a compiled language and it's generally not a good idea to change class definitions dynamically/on-the-fly like this. Think of the type system in Scala as a way of testing your code. The more you defer code interpretation to runtime, the less testable/safe your code becomes. This is one of the strengths of Scala/Java/Haskell/... (insert compiled typed language) - the type system can catch a lot of errors at compile time. Use this to your advantage, don't fight against it. I would look into the use of implicit parameters and how they can relate/be used with traits. Also, without the broader context of what you are trying to accomplish in your code with this pattern, it's hard to know, but this link might prove useful to you if you are trying to implement some sort of adapter pattern. http://danielwestheide.com/blog/2013/02/06/the-neophytes-guide-to-scala-part-12-type-classes.html
type: Answer

http://stackoverflow.com/q/26827226
has answer: http://stackoverflow.com/a/26827263
tagged with: casting
has answer: http://stackoverflow.com/a/26827349
has title: Using an ArrayList<Class?> for casting?
score: 0
possible better answer: http://stackoverflow.com/a/26827236
has body: Previous question I have the following code: ArrayList&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); list.add("StringType"); list.add(5); list.add(new RandomClass()); List&lt;Class&lt;?&gt;&gt; classes = new ArrayList&lt;&gt;(); classes.add(String.class); classes.add(int.class); classes.add(RandomClass.class); for (int i = 0; i &lt; list.size(); i++) { if (classes.get(i).isInstance(list.get(i))) { ... } } if (isvalid) mymethod(...); public void mymethod(String string, int num, RandomClass randomClass){ } Now I'm trying to cast the object into the right type with a method using a string argument. Instead of: mymethod( (String) list.get(0), (int) list.get(1), (RandomClass) list.get(2) ); I would like to reuse the definition created above for the cast. mymethod( ( define.get(0) ) list.get(0), .... ); I've also tried using the Class.cast(obj) but of course it returns a type '?' which again defeats the purpose of casting it again using (String).
linked to: http://stackoverflow.com/q/26826640
has answer: http://stackoverflow.com/a/26827236
accepted answer: http://stackoverflow.com/a/26827349
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42222369
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26827278

http://stackoverflow.com/a/26813109
score: 1
has body: It sounds to me that you have run into one of the problems that you get when you overuse / misuse static variables. The problem you have run into is that you cannot do polymorphism for static methods in Java: There is no way of saying that all subclasses of a given class must implement a given static method. There is no polymorphic way of calling a static method. A call to a static method in your source code is bound at compile time to the signature of a specific static method provided by a specific class. So, if countHowMany is a static method implemented by lots of classes, then you find that you have to do things like this: int total = Class1.countHowMany() + Class2.countHowMany() + ... ... and something like this: for ( Class &lt;? extends ICountMyself&gt; currentClass : listOfUnitClasses ) simply won't work, because the class Class does not expose any of the methods of ICountMyself. (Well, you could use reflection ... but that is nasty. It is "bad design" smell to use reflection like this.) A small improvement on your current approach would be to make countHowMany() an instance method instead of a static method. That would allow you to declare all of your classes as extends ICountMyself and then invoke the countHowMany on any instance of any of those classes. The method can be implemented as returning or updating the appropriate (class specific) static variable. But that is still bad design smell. The proper object-oriented way to do this is to replace the static variables. Instead, declare a class or classes that represent "collections that may contain zerklings"; e.g. "forces". Make the countHowMany method an instance method of a "force" object ... or whatever ... and have it either return the value of an instance variable associated with the collection, or calculate the value by examining all of the current elements of the "force".
has comment: http://stackoverflow.com/comment/42256281
type: Answer
has comment: http://stackoverflow.com/comment/42269582
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26807630
answers question: http://stackoverflow.com/q/26807630
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42256383

http://stackoverflow.com/a/36996864
answers question: http://stackoverflow.com/q/26689929
downvote count: 0
has body: Here is a much less confusing way of doing it, at least if your not worred about the extra multiplications. : public static double pow(int base,int exponent) { if (exponent == 0) { return 1; } if (exponent &lt; 0) { return 1 / pow(base, -exponent); } else { double results = base * pow(base, exponent - 1); return results; } }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/42097912
score: 0
comment on: http://stackoverflow.com/a/26758058
type: AnswerComment
has text: All the pojo classes are placed in session factory. Placement of annotation can be at on variable declaration or on getter method.
type: Comment

http://stackoverflow.com/q/26688990
type: Question
has answer: http://stackoverflow.com/a/26689001
possible better answer: http://stackoverflow.com/a/40415874
score: 6
has answer: http://stackoverflow.com/a/40415874
tagged with: char
answer count: 3
linked to: http://stackoverflow.com/q/513832
downvote count: 0
has body: I want to see if a character in my string equals a certain other char value but I do not know what the char in the string is so I have used this: if ( fieldNames.charAt(4) == "f" ) But I get the error: "Operator '==' cannot be applied to 'char', 'jav.lang.String'" But "g" == "h" seems to work and I know you can use '==' with char types. Is there another way to do this correctly? Thanks!
tagged with: string
favorite count: 0
has title: Java - Why can't I use charAt() to see if a char equals another?
accepted answer: http://stackoverflow.com/a/26689001
tagged with: equals
has answer: http://stackoverflow.com/a/64977107
has comment: http://stackoverflow.com/comment/41974916
upvote count: 6
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42057549
has text: You call first `c.numbers();` and then `c.calculate(op);` so that's why it does not exit before asking for numbers. Change this order if you want other functionality
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26735519
score: 1

http://stackoverflow.com/comment/42167767
comment on: http://stackoverflow.com/a/26796365
type: Comment
score: 0
has text: Well, as you can see, each Answer is going to hold a list of one or more Steps. So, in each Step we need to reference the parent Answer. The image will be stored in the DB as a binary object, so Java will map it to an Object class. The String text can hold enough information for all the text required in the step. @ManyToOne is the bi-directional link between the Answers and the Steps. And make sure you replace the brackets with the actual column names in the DB
type: AnswerComment

http://stackoverflow.com/q/26776013
answer count: 1
has answer: http://stackoverflow.com/a/26776673
has comment: http://stackoverflow.com/comment/42130890
has comment: http://stackoverflow.com/comment/42130652
tagged with: java
type: UnansweredQuestion
type: Question
has title: itext 1.3.1 start wrapped table row directly on new page
has body: I have a problem I can not solve with itext 1.3.1, the content of a com.lowagie.text.Table cells is variable, often wraps to multiple lines. When the page changes the table is broken and the content continues on the new page. If the line were to end up on the new page can it to be written directly to the new page?
score: 0
tagged with: itext

http://stackoverflow.com/comment/42111127
type: Comment
type: QuestionComment
has text: Question is still unclear to me---whether do you want to get your `default` in switch statement to run? If the question is so,then it is not possible...
score: 0
comment on: http://stackoverflow.com/q/26765094

http://stackoverflow.com/q/26709428
type: Question
has answer: http://stackoverflow.com/a/26709484
has title: Finding index where string 2 starts in the righmost area of string 2
accepted answer: http://stackoverflow.com/a/26709484
upvote count: 1
answer count: 1
tagged with: java
has body: I am writing a program with multiple methods, and one of them asks to find the index where the second strings starts in the rightmost area of the first string. The method accepts two strings as parameters and returns the character index of the position where the second string begins in the rightmost area of the first. For example: IN: mississippi, ss OUT: 5 The catch of this method is that I can only use charAt, substring and length from the String class, and no other class methods. With the help of some users from this site, we came up with this: public static int findInStr1(String s1, String s2) { for (int i = 0; i &lt; s1.length() - s2.length(); i++) { boolean found = true; for (int j = 0; j &lt; s2.length(); j++) { if (s1.charAt(i) != s2.charAt(j)) { found = false; break; } } if (found) { return i; } } return -1; } The above method gives me the index where string 2 starts in string 1, but I am trying to code a method that gives me the index of where string 2 starts in the rightmost area of string 1.
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/42394109
comment on: http://stackoverflow.com/q/26782289
has text: Ok. On thing, How can I assure cargo plugin works correctly. Without using browser 'http://localhost:8080/ROOT' .
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26826501
has comment: http://stackoverflow.com/comment/42222602
has comment: http://stackoverflow.com/comment/42222422
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42222302
has answer: http://stackoverflow.com/a/26827396
has comment: http://stackoverflow.com/comment/42222436
has comment: http://stackoverflow.com/comment/42222443
tagged with: derby
has comment: http://stackoverflow.com/comment/42222126
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/42222439
answer count: 1
has comment: http://stackoverflow.com/comment/42222286
has comment: http://stackoverflow.com/comment/42222530
has comment: http://stackoverflow.com/comment/42222544
has body: Here's what I encountered UI: jlbl.setText("Purchase ID: "); String counterV = String.valueOf(purc.getCounter()); jTF3.setText("P000"+counterV); JPanel p5 = new JPanel(); p5.add(jlbl); p5.add(jTF3); else if(e.getSource() == jbtRetrieve) { String pID = jTF3.getText(); Purchase purchase = purcControl.selectRecord(pID); if (purchase != null) { String pdCountStr = purchase.getPurchaseDetailsID(); String pdCountStr2 = pdCountStr.substring(2,6); int pdCount = Integer.parseInt(pdCountStr2); for(int g = 0; g&lt;pdCount;g++) tableModel.addRow(new Object[]{ purchase.getPurchaseDetailsID(),purchase.getStockID(),purchase.getPrice(),purchase.getQuantity()}); } else { JOptionPane.showMessageDialog(null, "No such purchase ID.", "RECORD NOT FOUND", JOptionPane.ERROR_MESSAGE); } } Control : public Purchase selectRecord(String pID){ return purcDA.getRecord(pID); } DA : public Purchase getRecord(String pID){ String queryStr = "SELECT * FROM " + tableName + " WHERE PurchaseID = ?"; Purchase purchase = null; //MainPurchasingFrame purc = new MainPurchasingFrame(); try{ stmt = conn.prepareStatement(queryStr); stmt.setString(1,pID); ResultSet rs = stmt.executeQuery(); if(rs.next()){ purchase = new Purchase(rs.getString("purchaseDetailsID"),pID, ,rs.getString("stockID"),rs.getDouble("price"),rs.getInt("quantity")); } } catch (SQLException ex){ JOptionPane.showMessageDialog(null,ex.getMessage(),"ERROR",JOptionPane.ERROR_MESSAGE); } return purchase; } Domain: public String getPurchaseDetailsID(){ return purchaseDetailsID ; } public double getPrice(){ return price; } public String getStockID(){ return stockID; } public int getQuantity(){ return quantity; } public void setPurchaseDetailsID(String r){ this.purchaseDetailsID = r ; } public void setPrice(double p){ this.price = p; } public void setStockID(String s){ this.stockID = s; } public void setQuantity(int q){ this.quantity = q; } How do I enter my data into JTable through 4 tier like this ? I know how to do it when everything is set in one…
type: UnansweredQuestion
has title: How to insert data from databse to JTable using 4 tier
has comment: http://stackoverflow.com/comment/42222397

http://stackoverflow.com/comment/42092615
score: 0
type: Comment
type: QuestionComment
has text: @nafas In fact, it makes a big difference. If two processes are involved, you can either use the operating system to pipe the output of process A to the input of process B, or - if you are creating the other process yourself in the Java program - you can simply access this process' input and output streams. If you have only one program (so, only one process) with several threads, there are much better alternatives for communication between them.
comment on: http://stackoverflow.com/q/26754727

http://stackoverflow.com/comment/42168513
score: 0
type: Comment
has text: Can you please read my new 3 added lines at the end ? ( added them after submitting - by mistake)
type: AnswerComment
comment on: http://stackoverflow.com/a/26797270

http://stackoverflow.com/a/26760170
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26760086
answers question: http://stackoverflow.com/q/26760086
has body: This would be the best option: for (Mydata mydata : mydataList){ nameList.add(mydata.name); }

http://stackoverflow.com/comment/42207361
has text: @AndrewThompson hm, ok didn't think of that. I will try that if all else fails. Is there no way to check which button invoked the event, though?
comment on: http://stackoverflow.com/q/26818684
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/63113844
type: AnswerComment
has text: Please check this [URL](http://stackoverflow.com/help)it will be useful to lift your content quality up
comment on: http://stackoverflow.com/a/37825239
type: Comment
score: 0

http://stackoverflow.com/comment/42003574
type: QuestionComment
has text: Um, write a main method. :)
score: 0
comment on: http://stackoverflow.com/q/26703786
type: Comment

android-scrollview
tags question: http://stackoverflow.com/q/26760288
type: Tag
tag name: android-scrollview

http://stackoverflow.com/comment/42155196
has text: WOW that's another great solution as I can see it can be handy in some situations as well. I must appreciate your great example. As always Love you MadProgrammer. I already a big fan of yours.
type: AnswerComment
comment on: http://stackoverflow.com/a/26789398
score: 0
type: Comment

http://stackoverflow.com/comment/42041616
score: 0
type: Comment
type: QuestionComment
has text: you are printing out the pointer to the array, not the contents; you need this http://stackoverflow.com/questions/9655181/convert-from-byte-array-to-hex-string-in-java
comment on: http://stackoverflow.com/q/26726276

rss
tags question: http://stackoverflow.com/q/26777867
tags question: http://stackoverflow.com/q/26748246
tag name: rss
type: Tag
tags question: http://stackoverflow.com/q/26726462
tags question: http://stackoverflow.com/q/26711486

http://stackoverflow.com/a/26719883
has comment: http://stackoverflow.com/comment/42030040
type: Answer
has comment: http://stackoverflow.com/comment/42029853
has comment: http://stackoverflow.com/comment/42030323
has body: First create a java bean for your json (for example here): public class Item { @JsonProperty("id") private String id; @JsonProperty("time") private Integer time; public final String getId() { return id; } public final void setId(String id) { this.id = id; } public final Integer getTime() { return time; } public final void setTime(Integer time) { this.time = time; } } If you are using Jackson Java JSON-processor, you can create a List from JSON-String this way: ObjectMapper objectMapper = new ObjectMapper(); try { List&lt;Item&gt; items = objectMapper.readValue( yourJSONString, objectMapper.getTypeFactory().constructCollectionType(List.class, Item.class)); for (Item item : items) { System.out.println(item.getId()); } } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/42030210
score: 0
has comment: http://stackoverflow.com/comment/42029988
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26719669

http://stackoverflow.com/comment/42166986
comment on: http://stackoverflow.com/q/26781406
has text: When I press "SPACE", I see a message about accepting a package on the server side about 2/3 seconds later. I'll try to make less buffer objects.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42041633
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26725779
has text: @Xylus why "value = t2 + (10 * 3) " ?? what is 10 and 3 ?are user input values?

http://stackoverflow.com/q/26769099
has comment: http://stackoverflow.com/comment/42118777
possible better answer: http://stackoverflow.com/a/26769651
has answer: http://stackoverflow.com/a/26769651
tagged with: return-type
has comment: http://stackoverflow.com/comment/42119092
accepted answer: http://stackoverflow.com/a/26769247
type: Question
type: AnsweredQuestion
has body: I am trying to understand the working of return statement in JAVA. My doubt is if inside a method with a Non void return type, I have a decision block which also has a return statement of its own, Still I have to return some value . For understanding here is a sample code I have written :- public int bunnyEars(int bunnies) { //int count=0; if (bunnies &gt;=1) { count = count + 2; bunnyEars(bunnies -1); return count1; } return count2 ; } In the mentioned code I just want to return the no. of bunnies which I am being able to do from inside the bunnyEars method count1. But still JAVA wont allow to have a non-void method without a return type which is totally understood and I have to add count2 return also. Now I am suspecting that I am having a conceptual understanding failure here. Kindly let me know if I am missing something? Kindly let me know If I am missing some more info here. [Edited] Full code: public class Test5 { //public int ears=1; public int count=0; public int bunnyEars(int bunnies) { //int count=0; if (bunnies &gt;=1) { count = count + 2; bunnyEars(bunnies -1); return count; } return count ; } public static void main(String args[]){ Test5 test5= new Test5(); System.out.println(test5.bunnyEars(90)); } }
tagged with: java
has title: Working of Return statement in a method in Java
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42118783
has answer: http://stackoverflow.com/a/26769753
has answer: http://stackoverflow.com/a/26769247
has comment: http://stackoverflow.com/comment/42119055

http://stackoverflow.com/a/26780952
type: Answer
accepted answer of: http://stackoverflow.com/q/26780824
answers question: http://stackoverflow.com/q/26780824
upvote count: 1
downvote count: 1
has body: Take a look to this page, it may help you: http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html Specially, this part: int getKeyCode() Obtains the key code associated with this event. The key code identifies the particular key on the keyboard that the user pressed or released. The KeyEvent class defines many key code constants for commonly seen keys. For example, VK_A specifies the key labeled A, and VK_ESCAPE specifies the Escape key. for more information : break a loop if Esc was pressed
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42051821
type: Comment
has text: you need a Map<k,v> where k is index, v is value i.e. parenthesis.
comment on: http://stackoverflow.com/a/26732277
type: AnswerComment
score: 0

http://stackoverflow.com/a/26788033
has comment: http://stackoverflow.com/comment/42152514
has comment: http://stackoverflow.com/comment/42152451
score: 0
answers question: http://stackoverflow.com/q/26787650
has body: You are most likely experience this issue because you are not obtaining XML elements from the proper view or the view you are attempting to get data from gets destroyed before you attempt to access it. However, I am not sure why exactly you are experiencing this issue but I do have a work-around solution do suggest: Each time the user enters a field, you can store it in either SharedPreferences or a static class that will serve as a storage unit. I am not sure how all the data is being inputed by the user but you can use different listeners (such as OnClickListener) to track when the user inputs a certain data field. Then you can store the data using one of the two approaches i just mentioned above. Here is an example of using a static storage class. Somewhere in your application you make: class Storage { public static String dateFilled; // ... rest of your data } Then once the user, to use the example you have in the question, stops entering information into the EditText for dateFilled (they focus out of it), you store this information: editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(hasFocus){ // user is still typing so we do nothing }else { // user finished typing and moved on so we store the data Storage.dateFilled = editText.getText().toString(); } } }); You could also use some sort of a Button as the trigger to store information: myBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Storage.dateFilled = editText.getText().toString(); } } Then you can use the stored data like: public class getValueOfFields() { Toast.makeText(getApplicationContext(), Storage.dateFilled, Toast.LENGTH_LONG); // ... } If you want to use SharedPreferences instead, here is a good example.
has comment: http://stackoverflow.com/comment/42152638
has comment: http://stackoverflow.com/comment/42155718
type: Answer
has comment: http://stackoverflow.com/comment/42153728

http://stackoverflow.com/comment/42190753
score: 0
type: AnswerComment
has text: I forgot to remove that palindrome line before I copied my code here. It still displays the same errors. I thought I could return those names to the main method and have that main method print them out. We're not allowed to use print statements anywhere besides the main.
type: Comment
comment on: http://stackoverflow.com/a/26808992

http://stackoverflow.com/comment/42439833
type: Comment
type: QuestionComment
has text: What's the reason for using a custom annotation rather than just `@SuppressWarnings`?
score: 0
comment on: http://stackoverflow.com/q/26828533

http://stackoverflow.com/comment/42091900
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26754068
has text: Thank you Tobías. My timezone is America/Los_Angeles.

http://stackoverflow.com/q/26759284
type: Question
tagged with: togglebutton
tagged with: components
has answer: http://stackoverflow.com/a/26759617
accepted answer: http://stackoverflow.com/a/26759617
has title: JavaFX Get Koordinates from Toggle Button
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26759461
type: AnsweredQuestion
has body: I have a ToggleButton in JavaFX. I want to know on which Coordinate this ToggleButton is. Is there a Function that delivers this values like: getCoordinates or something like that? Thank you for your help :)
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26759461

http://stackoverflow.com/a/26697949
answers question: http://stackoverflow.com/q/26697802
score: 1
upvote count: 1
has body: The easiest way to have a customized 404 Page is to configure them in the web.xml 404 /error404.jsp When a simple jsp is not enough, because you need a full fledged Spring controller, then you can map the location to the controller`s mapping: @Controller public class HttpErrorController { @RequestMapping(value="/error404") public String error404() { ... return "error404.jsp"; } } 404 /error404
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26697802

http://stackoverflow.com/comment/42443563
type: AnswerComment
score: 0
type: Comment
has text: I don't see that button, where do you put it?
comment on: http://stackoverflow.com/a/26951030

http://stackoverflow.com/comment/42143956
type: QuestionComment
comment on: http://stackoverflow.com/q/26783093
has text: Here `i = !f ? j++ : j--` `j` is 4 and becomes 3, but before the decrement it is assigned to `i`, so `i` is 4. Next iteration is for `j=3` and `i=4`, and the switch adds 7 to `i` and decreases `j` by 1, thus `i=11` and `j=2`. I think you could get it by yourself, just grab a piece of paper and follow the code...
score: 0
type: Comment

http://stackoverflow.com/q/26735365
score: 0
tagged with: lucene
has title: issues with get path method in java lucene program
has comment: http://stackoverflow.com/comment/42058260
has body: I am using lucene in Java to find rank documents against a query but I've found error in getpath method code: String DirectoryName = "Doc50" ; File folder = new File(DirectoryName); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) // loop to read files from doc50 folder... { if (listOfFiles[i].isFile()) // condition if current file is of filetype... { Path path = FileSystems.getDefault().getPath(DirectoryName, listOfFiles[i].getName()); String contents = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); //read whole document in single string addDoc(DocumentIndexer, contents, listOfFiles[i].getName()); //add document to indexed documents } Error I get Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method getPath(String, String[]) in the type FileSystem is not applicable for the arguments (String, String) Please help me.
has comment: http://stackoverflow.com/comment/42057991
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/a/37608916
has body: Another simple way to exclude the auto configuration classes, Add below similar configuration to your application.yml file, --- spring: profiles: test autoconfigure.exclude: org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
has comment: http://stackoverflow.com/comment/95631740
has comment: http://stackoverflow.com/comment/69689952
score: 66
has comment: http://stackoverflow.com/comment/68960530
answers question: http://stackoverflow.com/q/26698071
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/88956080
upvote count: 66

http://stackoverflow.com/q/26729926
has comment: http://stackoverflow.com/comment/42050276
has comment: http://stackoverflow.com/comment/42047930
has comment: http://stackoverflow.com/comment/42047893
favorite count: 0
tagged with: javasound
has title: Can I get sound data as array?
has comment: http://stackoverflow.com/comment/42049642
has body: I'm making program for Active Noise Control(also use Adaptive instead of Active / use Cancellation instead of Control) System is pretty simple. get sound via mic turn the sound into data, which I can read(Something like Integer array) make antiphase of the sound. turn the data into sound file Follwing is my question Can I read sound as Integer Array? If I can use Integer Array, how can I make antiphase? Just multiply -1 to every data? Any useful think about my project Is there any recommended language rather than java? I heard that stackoverflow have many top class programmers. So, I expect for critical answer :D
accepted answer: http://stackoverflow.com/a/26747584
tagged with: audio
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42049036
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26747584
has comment: http://stackoverflow.com/comment/42050163
upvote count: 1
answer count: 1
downvote count: 0

compiler-errors
tags question: http://stackoverflow.com/q/26720029
tag name: compiler-errors
tags question: http://stackoverflow.com/q/26783988
tags question: http://stackoverflow.com/q/26799874
tags question: http://stackoverflow.com/q/26692112
type: Tag
tags question: http://stackoverflow.com/q/26707438
tags question: http://stackoverflow.com/q/26694833
tags question: http://stackoverflow.com/q/26770654
tags question: http://stackoverflow.com/q/26747470
tags question: http://stackoverflow.com/q/26819261

http://stackoverflow.com/q/26735488
answer count: 2
has answer: http://stackoverflow.com/a/26740015
accepted answer: http://stackoverflow.com/a/26740015
favorite count: 0
has body: I am trying to hide all labels on my Spider Chart using the JFree library. I was lead to believe that the following line would work but I am getting an error when I add it. webPlot.setLabelGenerator(null); My code: private static JFreeChart createSpiderChart(DefaultCategoryDataset dataset) { SpiderWebPlot webPlot = new SpiderWebPlot(dataset); Font labelFont = new Font("Arial", Font.BOLD, 10); CategoryToolTipGenerator tooltipGenerator = new StandardCategoryToolTipGenerator(); tooltipGenerator.generateToolTip(dataset, 1, 0); Color back_color = new Color(255,255,255,0); webPlot.setOutlineVisible(false); webPlot.setLabelFont(labelFont); webPlot.setSeriesPaint(0, java.awt.Color.decode("#000000")); webPlot.setSeriesPaint(1, java.awt.Color.decode("#209ad4")); webPlot.setBackgroundPaint(back_color); webPlot.setLabelGenerator(null); /** THIS THROWS AN ERROR **/ JFreeChart chart = new JFreeChart("", null /* JFreeChart.DEFAULT_TITLE_FONT */, webPlot, false); chart.setBorderVisible(false); ImageIcon icon = new ImageIcon("C:\\TestCharts\\report-assets\\chart-bg.gif"); chart.setBackgroundImage(icon.getImage()); return chart; } My Error: java.lang.IllegalArgumentException: Null 'generator' argument. at org.jfree.chart.util.ParamChecks.nullNotPermitted(ParamChecks.java:65) at org.jfree.chart.plot.SpiderWebPlot.setLabelGenerator(SpiderWebPlot.java:993) at JavaAgent.createSpiderChart(Unknown Source) at JavaAgent.NotesMain(Unknown Source) at lotus.domino.AgentBase.runNotes(Unknown Source) at lotus.domino.NotesThread.run(Unknown Source) Any ideas and Thanks in advance.
has answer: http://stackoverflow.com/a/55597345
type: AnsweredQuestion
has title: Hide Labels from JFree Spider Chart
score: 3
possible better answer: http://stackoverflow.com/a/55597345
downvote count: 0
tagged with: java
tagged with: swing
tagged with: jfreechart
type: Question
tagged with: charts
tagged with: web-crawler
upvote count: 3

http://stackoverflow.com/a/26825932
score: 4
has comment: http://stackoverflow.com/comment/42220428
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42220325
has comment: http://stackoverflow.com/comment/42220382
has comment: http://stackoverflow.com/comment/42220360
type: Answer
has comment: http://stackoverflow.com/comment/42220310
has comment: http://stackoverflow.com/comment/42220465
accepted answer of: http://stackoverflow.com/q/26825921
has comment: http://stackoverflow.com/comment/42220397
answers question: http://stackoverflow.com/q/26825921
has body: You don't, the OS handles the IO redirection with java main &lt; in.txt &gt; out.txt. Instead you read from System.in and write to System.out. Alternatively, based on the code you posted you might run it with java main in.txt out.txt Then your program would receive "in.txt" as args[0] and "out.txt" as args[1].

http://stackoverflow.com/q/26700997
tagged with: date
type: Question
has body: I am using Gregorian calendar to set the date value and trying to get the values set. Code below Constants.sSetDate_calendar = new GregorianCalendar(year,month,day);// year - 2013, month - 12, day - 15 Log.w("OOOOO", Constants.sSetDate_calendar.get(Calendar.YEAR)+"--"+Constants.sSetDate_calendar.get(Calendar.MONTH)+"--"+Constants.sSetDate_calendar.get(Calendar.DAY_OF_MONTH)+""); In Log statement, i see 11-02 10:21:35.060: W/OOOOO(26671): **2014--0--15** Not sure what is going wrong. Why the values set and get are different ? Need some help here.
answer count: 1
has answer: http://stackoverflow.com/a/26701113
has comment: http://stackoverflow.com/comment/41995736
score: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26701113
has title: Gregorian Calendar - Getting wrong values in Android
tagged with: java
tagged with: gregorian-calendar

http://stackoverflow.com/comment/42092510
has text: Looks like you have a version conflict in your spring jars. can you show which files you are using?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26754982
score: 1

http://stackoverflow.com/comment/42060234
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26737034
score: 0
has text: did you print the tokens?

http://stackoverflow.com/comment/42156333
comment on: http://stackoverflow.com/q/26790116
type: Comment
type: QuestionComment
score: 3
has text: Just move the Java file to the groovy folder, no need to rename

input
tags question: http://stackoverflow.com/q/26754727
tags question: http://stackoverflow.com/q/26793075
tags question: http://stackoverflow.com/q/26791998
tags question: http://stackoverflow.com/q/26821652
tags question: http://stackoverflow.com/q/26813935
tags question: http://stackoverflow.com/q/26830909
tags question: http://stackoverflow.com/q/26772123
tags question: http://stackoverflow.com/q/26747167
tags question: http://stackoverflow.com/q/26677367
tags question: http://stackoverflow.com/q/26811636
tags question: http://stackoverflow.com/q/26769428
tags question: http://stackoverflow.com/q/26758678
tags question: http://stackoverflow.com/q/26782939
tag name: input
type: Tag
tags question: http://stackoverflow.com/q/26761770

http://stackoverflow.com/comment/42169840
comment on: http://stackoverflow.com/q/26687211
score: 0
type: Comment
type: QuestionComment
has text: @iheanyi "*Other than replacing the system wifi manager*" > Is this possible on non-rooted phones? As mentioned in the question, I haven't found any information that explains this is possible.

http://stackoverflow.com/comment/42033233
comment on: http://stackoverflow.com/q/26721205
type: Comment
type: QuestionComment
has text: thread or asynctask? don't use usual threads in android. in a asynctask you can use httprequest as you do in java.
score: 0

http://stackoverflow.com/comment/74533814
type: AnswerComment
score: 0
has text: Looks promising. Please provide some clarification if you can: http://stackoverflow.com/q/43745418/546476
type: Comment
comment on: http://stackoverflow.com/a/26734379

http://stackoverflow.com/q/26698978
has answer: http://stackoverflow.com/a/26699102
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26699016
tagged with: java
tagged with: instances
has answer: http://stackoverflow.com/a/26698990
accepted answer: http://stackoverflow.com/a/26698990
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26699016
has title: Can an instance complete its arguments later?
has body: I wonder if there is any way that I can declare a new instance with parameters, do not fill them, and just set them later. Here is an example: private Example example = new Example() // Need 1 parameter. public void foo(Object arg1) { example = new Example(arg1); } It is clear that this is not possible, but is there a way to do something similar to that?

http://stackoverflow.com/comment/42135967
score: 0
type: Comment
has text: C. When the control changes size, I want the label to change size with it. A and B aren't close.
type: AnswerComment
comment on: http://stackoverflow.com/a/26774402

http://stackoverflow.com/comment/42190232
has text: Your code definitely works ! +1
comment on: http://stackoverflow.com/a/26808221
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/26795934
type: Question
accepted answer: http://stackoverflow.com/a/26798193
tagged with: java
has title: Java ArrayIndexOutOfBounds Exception -
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42166191
has body: I have 2 panels in my form which bound to a parent panel which has its layout set to card layout. In the JFrame's constructor, a database operation is performed and data is taken and used to fill a JList. Then when a user clicks on an item, a new panel ( as part of CardLayout ) shows up with a JTable filled with data taken from a database according to the selection made by the user in the listbox . The program is basically a clinic management system. In this JFrame, the cashier can see the id numbers of patients who are to pay their bills . These id numbers are displayed as a list in the JList. On clicking the list, a patient id is selected and then the drugs prescribed are queried from the database and displayed in the table along with drug id &amp; price. The problem is that I get an ArrayOutOfBoundsException whenever I try to add a row to the JTable. These are declared outside the mouseclick event (globally) private Connection medDbConn = Connect("medicines.db"); private PreparedStatement mPst = null; private ResultSet mRs = null; private Connection conn = Connect("bills.db"); private PreparedStatement pst = null; private ResultSet rs = null; private ArrayList medicines_fine = new ArrayList(); private ArrayList medicines_fine_name = new ArrayList(); private ArrayList medicines_fine_qty = new ArrayList(); private ArrayList medicines_id = new ArrayList(); private ArrayList medicines_price = new ArrayList(); private ArrayList medicines_subtotal = new ArrayList(); private Double cf = 0.00; /** * Creates new form ViewBills */ private DefaultListModel listmodel; private DefaultListModel model; The following is executed in the mouseclick event of the JList . // GET SELECTED VALUE FROM LIST String listvalue = (String) jList1.getSelectedValue(); // SPLIT THE SELECTED LIST VALUE INTO ID AND DATETIME String[] datas = listvalue.split("="); // datas[0] = id and datas[1] = datetime // STORE PATIENTID and DATETIME String Patient_Id = datas[0].trim(); String DateTime = datas[1].…
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42166048
favorite count: 0
has comment: http://stackoverflow.com/comment/42166065
has comment: http://stackoverflow.com/comment/42166490
has answer: http://stackoverflow.com/a/26798193
score: -2
has comment: http://stackoverflow.com/comment/42166194
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42166235
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/42166052

http://stackoverflow.com/comment/42010824
type: Comment
type: QuestionComment
has text: Would you like to validate null or empty Collections? I think that in that case you can use Collections API isEmpty() method
score: 0
comment on: http://stackoverflow.com/q/26702675

http://stackoverflow.com/comment/42220270
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26825682
has text: No matter how many times I look at this: For instance, if I have the string "Bob Bakes Brownies", is there any way I can get this method to produce a list of three strings: "Bob", "Bob Bakes", and "Bob Bakes Brownies" I do not understand why this post got downvotes. Is it because the returned list is immutable? To modify the result list in this scenario is not realistic.
type: AnswerComment

http://stackoverflow.com/q/26780531
upvote count: 2
type: UnansweredQuestion
has body: We are trying to insert values in Redis with the help of java client jedis-2.1.0.jar. We have two modules in our application. One uses get call throughout the day with around 2000 requests per second. Other module does the data loading (around 100 million) everyday when day starts (from 4am to 11am). We have put logs for our calculation of the data. Our logs shows exact match with the input count, but when we check by redis-cli, we get lesser count. The difference range is around 250k to 2.5 million. Our machine has around 120G memory. Below is part of the code where we are trying to load data into Redis. Pipeline pipeline = jedis.pipelined(); int recordCount = 1; while ((dataCurrentLine = dataFileBuffer.readLine()) != null) { pipeline.multi(); if (lineIndex == 1) { String[] tmpArr = dataCurrentLine.split(Constants.HYPHEN); recordCount = Integer.parseInt(tmpArr[1]); LOGGER.info("TotalRecords: " + recordCount); } else if (lineIndex &lt; recordCount) { String[] dataArr = getRedisStorageData(dataCurrentLine); String msisdn = dataArr[0]; String dataStr = dataArr[1]; if (Utils.isNullOrEmpty(dataStr) == false) { if (LOGGER.isInfoEnabled()) { if (addedMsisdns.contains(Long.parseLong(msisdn))) LOGGER.info("Duplicate MSISDN: " + msisdn + "|File: " + fileName); } addedMsisdns.add(Long.parseLong(msisdn)); pipeline.set(msisdn, dataStr); } else { deletedMsisdns.add(Long.parseLong(msisdn)); pipeline.del(msisdn); } } if (lineIndex % 100 == 0) { pipeline.exec(); // printTmpStatus(1); } lineIndex++; } pipeline.exec(); pipeline.sync(); // printTmpStatus(0); tmpList.add(fileName); } Our Redis version is redis_version:2.8.6 Please let us know how to tackle this problem, as it is quite hard to check for each entry.
score: 2
answer count: 0
tagged with: java
has title: Data loss in Redis through jedis
has comment: http://stackoverflow.com/comment/43204911
tagged with: jedis
type: Question
has comment: http://stackoverflow.com/comment/43209288
has comment: http://stackoverflow.com/comment/43199797
downvote count: 0
favorite count: 0
tagged with: redis

http://stackoverflow.com/comment/42507666
has text: Can you add the code where you are checking if internt is available?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26861228
type: Comment

http://stackoverflow.com/comment/78556015
type: QuestionComment
has text: this post help me https://stackoverflow.com/a/43087727/2416823. It works offline, without google pdf viewer!
comment on: http://stackoverflow.com/q/26779198
score: 0
type: Comment

http://stackoverflow.com/q/26791476
has body: I am working on a method to test if a phrase is a palindrome. The method takes a string and checks if the first and last letters of that string are the same. If so, it takes away those letters and then checks the string again until there is only one (or zero) letter left using a recursive function. Currently String start = s.substring(0, 1); String end = s.substring(s.length() - 1, s.length()); takes the first and last letter of each string; however, if I use a two letter string I get a String Index Out of Bounds Error. I thought changing the index to 0,0 would help but I later realized that doesn't even grab the first letter. There is no issue for a string that is 1 or more than 2 characters long. I'll put the rest of the method below if y'all need it, but currently the program doesn't even run that far with a two letter string. public static boolean palindromeTester(String s){ s = justLetters(s); //calls a method that removes all spaces, punctuation String start = s.substring(0, 1); String end = s.substring(s.length() - 2, s.length()-1); if(s.equals("") || s.length() == 1){ return true; } else if(start.equalsIgnoreCase(end)){ return palindromeTester(s.substring(1, s.length() - 1)); } else{ return false; } }
has comment: http://stackoverflow.com/comment/42158962
possible better answer: http://stackoverflow.com/a/26791692
has answer: http://stackoverflow.com/a/26791896
downvote count: 0
has comment: http://stackoverflow.com/comment/42158769
has comment: http://stackoverflow.com/comment/42158793
has answer: http://stackoverflow.com/a/26791655
accepted answer: http://stackoverflow.com/a/26791655
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42158889
has comment: http://stackoverflow.com/comment/42158887
score: 1
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42158799
has answer: http://stackoverflow.com/a/26791692
has comment: http://stackoverflow.com/comment/42158760
has comment: http://stackoverflow.com/comment/42158712
has comment: http://stackoverflow.com/comment/42158917
upvote count: 1
tagged with: string
favorite count: 0
has title: Strange String out of Bounds exception
answer count: 3

http://stackoverflow.com/a/26697672
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26697610
has comment: http://stackoverflow.com/comment/41989778
accepted answer of: http://stackoverflow.com/q/26697610
has comment: http://stackoverflow.com/comment/41989705
has body: frame.add(new JPanelNumber1(), BorderLayout.LINE_START); frame.add(new JPanelNumber2(), BorderLayout.PAGE_END); frame.add(new JPanelNumber3(), BorderLayout.LINE_END); frame.add(new JPanelNumber4(), BorderLayout.CENTER);
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/a/26787791
type: Answer
has body: Just move this code to a Servlet and you should be good to go. In your case the response cannot be used directly since probably the JSP has already written header information into the response. In Servlet your code would look like this: public class TestServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); String email = (String)session.getAttribute("ses_email"); Connection cxn; PreparedStatement ps; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cxn = DriverManager.getConnection("jdbc:odbc:sm","system","gecbsp"); ps = cxn.prepareStatement("select * from smreg3 where email = ?"); ps.setString(1, email); // this avoids sql injection ResultSet rs = ps.executeQuery(); if(rs.next()) { InputStream in = rs.getBinaryStream(1); byte[] buffer = copyStream(in); // use a library like Apache commons IO here rs.close(); cxn.close(); resp.setContentType("image/jpeg"); resp.getOutputStream().write(buffer); resp.flushBuffer(); } }catch(Exception e){ e.printStackTrace(); // replace this by a proper logging framework } } private byte[] copyStream(InputStream in) { // just the copy code from your initial example } } After that you will also need to make the Servlet available in your web.xml Something like this needs to go into your web-app section of web.xml: downloadServlet download downloadServlet test.TestServlet 1 Then the servlet is available as /download inside your web-app context.
answers question: http://stackoverflow.com/q/26787382
has comment: http://stackoverflow.com/comment/42184940
score: 0
has comment: http://stackoverflow.com/comment/42208371
has comment: http://stackoverflow.com/comment/42450774
has comment: http://stackoverflow.com/comment/42184993
has comment: http://stackoverflow.com/comment/42192339

http://stackoverflow.com/q/26761090
tagged with: android
tagged with: android-activity
answer count: 4
has answer: http://stackoverflow.com/a/27275067
upvote count: 3
type: UnansweredQuestion
score: 3
tagged with: android-fragments
tagged with: java
has title: Display logo in ActionBar
type: Question
has answer: http://stackoverflow.com/a/26761382
has answer: http://stackoverflow.com/a/26761749
downvote count: 0
has answer: http://stackoverflow.com/a/26761498
favorite count: 0
has body: I have an action bar but have only been to display the title of application or/and the title of the current fragment activity into it. I would want to display logo in it, and any attempts to add a logo have been unsuccessful. Below is the code: public class MainActivity extends ActionBarActivity { private String[] mOptionMenu; private DrawerLayout mDrawerLayout; private RelativeLayout mDrawerRelativeLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mTitleSection; private CharSequence mTitleApp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView button=(ImageView)findViewById(R.id.logobutton); mOptionMenu = new String[] { "Opción 1", "Opción 2", "Opción 3" }; mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerRelativeLayout = (RelativeLayout) findViewById(R.id.left_drawer); mDrawerList = (ListView) findViewById(R.id.list_view_drawer); mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, mOptionMenu)); mDrawerList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Fragment fragment = null; switch (position) { case 0: fragment = new FirstFragment(); break; case 1: fragment = new SecondFragment(); break; case 2: fragment = new ThirdFragment(); break; } FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.content_frame, fragment).commit(); mDrawerList.setItemChecked(position, true); mTitleSection = mOptionMenu[position]; getSupportActionBar().setTitle(mTitleSection); mDrawerLayout.closeDrawer(mDrawerRelativeLayout); } }); mDrawerList.setItemChecked(0, true); mTitleSection = getTitle(); mTitleApp = getTitle(); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.d…

http://stackoverflow.com/a/26759017
downvote count: 0
type: Answer
has body: ActionCommand is the key used to determine the command String for the ActionEvent that will be created when an Action is going to be notified as the result of residing in a Keymap associated with a JComponent. public void setActionCommand(String command) Sets the command name for the action event fired by this button. By default this action command is set to match the label of the button. read more here
score: 1
answers question: http://stackoverflow.com/q/26758880
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26758880
has comment: http://stackoverflow.com/comment/42101088
type: AcceptedAnswer

http://stackoverflow.com/a/26747568
upvote count: 4
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/42080137
has comment: http://stackoverflow.com/comment/42080349
has comment: http://stackoverflow.com/comment/42080115
has comment: http://stackoverflow.com/comment/42080661
answers question: http://stackoverflow.com/q/26747515
has body: You could... Change Color to have another constructor that takes the color values public class Color { private int red; private int green; private int blue; public Color(){ red = 0; green = 0; blue = 0; } public Color(int red, int green, int blue) { this.red = red; this.green = green; this.blue = blue; } } You could Provide setters (and getters) to change the properties... public class Color { private int red; private int green; private int blue; public Color(){ red = 0; green = 0; blue = 0; } public void setRed(int red) { this.red = red; } public void setGreen(int green) { this.green = green; } public void setBlue(int blue) { this.blue = blue; } public void getRed() { return red; } // Other getters for green and blue... } You could... Do both... You could... Extend Light from Color, but you would still need to either provide a constructor and/or getters and setters inColor
has comment: http://stackoverflow.com/comment/42080261

http://stackoverflow.com/comment/41986718
has text: ^agreed - that is why I ask!
type: Comment
comment on: http://stackoverflow.com/q/26695869
score: 0
type: QuestionComment

http://stackoverflow.com/q/26750042
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26750107
tagged with: patternsyntaxexception
score: 0
answer count: 2
has title: Scanner.nextInt(x) throws PatternSyntaxException
has answer: http://stackoverflow.com/a/26750123
has comment: http://stackoverflow.com/comment/42084301
has comment: http://stackoverflow.com/comment/42084173
favorite count: 0
has comment: http://stackoverflow.com/comment/42084133
possible better answer: http://stackoverflow.com/a/26750123
has comment: http://stackoverflow.com/comment/42084444
has comment: http://stackoverflow.com/comment/42084122
has answer: http://stackoverflow.com/a/26750107
tagged with: java.util.scanner
upvote count: 1
has comment: http://stackoverflow.com/comment/42084176
has body: i know im so nooby for asking but please i want to pass my midterm one of the many questions i have a problem with is ""Write an if-else statement that assigns 20 to the variable y if the variable x is greater than 100. Otherwise, it should assign 0 to the variable y." mine looks like this import java.util.Scanner; public class ifelseprac1 { public static void main(String[] args) { int y; int x=0; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a number for x: "); x=keyboard.nextInt(x); if (x&gt;100) y=20; else y=0; } } the error code im getting is Configuration: ifelseprac1 - JDK version 1.8.0_25 Enter a number for x: Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 525

http://stackoverflow.com/a/26724602
has comment: http://stackoverflow.com/comment/42040073
score: 0
has comment: http://stackoverflow.com/comment/42038643
has comment: http://stackoverflow.com/comment/42038653
type: Answer
answers question: http://stackoverflow.com/q/26724431
has comment: http://stackoverflow.com/comment/42039899
has comment: http://stackoverflow.com/comment/42038620
has comment: http://stackoverflow.com/comment/42039740
has body: If your input can be both characters and letters, why not change to looking for a char or String? Then, you can look for "1" or "A" without any trouble.

http://stackoverflow.com/q/26677161
tagged with: amazon-s3
tagged with: java
type: Question
has body: I have a problem uploading file to cloud that contains cyrillic letters (right_file_кириллица.csv). My code is: ObjectMetadata meta = new ObjectMetadata(); meta.setContentEncoding("UTF-8"); PutObjectRequest por = new PutObjectRequest(s3Bucket, f.asPath(), new ByteArrayInputStream(bos.toString("UTF-8").getBytes(Charset.forName("UTF-8"))), meta); PutObjectResult result = s3Client.putObject(por); bos - this is ByteArrayOutputStream. And this cause exception: com.amazonaws.services.s3.model.AmazonS3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: A796905192C41ED5) at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:937) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:506) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:273) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3660) at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1432) I set encoding UTF-8 in all places where it possible. So, does anybody know how to fix that? Thanks
accepted answer: http://stackoverflow.com/a/31806787
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/31806787
has comment: http://stackoverflow.com/comment/42017071
has title: Amazon S3 and cyrillic letters in file name
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/26810717
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/52243775
type: Answer
accepted answer of: http://stackoverflow.com/q/26789377
has comment: http://stackoverflow.com/comment/89588393
has body: Make sure you are updating your tween manager in your render() method like so: tweenManager.update(Gdx.graphics.getDeltaTime());
answers question: http://stackoverflow.com/q/26789377

http://stackoverflow.com/a/26754952
downvote count: 0
has comment: http://stackoverflow.com/comment/42095306
answers question: http://stackoverflow.com/q/26751854
type: AcceptedAnswer
score: 10
accepted answer of: http://stackoverflow.com/q/26751854
has body: Not sure why it doesn't work with builder(configure()), but if we change it to return ServletDeploymentContext.forPackages( getClass().getPackage().getName()).build(); (as seen here), it'll work (no need to override configure). You can see some more of the sample test configurations in jersey-test-framework-examples EDIT "But how do I add my custom subclass of ResourceConfig (not shown in the example above) in that case?" return ServletDeploymentContext.forServlet(new ServletContainer( new ResourceConfig(HelloResource.class))).build(); As seen here
upvote count: 10
has comment: http://stackoverflow.com/comment/127257535
type: Answer
has comment: http://stackoverflow.com/comment/42095132

http://stackoverflow.com/comment/42118401
type: Comment
comment on: http://stackoverflow.com/a/26747494
score: 1
has text: http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#allMatch-java.util.function.Predicate- also says that allMatch() may short-circuit, meaning it won't event evaluate all elements if it finds a non-matching one.
type: AnswerComment

http://stackoverflow.com/comment/42150907
comment on: http://stackoverflow.com/q/26787105
score: 0
type: Comment
type: QuestionComment
has text: It's neither of an fs issue or a Java issue, but a programming issue; fs operations are buffered, and you need to sync explicitly if you want the behaviour you intend. But syncing is expensive!

http://stackoverflow.com/comment/42164992
score: 0
has text: then you will have to write this else code everywhere you take an input. So this is not the best way to go
type: Comment
comment on: http://stackoverflow.com/a/26794675
type: AnswerComment

http://stackoverflow.com/a/26726757
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26725779
answers question: http://stackoverflow.com/q/26725779
type: Answer
has comment: http://stackoverflow.com/comment/42042773
has body: actually you don't need to declare a and b outside of loop since you are not accessing them outside of the loop .and when you count average then u need to count all ages so put a variable out side and add ages to it .and there is no need to store ages in a String .use int array for ages .. double agecount = 0; and in java int/int ==int .if you divide a int by a int you get a int value but for average int is not good you could use double instead.because of this put a variable double agecount.and you have to cast one int to double double avarageAge = agecount / names.length; and don't forget java array indexes are zero based .you are leaving first element empty [default value]. for (int i =1; i &lt; names.length; i++) change to for (int i = 0; i &lt; names.length; i++) example code public static void users() { String[] names = new String[5]; int[] ages = new int[5]; for (int i = 0; i &lt; names.length; i++) { String a = JOptionPane.showInputDialog(null, "What's your name, user " + (i+1) + "?"); int b = Integer.parseInt(JOptionPane.showInputDialog(null, "What is your age, " + a + "?")); names[i] = a; ages[i] = b; } double agecount = 0; for (int i = 0; i &lt; names.length; i++) { agecount += ages[i]; System.out.println("User " + (i+1) + ": " + names[i] + " " + ages[i] + " years old"); } double avarageAge = agecount /names.length; System.out.println("The avarage age for this quiz is " + avarageAge); } output of for sample inputs >> User 1: u1 22 years old User 2: u2 10 years old User 3: u3 15 years old User 4: u4 54 years old User 5: u5 12 years old The avarage age for this quiz is 22.6
score: 0
has comment: http://stackoverflow.com/comment/42042528
has comment: http://stackoverflow.com/comment/42042693

http://stackoverflow.com/comment/41991637
score: 2
comment on: http://stackoverflow.com/a/26698741
has text: @Constantine If you treat a reference as a type-less pointer to some memory address, then you are no longer in a strongly typed language such as Java. Java has references, not pointers. References always have a type.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26769638
has comment: http://stackoverflow.com/comment/42157397
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26769613
has body: If count1 is the length of the words array then the last valid index is count1-1 but your for uses &lt;= count1 which allows to look for words[count1] which is outside bounds. Turn &lt;= into &lt;. In any case there is no need to manually compute the length of the array, it's already available as words.length.

http://stackoverflow.com/comment/42055099
type: Comment
has text: Basically i need user's access token
comment on: http://stackoverflow.com/q/26734165
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42016164
has text: Be Cool and try this http://www.codeproject.com/Articles/797553/Setting-Up-Your-Android-Development-Environment
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26712466
score: 0

http://stackoverflow.com/comment/42204812
type: Comment
has text: What is watermark text in the context of an image? Are you sure you are using the right word? I had to rewrite your entire question to make it understandable. Now you introduce the concept of "watermark text to an image" whereas your original question sounded more as if you were talking about a "caption for an image". Please clarify!
comment on: http://stackoverflow.com/a/26817011
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41985882
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26695414
has text: Ok, good to know you did something. Please [edit](http://stackoverflow.com/posts/26695414/edit) your question and provide your attempts, then we can help you to solve your specific problem.
score: 0

http://stackoverflow.com/a/26797459
has body: I suggest you Create a new Bitmap and then get width and height of it. Bitmap bitmap = BitmapFactory.decodeFile("full_path_of_bitmap"); if(bitmap.getWidth() &gt; bitmap.getHeight()) // Picture is Landscape. else // Picture is Portrait. Kolay gelsin.
answers question: http://stackoverflow.com/q/26796628
has comment: http://stackoverflow.com/comment/42188090
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/42217843
has text: Put `e.printStackTrace()` inside your `catch` blocks.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26824398

http://stackoverflow.com/q/26774325
has comment: http://stackoverflow.com/comment/42288114
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26774443
has title: Where Does Parent POM.xml resides
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: maven
score: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6797209
has body: I am new to Maven and if it is a very basic question then please spare me. I am working on a project which uses maven and when i am passing the site command for my project i am getting error. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.1:site (default-site) on project mobileads: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.1:site failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3.1:site: org/sonatype/aether/graph/DependencyFilter I know that there is a problem with maven-site-plugin:3.1 version. If i explicitly includes the latest version of maven-site-plugin(3.4) this problem disappears.But my question is where it is picking up maven-site-plugin:3.1 as in my project's pom.xml i can not see this plugin so it indicates me that it is picking some default settings from somewhere. I want to know the name of that file and the location of that file in resides so that i could see all the settings.I use MAC. Thanks in advance. Rajesh

http://stackoverflow.com/comment/42038752
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26724663
has text: So whats your question?

http://stackoverflow.com/q/26713409
tagged with: report
has body: I am trying to implement the validation to Date parameter in Birt. But script is not executing as expected. Eg: ParameterName : StartDate Type : String Validation for Length : Validation script in beforeFactory : errorcode=0; var str=params["StartDate"].value; if( str.length != 10 ) { errorcode=1001; } HTML Text in Report layout: // Error Codes var ERR_INVALID_DATE_FORMAT = 1001; var ERR_INVALID_START_DATE_VALUE = 1003; var ERR_INVALID_END_DATE_VALUE = 1004; // Error Messages​ var MSG_INVALID_DATE_FORMAT ="Invalid Date Format"; var MSG_INVALID_START_DATE_VALUE ="Invalid start date value"; var MSG_INVALID_END_DATE_VALUE ="Invalid end date value"; switch(errorcode;) { case ERR_INVALID_DATE_FORMAT: ​ alert( MSG_INVALID_DATE_FORMAT ); break; case ERR_INVALID_START_DATE_VALUE: alert( MSG_INVALID_START_DATE_VALUE ); break; case ERR_INVALID_END_DATE_VALUE: alert( MSG_INVALID_END_DATE_VALUE ); break; default: alert(errorcode); } The switch statement is not able to validate the errorcode and it's not showing the alert message. Note: Earlier used custom format for date parameter but it's not able to detect the incorrect values for Date like aa/23/20145. Is there any way to implement these validation?
tagged with: birt
upvote count: 1
linked to: http://stackoverflow.com/q/22771359
answer count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26731222
tagged with: validation
downvote count: 0
linked to: http://stackoverflow.com/q/3555031
score: 1
has title: Date parameter validation in Birt
has comment: http://stackoverflow.com/comment/42018811
favorite count: 0
type: Question

http://stackoverflow.com/comment/42044423
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26700863
has text: Thank you! I will try ! But I have one more thing to ask, does the `logger` have something need to pay attention to? For example: does it has to be non-static, or where does it has to be created from(injected , constructor or something else)?
score: 0

http://stackoverflow.com/q/26733909
has comment: http://stackoverflow.com/comment/42054569
has comment: http://stackoverflow.com/comment/42055377
tagged with: java-native-interface
tagged with: java
score: -1
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/26733997
answer count: 1
has body: When creating a JNI object in a Java loop, the memory keeps growing in the Java process. Example: class Nat{ native void hello(); public static void main(String[] args){ while(true){ //creating jni object Nat nat = new Nat(); // in this loop memory growing } } static{ System.loadLibrary('Hello') } } JNIEXPORT void JNICALL Java_Nat_hello(JNIEnv *, jobject){ //NOTHING CODE....................... }
downvote count: 1
favorite count: 0
upvote count: 0
has title: Jni object growing memory in java loop
type: UnansweredQuestion

http://stackoverflow.com/comment/42217331
score: 1
type: Comment
type: QuestionComment
has text: Part of your question is confusing. If you are writing these integers to file, what difference does it make if they are of type int or Integer while in memory?
comment on: http://stackoverflow.com/q/26824108

http://stackoverflow.com/q/26731055
type: Question
tagged with: jsp
linked to: http://stackoverflow.com/q/18586870
score: 0
answer count: 2
has body: Im working on a news site that is created with jsp. I would like to change the link structure using the "title" of news, not only their IDs. At the following screen shot, the website puts the exact title to the URL although it has some different characters I would like to generate url like: mydomain.com/news/id-title I have some question about that : 1- Is it a correct approach using the url like this with different characters ? If not, how can I create URL for a Russian title (completely different characters) ? 2- Should I change these characters ? advantages, disadvantages ? (according to SEO) 3- Putting the title to URL has any benefit for SEO if we compare with the URL that is created only content ID ?
has title: URL structure of a web page with different languages, different characters
tagged with: seo
tagged with: url
has answer: http://stackoverflow.com/a/26782500
tagged with: web
has answer: http://stackoverflow.com/a/26731275
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8713208
linked to: http://stackoverflow.com/q/15923062
tagged with: java

http://stackoverflow.com/comment/42135124
type: Comment
type: QuestionComment
has text: One more thing - pageflow folder is not a normal folder for a web application, so Maven will not just automatically create it without a plugin for this
comment on: http://stackoverflow.com/q/26777706
score: 0

http://stackoverflow.com/comment/42132724
type: Comment
score: 1
type: AnswerComment
has text: The second parameter is the java type that you want the content to be converted to. I suppose you have a bean class defined that can be built from a CSV row, then the second parameter can be an array of that type .class i.e. MyCsvRow[].class However, to do this you need to instruct Spring how to convert it using the HttpMessageConverter I was mentioning. Or you can simply get the content as String: ResponseEntity<String> response = restTemplate.getForObject(url, String.class); and then pass it to your CSV parsing lib.
comment on: http://stackoverflow.com/a/26777008

http://stackoverflow.com/comment/41987838
has text: http://stackoverflow.com/questions/9199984/basic-java-recursion-method try reading this.
comment on: http://stackoverflow.com/a/26695287
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26716474
downvote count: 0
favorite count: 0
has title: spring mvc combine java configuration with xml configuration
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42023075
has comment: http://stackoverflow.com/comment/42023909
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
has body: hi i'm working with spring mvc and thymeleaf and i have my web application configured with a java configuration like this: this is my class that extends WebMvcConfigurerAdapter @EnableWebMvc @ComponentScan(basePackages = {"com.abc.R10"}) @Configuration @ImportResource( {"/WEB-INF/spring/servlet-context.xml"}) public class ConfigApp extends WebMvcConfigurerAdapter{ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/css/**").addResourceLocations("/css/**"); registry.addResourceHandler("/img/**").addResourceLocations("/img/**"); registry.addResourceHandler("/js/**").addResourceLocations("/js/**"); registry.addResourceHandler("/sound/**").addResourceLocations("/sound/**"); registry.addResourceHandler("/fonts/**").addResourceLocations("/fonts/**"); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames("classpath:messages/messages"); messageSource.setUseCodeAsDefaultMessage(true); messageSource.setDefaultEncoding("UTF-8"); messageSource.setCacheSeconds(0);// # -1 : never reload, 0 always reload return messageSource; } // THYMELEAF @Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/views/vistaHtml/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCharacterEncoding("UTF-8"); resolver.setOrder(0); resolver.setCacheable(false); return resolver; } //CONFIGURACION DIALECTS @Bean public SpringSecurityDialect springSecurityDialect() { return new SpringSecurityDialect(); } @Bean public SpringTemplateEngine templateEngine() { SpringTemplateEngine engine = new SpringTemplateEngine(); engine.setTemplateResolver( templateResolver() ); engine…
has comment: http://stackoverflow.com/comment/42024311
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/42033065
upvote count: 1
has comment: http://stackoverflow.com/comment/42031461
type: Question
tagged with: configuration
tagged with: java
has comment: http://stackoverflow.com/comment/42025415

http://stackoverflow.com/comment/42203413
score: 1
comment on: http://stackoverflow.com/q/26816364
has text: What is the actual purpose of this program?Give the details.Give examples.Be more specific and clear.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26677385
tagged with: javafx-8
has title: Selection in TableView with merged columns
has body: In the simplified code below I have hard coded the first row to span all three columns of a TableView. It seems to work well apart from selection. If I have the first row selected and press right, the selection goes to the cell with a width of zero and so seems to disappear. Likewise, if the middle cell of the second row is selected and up is pressed, the selection goes to the same hidden cell. Is there anyway of telling the selection model that certain cells should be ignored? Or is it more likely I have to write a selection model from scratch? import com.sun.javafx.scene.control.skin.TableRowSkin; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class TableSkinTest extends Application { @Override public void start(Stage stage) throws Exception { BorderPane pane = new BorderPane(); Scene scene = new Scene(pane, 500, 500); stage.setScene(scene); ObservableList&lt;Person&gt; data = FXCollections.observableArrayList( new Person("This should span columns because it is long", "", ""), new Person("Isabella", "Johnson", "079155882"), new Person("Ethan", "Williams", "079155883"), new Person("Emma", "Jones", "079155884"), new Person("Michael", "Brown", "079155885") ); TableView&lt;Person&gt; table = new TableView&lt;&gt;(); table.getSelectionModel().setCellSelectionEnabled(true); table.setRowFactory(param -&gt; new TableRow&lt;Person&gt;() { @Override protected Skin&lt;?&gt; createDefaultSkin() { return new TableRowSkin&lt;TableSkinTest.Person&gt;(this) { @Override protected void layoutChildren(double x, double y, double w, double h) { checkState(); if (cellsMap.isEmpty()) return; ObservableList&lt;? extends TableColumnBase&gt; visibleLeafColumns = getVisibleLeafColumns…
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41973708
tagged with: java
tagged with: javafx
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26699009
accepted answer: http://stackoverflow.com/a/26699009

http
tags question: http://stackoverflow.com/q/26710017
tags question: http://stackoverflow.com/q/26724442
tags question: http://stackoverflow.com/q/26697054
tags question: http://stackoverflow.com/q/26822009
tags question: http://stackoverflow.com/q/26743073
tags question: http://stackoverflow.com/q/26790072
tags question: http://stackoverflow.com/q/26777114
tags question: http://stackoverflow.com/q/26715456
tag name: http
tags question: http://stackoverflow.com/q/26827997
tags question: http://stackoverflow.com/q/26807789
tags question: http://stackoverflow.com/q/26760308
tags question: http://stackoverflow.com/q/26758400
tags question: http://stackoverflow.com/q/26789758
tags question: http://stackoverflow.com/q/26700274
tags question: http://stackoverflow.com/q/26807629
type: Tag
tags question: http://stackoverflow.com/q/26729489
tags question: http://stackoverflow.com/q/26815942
tags question: http://stackoverflow.com/q/26708130
tags question: http://stackoverflow.com/q/26769498
tags question: http://stackoverflow.com/q/26793219
tags question: http://stackoverflow.com/q/26699090
tags question: http://stackoverflow.com/q/26806743
tags question: http://stackoverflow.com/q/26808136

http://stackoverflow.com/a/26811699
type: Answer
has comment: http://stackoverflow.com/comment/42195803
answers question: http://stackoverflow.com/q/26811548
accepted answer of: http://stackoverflow.com/q/26811548
type: AcceptedAnswer
has body: protected Time startTime; // Default Time protected Time endTime; // Default Time protected String activityDescription; public void setStart(String month, int day, int year, int hour, int minute) { this.startTime.setDate(month, day, year, hour, minute); } What you are outlining as Default Time is not working like this. EVERY Object that is just declared is null. You need to initialize it, before acecssing its properties (or calling methods ON the object - you still can pass it arround as a parameter ofc) protected Time startTime is a declaration protected Time startTime = new Time(); is a declaration followed by initialization. Until you initialize an object it is null and cannot be used for access unless a value has been assigned to that declaration. if you don't want to initialize an object unless you really need it, you should consider using: public void setStart(String month, int day, int year, int hour, int minute) { if (this.startTime == null){ this.startTime = new Time(); } this.startTime.setDate(month, day, year, hour, minute); } ps.: Depending on what kind of Time Class you are using, there might be no Constructor without arguments.
score: 0

http://stackoverflow.com/a/26674394
type: Answer
score: 0
has body: You can use Foo.class.getResource("Foo.class") to get the location of the compiled class file. The question is, how will this help you simplify your library?
answers question: http://stackoverflow.com/q/26674037

http://stackoverflow.com/comment/42093283
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26755421
score: 0
has text: `instead of view.getContext(), use MainActivity.this` and what for? ... question is: are you clicking the right button?

http://stackoverflow.com/comment/42353533
comment on: http://stackoverflow.com/a/26842710
type: Comment
score: 0
type: AnswerComment
has text: Because the bug is a folder named *.java is parsed as a normal java source code file, so rename all folder name *.java to others, and re-run the idegen.sh will solve the problem.

http://stackoverflow.com/q/26773292
accepted answer: http://stackoverflow.com/a/26773420
has title: How to update Gradle dependencies from command line?
upvote count: 58
score: 58
has answer: http://stackoverflow.com/a/51650168
has answer: http://stackoverflow.com/a/27192995
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26773420
possible better answer: http://stackoverflow.com/a/35374051
has body: I have following build.gradle file: apply plugin: 'java' apply plugin: 'eclipse' sourceCompatibility = 1.7 version = '1.0' repositories { mavenCentral() } dependencies { compile 'org.springframework:spring-core:4.1.1.RELEASE' compile 'org.springframework:spring-context:4.1.1.RELEASE' testCompile group: 'junit', name: 'junit', version: '4.+' } I run following command: $ gradle --refresh-dependencies But it does nothing. The dependencies do not get updated and do not reflect on classpath. The output from command is: :help Welcome to Gradle 2.1. To run a build, run gradle &lt;task&gt; ... To see a list of available tasks, run gradle tasks To see a list of command-line options, run gradle --help BUILD SUCCESSFUL Total time: 5.999 secs Doing this via Eclipse gradle plugin is working though.
tagged with: java
has answer: http://stackoverflow.com/a/35374051
has answer: http://stackoverflow.com/a/64390746
tagged with: gradle
type: Question
downvote count: 0
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/68266829

http://stackoverflow.com/comment/42001409
type: Comment
has text: One more note: you dont want java to ever use swap, full garbage collection hitting the swap can literally take minutes.
score: 0
comment on: http://stackoverflow.com/q/26703649
type: QuestionComment

http://stackoverflow.com/comment/42202804
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26815953
has text: @fge And there is the problem, `output` is likely an instance field

http://stackoverflow.com/comment/42402023
comment on: http://stackoverflow.com/q/26731249
score: 0
type: Comment
type: QuestionComment
has text: What SDK version are you using?

http://stackoverflow.com/q/26680530
has body: my homework is asking me to do a math game in which I prompt the user to answer math questions and then show them the answer. I've created the MathGameclass, but when I create an instance of MathGame, it asks me to put in two ints, which I don't know because I'm trying to generate them randomly. Question: How do I get my random numbers from the class to pass into the instance of MathGame? Below is the MathGame class Underneath that is the main with the instance of MathGame I'm trying to figure out. import java.util.Random; public class MathGame { private int operand1; private int operand2; private int solution; public MathGame(int operand1, int operand2) { this.operand1 = operand1; this.operand2 = operand2; } public int genRandom1() { Random rand = new Random(); int randNum = rand.nextInt(0) + 20; randNum = operand1; return operand1; } public int genRandom2() { Random rand = new Random(); int randNum2 = rand.nextInt(0) + 20; randNum2 = operand2; return operand2; } public int getoperand1() { return operand1; } public int getoperand2() { return operand2; } public String question() { return "What is" + operand1 + operand2 + "?"; } public String solution() { int solution = operand1 + operand2; return "The correct answer is: " + solution; } } I get an error in the instance of MathGame since I need to have two ints go through, but I don't know the ints obviously because they're supposed to be randomly generated, which I did in the class. import java.util.Scanner; public class MathGameMain { public static void main(String[] args) { Scanner scan = new Scanner(System.in); MathGame game1 = new MathGame(); } }
tagged with: variables
has comment: http://stackoverflow.com/comment/41959915
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/41967076
upvote count: 1
accepted answer: http://stackoverflow.com/a/26680581
possible better answer: http://stackoverflow.com/a/26680717
favorite count: 0
has answer: http://stackoverflow.com/a/26680717
has answer: http://stackoverflow.com/a/26685815
has title: Passing random numbers into an instance of an object
has comment: http://stackoverflow.com/comment/41960034
has answer: http://stackoverflow.com/a/26680581
has comment: http://stackoverflow.com/comment/41960306
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41960050
has comment: http://stackoverflow.com/comment/41960043
type: Question

http://stackoverflow.com/comment/42087315
score: 0
type: AnswerComment
type: Comment
has text: "I am facing a problem with an app that is built to run as Android service and should start on boot without any user interaction or existing activity." since you don't need an activity, why not try using only service. And donot forget to revise the Android.mk and add the "LOCAL_CERTIFICATE := platform" .
comment on: http://stackoverflow.com/a/26726668

http://stackoverflow.com/comment/42223851
has text: IIRC you can only have one ticker per intraday bar request, but you can submit multiple requests concurrently to the same session, no need to create a new one per request.
comment on: http://stackoverflow.com/q/26827528
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26762428
answers question: http://stackoverflow.com/q/26761879
has body: Using java8 you can do something like: final List&lt;Row&gt; allErrors = new ArrayList&lt;&gt;(); allErrors.addAll(currentRow); allErrors.addAll(newErrorRow); and then: final List&lt;Row&gt; result = allErrors.stream().filter(p -&gt; Collections.frequency(allErrors, p) == 1) .collect(Collectors.toList());
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42016613
score: 0
has text: What about removing the old version, the new version and making a clean install of the jre?
type: Comment
comment on: http://stackoverflow.com/a/26712549
type: AnswerComment

http://stackoverflow.com/comment/42048306
type: AnswerComment
score: 0
has text: you can use a simulator instead of operator, we used this one it is good http://www.seleniumsoftware.com/downloads.html
type: Comment
comment on: http://stackoverflow.com/a/26730253

http://stackoverflow.com/a/26704723
answers question: http://stackoverflow.com/q/26704675
has comment: http://stackoverflow.com/comment/42002455
downvote count: 0
has body: First of all the System.out part needs to be after the loop, how could you possibly know before? :) then the int[] numbersLow does not make any sense to me. If you just want to count the numbers below 500 do it like this: int counterbelow = 0; System.out.print("These are the numbers between 0 and 499"); for (int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &lt;= 499) { counterbelow++; System.out.print(numbers[i] + " "); } } System.out.print("These are "+counterbelow+" numbers");
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42002463

http://stackoverflow.com/comment/42030206
comment on: http://stackoverflow.com/a/26707415
type: Comment
has text: http://central.maven.org/maven2/org/seleniumhq/selenium/selenium-chrome-driver/ there is no 2.11 version
type: AnswerComment
score: 1

http://stackoverflow.com/comment/77689208
has text: Consider adding an explanation as to why this answer is useful. Otherwise, you risk getting it flagged.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/45364071

http://stackoverflow.com/q/26793035
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42161425
accepted answer: http://stackoverflow.com/a/26793096
has answer: http://stackoverflow.com/a/26793078
has answer: http://stackoverflow.com/a/26793080
favorite count: 0
has comment: http://stackoverflow.com/comment/42161298
answer count: 3
possible better answer: http://stackoverflow.com/a/26793080
downvote count: 1
has comment: http://stackoverflow.com/comment/42161304
tagged with: java
has comment: http://stackoverflow.com/comment/42161282
upvote count: 4
type: AnsweredQuestion
has body: I am trying to determine if a user's input contains a valid int or double instead of a valid String. If the input is an int or a double the program should state "Invalid make". Here is my code: else if (tokens[0].equals("make")) { if (!tokens[2].equals(String)) System.out.println(" Invalid make"); // I have 5 spaces above because I don't know how to use printf with strings searchByMake(tokens[2]); } Edit: Sorry for the confusion guys.. "tokens[]" is an array of strings. I am trying to get my program to print "Invalid Make" if the user inputs make = number (when number is tokens[2])
has title: How to check if a String is a valid int or double
tagged with: string
has answer: http://stackoverflow.com/a/26793096

http://stackoverflow.com/a/26852702
has body: Can MappedByteBuffer be of any use in my case? Refering to the JavaDoc a MappedByteBuffer should give you no performance advantages in contrast to a ByteBuffer. You could even end up with some unexpected changes during your runtime The content of a mapped byte buffer can change at any time, for example if the content of the corresponding region of the mapped file is changed by this program or another. I know that MappedByteBuffer is a memory area which is mapped to a file by the OS, can I leverage multiple threads to do I/O operations on different memory mapped buffers efficiently? Except you know better than your OS or the VM how to read and write your data efficiently this is not the case. Does disk head seek times still matter when multiple threads are mapping different files to different memory buffers? The head still has to seek its position. Unless you have different disks and you do only disk IO it is useless to have more than one thread. In case you have some redundancy reading your data multithreading should be useful, because your OS will cache "hot" data. Is consistency guaranteed in such cases? Not really sure, what you mean, but you have to make sure accessing your ByteBuffer is somehow synchronized, because it is no threadsafe data structure. Are there any benchmark results available for such cases? Last year I did some sort of benchmarking, working with multiple buffers. Long story short, it really depends on the use case, the operating system and your hardware. Depending on how important this is I would recommend you do your own benchmarks. The only constant I remember is that you get the best performance writing data blocks of your disk segment size... which is somehow obvious ;-)
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/42329789
answers question: http://stackoverflow.com/q/26691561
upvote count: 4

http://stackoverflow.com/q/26793489
has comment: http://stackoverflow.com/comment/42162316
has body: Having a problem with my code. It compiles but I run into an issue of the Scanner printing null how many times which is due to the for-each loop at the end of the Driver class I put. The goal is to read from a text file for a first name, last name, and postal code strings and use a for-each loop to print out the input. I'm not sure what I'm doing wrong. A sample line of input file would read something like this: Firstname: Joe Lastname: Jimbob Postalcode: 55555 EDIT: There are 25 lines in the .txt file for an array that holds 25 Person Objects. My bad! This is what I have so far simplified: The Driver class to print out the data along with the Scanner: ... throws IO Exception String firstname = " "; String lastname = " "; String postalcode = " "; File file = new File("input.txt"); Scanner fileScan = new Scanner(file); Person person[] = new Person[25]; // An array of 25 Person objects see Person class while(fileScan.hasNext()) //Error was generated here at Line 20 originally N. Pointer Exception not too sure how to regenerate it { String token= fileScan.next(); //Token to scan for each word and match it with the string before it if(token.equals("Firstname: ")) { firstname = fileScan.next(); } else if(token.equals("Lastname: ")) { lastname = fileScan.next(); } else if(token.equals("Postalcode: ")) { postalcode = fileScan.next(); } for(Person info : person) // Generates null on execution supposed to print Array { System.out.println(info); // Prints null not exactly sure why } And the Person class to see where the Person Object is created: public class Person { private String firstname, lastname, postalcode; public Person(String firstname, String lastname, String postalcode) { this.firstname = firstname; this.lastname = lastname; this.postalcode = postalcode; } public String toString() { return(firstname + " " + lastname +" "+ postalcode); } }
has comment: http://stackoverflow.com/comment/42162402
has comment: http://stackoverflow.com/comment/42162248
has comment: http://stackoverflow.com/comment/42162347
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42162298
tagged with: java
has comment: http://stackoverflow.com/comment/42162179
type: Question
has answer: http://stackoverflow.com/a/26793549
tagged with: arrays
has comment: http://stackoverflow.com/comment/42162050
has comment: http://stackoverflow.com/comment/42162081
accepted answer: http://stackoverflow.com/a/26793549
score: 0
has comment: http://stackoverflow.com/comment/42162044
answer count: 1
has title: FileScanner with Array Object
has comment: http://stackoverflow.com/comment/42162261

http://stackoverflow.com/q/26732641
tagged with: maven-plugin
has title: Accessing attached artifacts from a Maven Mojo
answer count: 0
type: UnansweredQuestion
tagged with: maven
upvote count: 1
score: 1
tagged with: java
type: Question
has body: I have a Maven plugin which has a zip file attached as an artifact. As a part of the mojo execution, I need to unpack the zip file and execute a binary inside it, but I cannot figure out how to obtain a reference to the Artifact representing the attached artifact. I can do like this: Artifact rpcgenArtifact = factory.createArtifactWithClassifier( "com.iar", "iar-codegen-plugin", "1.0.0-SNAPSHOT", "zip", "rpcgen-linux"); resolver.resolve(rpcgenArtifact, project.getRemoteArtifactRepositories(), localRepository); getLog().info(rpcgenArtifact.getFile().toString()); which will work, but I would like to avoid hardcoding the name/version of the Mojo inside itself. Is there a better way to do this?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42437656

http://stackoverflow.com/comment/41967258
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26676220
score: 0
has text: I see, you had to add the `^` anchor as well.

http://stackoverflow.com/a/26700325
downvote count: 0
answers question: http://stackoverflow.com/q/26700265
upvote count: 2
has body: First of all I would create an Enum for this because its clearly a set of predefined constant values. public enum Rank { ONE, TWO, ..., ACE; } Then generate a random number in the bounds of the array (using nextInt(int bound)) and get the resulting value from the array of enum values. Rank allRanks = Rank.values(); //get the array of ranks int randomNum = new Random().nextInt(allRanks.length); //generate a random number in [0; allRanks.length-1] Rank randomRank = allRanks[randomNum]; //get the random rank from the array
type: Answer
score: 2

http://stackoverflow.com/a/26810051
has body: public static int computeSumDivisibleBy3(int[] numbers, int startIndex, int endIndex) { if (startIndex==endIndex) { if(numbers[startIndex]%3==0) { return numbers[startIndex]; } else { return 0; } } else { if(numbers[startIndex]%3==0) { return computeSumDivisibleBy3(numbers,startIndex+1, endIndex)+numbers[startIndex]; } else{ return computeSumDivisibleBy3(numbers,startIndex+1, endIndex); } } }
type: Answer
answers question: http://stackoverflow.com/q/26793827
has comment: http://stackoverflow.com/comment/42193021
score: 0

http://stackoverflow.com/comment/42029237
type: Comment
comment on: http://stackoverflow.com/a/26717279
has text: Yeah. It shows that I have "8.0.25" version. JDK version simply to check when you create the new JavaFX project. You can choose what's the JDK you want to use...
score: 0
type: AnswerComment

http://stackoverflow.com/q/26742027
score: 0
has answer: http://stackoverflow.com/a/26742220
has answer: http://stackoverflow.com/a/26742223
tagged with: android
has title: Loop not working with float?
possible better answer: http://stackoverflow.com/a/26742220
has comment: http://stackoverflow.com/comment/42069984
has comment: http://stackoverflow.com/comment/42069920
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26742223
has body: (libGDX, Java) I'm trying to make an object move from one side of the screen to the other and when it reach the other side it start over. The code I use for the action: if (position.x &lt; 300) { position.x -= 1; } if (position.x == -70) { position.x = 131; } position is a Vector2. 1 is the movement speed of the object and where I have the problem. The loop work fine if the position.x -= A WHOLE NUMBER, but if I want it to be 0.3f, 1.5f... the loop won't work and the object just continue moving. How can if fix it so that the loop will work with any number?
tagged with: libgdx
tagged with: java
answer count: 2
linked to: http://stackoverflow.com/q/2100490
has comment: http://stackoverflow.com/comment/42069937

http://stackoverflow.com/comment/42070249
comment on: http://stackoverflow.com/q/26742042
has text: FWIW, I didn't downvote, but whatever; my question remains unanswered
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26824846
upvote count: 1
answers question: http://stackoverflow.com/q/26824827
downvote count: 0
has body: I think you'll probably find that "cursor.getParent()" returns null, thus setting "cursor" to null on the 2nd line. Then when the third line attempts to call "getRight()" on a null object, you get a NullPointerException.
type: Answer
score: 1

http://stackoverflow.com/comment/42106722
type: AnswerComment
comment on: http://stackoverflow.com/a/26762640
type: Comment
has text: @Narmer Are you sure in both years the change happened in March? Check these two and think some more. http://www.timeanddate.com/time/change/france/paris?year=2013 http://www.timeanddate.com/time/change/france/paris?year=2014 You will see why the result differs.
score: 0

http://stackoverflow.com/q/26674422
answer count: 1
has comment: http://stackoverflow.com/comment/42017027
tagged with: netbeans
tagged with: timer
accepted answer: http://stackoverflow.com/a/26674467
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26674467
has body: Using the code provided by helpful user Stefan I have edited my own code to emulate his, however I cannot get my timer to start at all. I have tried moving the instance out of the private void and that results in other errors like trying to redefine the timer variable. private Timer timer; private void StartStopTimerActionPerformed(java.awt.event.ActionEvent evt) { timer = new Timer(5000,new ActionListener(){ @Override public void actionPerformed(ActionEvent evt) { } }); StartStopTimer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!timer.isRunning()) { timer.start(); AddOneActionPerformed(evt); } else { timer.stop(); } } }); } This code has no effect on the timer. It does not start counting
has title: Java Swing Timer start issue
type: Question
score: 0

http://stackoverflow.com/q/26760177
tagged with: fxml
score: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/42102109
has answer: http://stackoverflow.com/a/26766731
has title: Opening an FXML file
type: Question
has comment: http://stackoverflow.com/comment/42136555
tagged with: scenebuilder
has comment: http://stackoverflow.com/comment/42104972
has comment: http://stackoverflow.com/comment/42137008
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/42102455
has body: Im trying to open our project's fxml files with JavaFX Scene Builder but getting error. Here is one example file: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.collections.FXCollections ?> <?import javafx.constants.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import java.net.URL?> <Constants fx:constant="LARGE_BUTTON_WIDTH"/> <Constants fx:constant="DOUBLE_BUTTON_HEIGHT"/> <Constants fx:constant="LARGE_BUTTON_WIDTH"/> <Constants fx:constant="DOUBLE_BUTTON_HEIGHT"/> <Constants fx:constant="LARGE_BUTTON_WIDTH"/> <Constants fx:constant="DOUBLE_BUTTON_HEIGHT"/> <Constants fx:constant="LARGE_BUTTON_WIDTH"/> <Constants fx:constant="DOUBLE_BUTTON_HEIGHT"/> <Constants fx:constant="LARGE_BUTTON_WIDTH"/> <Constants fx:constant="DOUBLE_BUTTON_HEIGHT"/> <URL value="@../../style/general/Buttons.css"/> <URL value="@../../style/main/kerNMain.css"/> The error Im getting for this from Scene Builder is java.io.IOException: javafx.fxml.LoadException: Invalid attribute. /C:/Users/User/workspace/kerN/src/javafx/frame/main/kerNMain.fxml:37 at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:92) at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:80) at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:95) at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2370) at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:655) at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:386) at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:579) at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:447) at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleLaunch(SceneBuilderApp.java:427) at com.oracle.javafx.scenebuilder.app.AppPlatform.reques…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42136858

http://stackoverflow.com/a/26754844
answers question: http://stackoverflow.com/q/26753900
has body: If you're referring to the methods of the Mouse interface, they're not used directly rather through an Actions class. The use is upon you, hovering over the element, checking the title etc. Consider the following code to hover over the element elem WebElement elem = driver.findElement(By.tagName("div")); Actions action = new Actions(driver); action.moveToElement(elem); action.perform(); Action holds a reference to a Mouse, and uses the mouseMove method to navigate to an element. If you want a more direct approach to an implementation of the interface you can do ((HasInputDevices) driver).getMouse() getMouse() and getKeyboard() are implemented by every driver
accepted answer of: http://stackoverflow.com/q/26753900
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/66234926

http://stackoverflow.com/comment/41967812
type: QuestionComment
comment on: http://stackoverflow.com/q/26684830
has text: Always use braces, even for a single statement. And ask yourself: what's the point of creating a State if you create it and then forget about it? What's the point of a map if you don't store anything inside it?
score: 0
type: Comment

http://stackoverflow.com/q/26824864
has comment: http://stackoverflow.com/comment/42218528
tagged with: java
has title: Shuffling an array of cards
type: Question
has answer: http://stackoverflow.com/a/26824955
answer count: 2
linked to: http://stackoverflow.com/q/16361632
has answer: http://stackoverflow.com/a/26825008
has body: I'm having trouble shuffling an array of cards.I have about 3 shuffling methods in my program and none of them seem to work. If anyone can help me out with this, that would be great. I have a folder full of cards called 1.png, 2.png.... 52.png public class CardButton extends JButton{ ImageIcon front, back; boolean flipped; public CardButton(ImageIcon front, ImageIcon back) { this.front = front; this.back = back; flipped = true; flip(); } public void flip() { flipped = !flipped; if (flipped) this.setIcon(front); else this.setIcon(back); } } public class CardButtonPanel extends JPanel { CardButton b, b1, b2, b3; ImageIcon back, card1, card2, card3; int count; ActionListener taskPerformer; Timer t1; // Instantiating a new array CardButton[] array; public CardButtonPanel() { int w = 72, h = 86; back = new ImageIcon(getClass().getResource("b2fv.png")); Image i1 = back.getImage(); Image i2 = i1.getScaledInstance(w, h, Image.SCALE_DEFAULT); back.setImage(i2); array = new CardButton[53]; List list = Arrays.asList(array); Collections.shuffle(list); for (int i = 1; i &lt; array.length; i++) { // int j = shuffle(); card1 = new ImageIcon(getClass().getResource(i + ".png")); i1 = card1.getImage(); i2 = i1.getScaledInstance(w, h, Image.SCALE_DEFAULT); card1.setImage(i2); b1 = new CardButton(card1, back); b1.addActionListener(new ButtonHandler1()); add(b1); array[i] = b1; } taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { b1.flipped = true; b1.flip(); } }; t1 = new Timer(200, taskPerformer); t1.setRepeats(false); } /* * public void shuffle() { currentCard = 1; for (int i = 1; i&lt;array.length; * i++) { int second = randomNumbers.nextInt(52); * * * } } * * public int randomInteger(int x, int y) { Random rInteger = new Random(); * // int IntegerRandom = rInteger.nextInt((x-y) +1) + x; int IntegerRandom * = rInteger.nextInt(52); return IntegerRandom; } * * public void swapCards(int i, int j) { CardButton temp = array[i]; * array[i] = array[j]; ar…
score: 0
has comment: http://stackoverflow.com/comment/42218664
tagged with: shuffle
type: UnansweredQuestion

http://stackoverflow.com/q/26761263
score: 0
linked to: http://stackoverflow.com/q/8027670
has answer: http://stackoverflow.com/a/26761610
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42104117
has title: Trying to compile Java source (could not find main class)
has comment: http://stackoverflow.com/comment/42103895
accepted answer: http://stackoverflow.com/a/26761610
type: AnsweredQuestion
tagged with: java
has body: Trying to learn Java again and I cannot remember how I figured this out the first time around. I have 3 classes; a GameLauncher, GuessGame, and Player. GameLauncher has my main method. They are all packaged as chap02, I cannot remember if that is important to me yet. I am compiling like this: javac GameLauncher.java GuessGame.java Player.java running like this: java GameLauncher I am getting this error: Could not find or load main class GameLauncher. I know this is a ridiculous issue, but I have always had trouble with this kind of stuff. The actual programming and writing code I can pick up just fine, but dealing with these damn compilers always gets me. Any help would be appreciated. Thanks package chap02; public class GameLauncher { public static void main (String[] args) { GuessGame game = new GuessGame(); game.startGame(); } } Edit: The issue isn't with the actual code, the issue is with how I am compiling it.
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/26748490
type: Question
has body: How can i pass or use again the result value of the String (Val1 variable) from the Form1 to Form2? Help Pls. Form1 public class Form1(){ String Val1; Val1=JCombobox.getSelectedItem().toString(); Form2 f2=new Form2(); f2.setVisible(true); } Form2 public class Form2(){ //(Code Goes Here)Value of Variable Val1 supposedly goes here how can i do that? }
score: -2
has title: How to pass the String value, from the Form1 to Form2 class?
downvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: netbeans
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26748529

http://stackoverflow.com/comment/42137591
has text: @Unheilig You can also do `HashMap<String,String> map = new HashMap<String, String>();`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26779230

http://stackoverflow.com/comment/42096937
comment on: http://stackoverflow.com/a/26756241
type: Comment
type: AnswerComment
has text: @mail2kiru contains the objects that you want to have access control. E.g. Student, Person, or some page... You can have something like `pageOne, read`, when user request that resouce (pageOne), you check user's profile, if his role has the permission read/write, to do further process.
score: 0

http://stackoverflow.com/q/26811266
has title: Why are my constructors recognized as methods?
has answer: http://stackoverflow.com/a/26811278
has body: I am working on a program to hold bank accounts as objects. The accounts have an interest rate, balance, ID, and date created data to go along. In what I have made, the default balance, id, and interest is 0 from what I understand. The interest rate is undefined by default. The book I am learning form shows that a no-arg constructor is done with "Circle() { }".I used "account() { }" in the account class. When I run the program in jGRASP, I get error "invalid method declaration; return type required" for both of my constructors. It is recognizing what I intend to be constructors as methods. What do I need to understand so I can make my constructors not be recognized as methods? When running the first constructor, I understand we create an Account object called account with the default values. When we run the second constructor, we are changing the values of the account object to something with specified public class Bank{ public static void main(String[] args){ Account account = new Account(1122, 20000); account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); System.out.println("Balance is " + account.getBalance()); System.out.println("Monthly interest is " + account.getMonthlyInterest()); System.out.println("This account was created at " + account.getDateCreated()); } } class Account { private int id = 0; private double balance = 0; private double annualInterestRate = 0; private String dateCreated; account(){ } account(int newID, double newBalance){ id = newID; balance = newBalance; } //accessor for ID public int getID(){ return id; } //acessor for balance public double getBalance(){ return balance; } //accessor for interest rate public double getAnnualInterest(){ return annualInterestRate; } //mutator for ID public void setID(int IDset){ id = IDset; } //mutator for balance public void setBalance(int BalanceSet){ balance = BalanceSet; } //mutator for annual interest public void setAnnualInterestRate(double InterestSet){ annualInterestRate …
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26811358
answer count: 3
has answer: http://stackoverflow.com/a/26811358
tagged with: object
accepted answer: http://stackoverflow.com/a/26811278
tagged with: class
type: AnsweredQuestion
tagged with: constructor
type: Question
has answer: http://stackoverflow.com/a/26812808

http://stackoverflow.com/comment/42161623
type: QuestionComment
comment on: http://stackoverflow.com/q/26792879
has text: The problem is from the book. I have given that on assignments before which is why I recognized it. If you post the code you have, I will be more than glad to help you through it. After all, I know EXACTLY what the answer is.
score: 0
type: Comment

http://stackoverflow.com/q/26796573
tagged with: replace
answer count: 2
upvote count: 1
tagged with: email
favorite count: 0
has title: How to mask part of string with * in regex
type: UnansweredQuestion
has body: I want to mask email adress in Java from some-email@domail.com to s********l@domail.com - mask local name without only first and last letter and i want to number of * match amount of replaced symbols I need some expression like /^(.)(.*)(.)@(.*)$/ and replace in part 2 each symbols with * How can i do this in Java?
tagged with: regex
downvote count: 0
has answer: http://stackoverflow.com/a/50349603
score: 1
tagged with: java
tagged with: mask
type: Question
has answer: http://stackoverflow.com/a/26796711

http://stackoverflow.com/comment/42029057
type: Comment
has text: Thanks. Got rid of that line and it's working now. I had to change the l.pushInteger calls to l.pushNumber as well for some reason. Thanks again for the help!
comment on: http://stackoverflow.com/a/26719276
type: AnswerComment
score: 0

http://stackoverflow.com/a/26761792
downvote count: 0
has comment: http://stackoverflow.com/comment/42105066
type: Answer
has comment: http://stackoverflow.com/comment/42105286
score: 2
accepted answer of: http://stackoverflow.com/q/26761736
answers question: http://stackoverflow.com/q/26761736
has comment: http://stackoverflow.com/comment/42105223
has body: You only ever test the min value for (int j = 3; j &lt;= Math.sqrt(min); j++) { if (min % 2 == 0) // min never changes break; else if (min % j == 0) Most likely you intended to test i in each case where you use min This is where using a debugger or writing unit tests would have solved this problem for you. I assume the purpose is to see lots of CPU being used. If you wanted speed, you could optimise this a lot though I suspect the Sieve of Eratosthenes in one thread will be much faster.
upvote count: 2
type: AcceptedAnswer

struts2
tags question: http://stackoverflow.com/q/26745379
tags question: http://stackoverflow.com/q/26830229
tags question: http://stackoverflow.com/q/26677633
tags question: http://stackoverflow.com/q/26683598
tags question: http://stackoverflow.com/q/26699019
tags question: http://stackoverflow.com/q/26690727
tag name: struts2
tags question: http://stackoverflow.com/q/26677890
tags question: http://stackoverflow.com/q/26754062
tags question: http://stackoverflow.com/q/26750994
tags question: http://stackoverflow.com/q/26737402
tags question: http://stackoverflow.com/q/26752434
tags question: http://stackoverflow.com/q/26829877
tags question: http://stackoverflow.com/q/26702426
tags question: http://stackoverflow.com/q/26710151
tags question: http://stackoverflow.com/q/26828861
tags question: http://stackoverflow.com/q/26768035
tags question: http://stackoverflow.com/q/26783852
tags question: http://stackoverflow.com/q/26731093
tags question: http://stackoverflow.com/q/26818260
tags question: http://stackoverflow.com/q/26823203
tags question: http://stackoverflow.com/q/26684025
tags question: http://stackoverflow.com/q/26721881
tags question: http://stackoverflow.com/q/26712370
type: Tag
tags question: http://stackoverflow.com/q/26778292
tags question: http://stackoverflow.com/q/26741967

http://stackoverflow.com/comment/42002135
has text: Just do a basic for loop to your array.
comment on: http://stackoverflow.com/q/26704512
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42184552
comment on: http://stackoverflow.com/q/26805757
type: Comment
score: 1
has text: `user_input.nextInt()`
type: QuestionComment

http://stackoverflow.com/q/26747167
type: UnansweredQuestion
score: -3
tagged with: input
downvote count: 4
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/42079400
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26747224
has answer: http://stackoverflow.com/a/26747214
answer count: 3
has answer: http://stackoverflow.com/a/26749030
upvote count: 1
has body: So I'm new to java and a bit confused. I learn best by taking what I've just been taught and creating my own little programs with it, just to help understand the principles at work. I'm having an issue learning how to use a user input and equaling it to something. Essentially I want a user to input their gender, and based on their answer, get a response using if/else. This is all of the code I have right now pertaining to the area, and I'm really confused on how to go about getting their answer from the input, and then checking it using if/else. Scanner four = new Scanner(System.in); System.out.println("So, what gender did you say you were?"); //Add if/else statement response here that will be called based on user input
has title: If/Else result based off of user input
favorite count: 0

http://stackoverflow.com/a/26781032
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26769381
has comment: http://stackoverflow.com/comment/42141182
score: 1
answers question: http://stackoverflow.com/q/26769381
upvote count: 1
has body: Some times JS requires time to execute, so you have to wait for execution, best is to retrying for some time until page is not updated (using any condition) here is example of code HtmlForm form = page.getForms().get(0); HtmlTextArea textArea = form.getTextAreaByName("scandata"); HtmlSubmitInput button = form.getInputByValue("Submit"); HtmlPage res = button.click(); int input_length = page.getByXPath("//input").size(); int tries = 5; while (tries &gt; 0 &amp;&amp; input_length &lt; 12) { //you can change number of tries and condition according to your need tries--; synchronized (page) { page.wait(2000); //wait } input_length = page.getByXPath("//input").size(); //input length is example of condtion }
type: AcceptedAnswer

http://stackoverflow.com/a/26770316
type: Answer
has body: Your services and repositories must be annotated, avoid declare them through XML First: from public class MemberDaoImpl implements MemberInterface{ to @Repository public class MemberDaoImpl implements MemberInterface{ Second Is not recommendable use HibernateTemplate anymore, you can use directly in your repository the Hibernate SessionFactory Third You must annotate your @Service and @Repository with @Transactional, because Hibernate is going to ask for Transaction support. It furthermore requires define some extra beans in your configuration for the transactionManager
answers question: http://stackoverflow.com/q/26766628
score: 0

http://stackoverflow.com/comment/42131035
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26776005
has text: Have a look at http://docs.oracle.com/javase/7/docs/api/javax/xml/xpath/package-summary.html and comment if there's any part that you'd like clarification of.

http://stackoverflow.com/q/26783038
tagged with: android
has title: Android, runnable message queuing error
has comment: http://stackoverflow.com/comment/42153908
has comment: http://stackoverflow.com/comment/42153487
answer count: 0
has body: I am a beginner to android trying to use the following runnable in the onResume() method of my app to plot a realtime signal which my app receives from a bluetooth connected sensor. the sensor sends a high frequency signal of 200hz which is 5ms delay and I have a serialReceive method on my main thread which receives the bluetooth data. My graphview data is updated in this method and also included is a stream writer code which stores the data to SD card. Now my problem is when I send the high frequency data, the app stops working. When I tried to identify the problem its within this runnable because all the others are working. I tried to use the postDelayed method at the end (mHandler.postDelayed(mTimer1, 5);) but its not working either. Note that the runnable also works if i use a low freq signal input of like 20hz (50ms delay). mTimer1 = new Runnable() { @Override public void run() { GraphViewData[] gvd = new GraphViewData[seriesX.size()]; seriesX.toArray(gvd); Series.resetData(gvd); mHandler.post(this); } }; mHandler.post(mTimer1); FYI, Here is the method I receive the serial data from @Override public void onSerialReceived(String theString) { ecgSensor = Double.parseDouble(theString); seriesX.add(new GraphViewData(dataCount, ecgSensor)); textOut.add(new String(String.valueOf(dataCount) + " " + theString + lineSep)); printable = textOut.toString(); try { if(!file.exists()){ file.createNewFile(); } outputStream = new FileOutputStream(file); OutputStreamWriter myWriter = new OutputStreamWriter(outputStream); myWriter.append(printable); myWriter.flush(); myWriter.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } dataCount++; if (seriesX.size() &gt; 250) { seriesX.remove(0); graphView.setViewPort(dataCount - 250, 250); } } Any help on how to solve this is appreciated. Many thanks,
tagged with: java
tagged with: multithreading
type: Question
tagged with: bluetooth
score: 0
has comment: http://stackoverflow.com/comment/42144731
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42147602

http://stackoverflow.com/comment/42013874
has text: I've updated my question, it's only List<Object>, it cant be parcelable as I'm using the class 'Object' that's not parcelable.
type: QuestionComment
comment on: http://stackoverflow.com/q/26711220
score: 0
type: Comment

http://stackoverflow.com/comment/42791163
type: Comment
type: QuestionComment
score: 0
has text: thanks for the comment; for production I intend to use dynamic class loading; I'll use DCEVM for development only
comment on: http://stackoverflow.com/q/26775619

http://stackoverflow.com/a/26743189
type: Answer
has comment: http://stackoverflow.com/comment/42096627
accepted answer of: http://stackoverflow.com/q/26714155
has body: In your test class your glasspane doesn't intercept events, because you didn't tell it to intercept events (intercepting events is not a default behavior). In the documentation link, it says The glass pane The glass pane is useful when you want to be able to catch events or paint over an area that already contains one or more components. For example, you can deactivate mouse events for a multi-component region by having the glass pane intercept the events. Or you can display an image over multiple components using the glass pane. You can intercept Mouse Events this way: glassPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { e.consume(); } @Override public void mousePressed(MouseEvent e) { e.consume(); } }); You can intercept KeyBoard Events this way: glassPane.setFocusable(true); glassPane.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { e.consume(); } @Override public void keyReleased(KeyEvent e) { e.consume(); } @Override public void keyPressed(KeyEvent e) { e.consume(); } }); Note: The JPanel has to be focasable to intercept the keyboard events.
has comment: http://stackoverflow.com/comment/42091213
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26714155
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42113151
type: Comment
comment on: http://stackoverflow.com/a/26765526
has text: Ok, So as you said I used ByteArrayOutputStream, but it doesn't have writeDouble func, only int. What can I do ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26729385
type: Answer
answers question: http://stackoverflow.com/q/26729224
has body: You're currently only storing the last id returned from the DL manager. Changed this to a thread-safe queue - that should fix it if I understand your use can correctly. public class MainActivity extends ActionBarActivity { TextView testtv; String[] imagenames; String BASEURL; private Queue&lt;Long&gt; enqueue = new ConcurrentLinkedQueue&lt;&gt;(); private DownloadManager dm = null; @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BASEURL = getResources().getString(R.string.base_URL); imagenames = getResources().getStringArray(R.array.pic_name); testtv = (TextView) findViewById(R.id.testtv); File Path = getExternalFilesDir(null); File noMedia = new File(Path + "/.nomedia"); if (!noMedia.exists()) { try { noMedia.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Path.mkdirs(); for (int index = 0; index &lt; imagenames.length; index++) { File image = new File(Path + "/" + imagenames[index]); if (image.exists()) { testtv.setText("file exists"); } else { Boolean result = isDownloadManagerAvailable(getApplicationContext()); if (result) { downloadFile(imagenames[index]); } } } } @SuppressLint("NewApi") public void downloadFile(String imagename) { // TODO Auto-generated method stub String DownloadUrl = BASEURL + imagename; DownloadManager.Request request = new DownloadManager.Request( Uri.parse(DownloadUrl)); request.setDescription("P3 Resources"); // appears the same // in Notification // bar while // downloading request.setTitle("P3 Resources"); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE); } String fileName = DownloadUrl.substring( DownloadUrl.lastIndexOf('/') + 1, DownloadUrl.length()); request.setDestinationInExternalFilesDir(getApplicationContext(), …
accepted answer of: http://stackoverflow.com/q/26729224
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42051774
downvote count: 0

http://stackoverflow.com/q/26716162
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/26806048
has answer: http://stackoverflow.com/a/26716461
has answer: http://stackoverflow.com/a/26716500
type: UnansweredQuestion
type: Question
has title: When keyboard active then touch screen anywhere, close keyboard
linked to: http://stackoverflow.com/q/15412943
has comment: http://stackoverflow.com/comment/42168591
tagged with: java
has body: I think I'm unable to use the correct words to find my desired code for this as I think this is doable. I simply want to close the keyboard view from android, if I press anywhere else than on the keys. (above the keyboard actually...) E.g. when I'm in an EditView, done editting.
linked to: http://stackoverflow.com/q/4165414
tagged with: touch
answer count: 3
tagged with: keyboard

http://stackoverflow.com/comment/42247955
score: 0
comment on: http://stackoverflow.com/a/26840708
type: AnswerComment
type: Comment
has text: Yes, i want the two features performed on the node. The checkbox is to select nodes in every level but not the childs. The contextMenu is to select the node and its children. I try what you said to do but nothing happens :/

http://stackoverflow.com/q/26726085
has body: When running the activator ui on a my mac it crashes and reports the following error. java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:224) at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:301) at java.util.logging.Logger.log(Logger.java:616) at java.util.logging.Logger.doLog(Logger.java:641) at java.util.logging.Logger.logp(Logger.java:757) at org.jboss.netty.logging.JdkLogger.debug(JdkLogger.java:36) at org.jboss.netty.logging.InternalLoggerFactory$1.debug(InternalLoggerFactory.java:80) at org.jboss.netty.channel.socket.nio.SelectorUtil.&lt;clinit&gt;(SelectorUtil.java:57) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.getMaxThreads(NioServerSocketChannelFactory.java:248) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.&lt;init&gt;(NioServerSocketChannelFactory.java:115) at play.core.server.NettyServer.play$core$server$NettyServer$$newBootstrap(NettyServer.scala:47) at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:127) at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:126) at scala.Option.map(Option.scala:145) at play.core.server.NettyServer.&lt;init&gt;(NettyServer.scala:126) at play.core.server.NettyServer$.createServer(NettyServer.scala:243) at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:280) at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:275) at scala.Option.map(Option.scala:145) at play.core.server.NettyServer$.main(NettyServer.scala:275) at activator.UIMain$$anonfun$run$1.apply$mcV$sp(UIMain.scala:110) at activator.UIMain$$anonfun$run$1.apply(UIMain.scala:110) at activator.UIMain$$anonfun$run$1.apply(UIMain.scala:110) at activator.UIMain.withContextClassloader(UIMain.scala:221) at activator.UIMain.run(UIMain.scala…
answer count: 1
has title: activator ui only broken, on a mac
tagged with: typesafe-activator
type: UnansweredQuestion
type: Question
tagged with: sbt
tagged with: java
score: 0
tagged with: playframework
has answer: http://stackoverflow.com/a/26747611

http://stackoverflow.com/q/26794275
tagged with: case-insensitive
downvote count: 0
has answer: http://stackoverflow.com/a/46085741
possible better answer: http://stackoverflow.com/a/38947571
tagged with: ends-with
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26794320
tagged with: string
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/19154117
has title: How do I ignore case when using startsWith and endsWith in Java?
score: 62
linked to: http://stackoverflow.com/q/15518731
duplicate of: http://stackoverflow.com/q/19154117
accepted answer: http://stackoverflow.com/a/26794320
tagged with: java
upvote count: 62
answer count: 3
has body: Here's my code: public static void rightSel(Scanner scanner,char t) { /*if (!stopping)*/System.out.print(": "); if (scanner.hasNextLine()) { String orInput = scanner.nextLine; if (orInput.equalsIgnoreCase("help") { System.out.println("The following commands are available:"); System.out.println(" 'help' : displays this menu"); System.out.println(" 'stop' : stops the program"); System.out.println(" 'topleft' : makes right triangle alligned left and to the top"); System.out.println(" 'topright' : makes right triangle alligned right and to the top"); System.out.println(" 'botright' : makes right triangle alligned right and to the bottom"); System.out.println(" 'botleft' : makes right triangle alligned left and to the bottom"); System.out.println("To continue, enter one of the above commands."); }//help menu else if (orInput.equalsIgnoreCase("stop") { System.out.println("Stopping the program..."); stopping = true; }//stop command else { String rawInput = orInput; String cutInput = rawInput.trim(); if ( I'd like to allow the user some leeway as to how they can enter the commands, things like: Top Right, top-right, TOPRIGHT, upper left, etc. To that end, I'm trying to, at that last if (, check if cutInput starts with either "top" or "up" AND check if cutInput ends with either "left" or "right", all while being case-insensitive. Is this at all possible? The end goal of this is to allow the user to, in one line of input, pick from one of four orientations of a triangle. This was the best way I could think of to do that, but I'm still quite new to programming in general and might be over complicating things. If I am, and it turns there's a simpler way, please let me know.
tagged with: startswith
has answer: http://stackoverflow.com/a/38947571

http://stackoverflow.com/comment/42060328
comment on: http://stackoverflow.com/q/26737150
type: Comment
type: QuestionComment
has text: Why is `myObject.getValue()` not possible ?
score: 0

http://stackoverflow.com/a/26824662
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26822266
answers question: http://stackoverflow.com/q/26822266
upvote count: 2
has body: take a look at the java reflection api java.lang.reflect.Method, etc. also learn what purpose interfaces and abstract classes serve. you will probably want to have your plugin api supply one or more interfaces with one or more abstract classes to serve as concrete base classes for implementations to extend. a good example in the actual jdk is the jdbc api. it is completely plugin driven (you ask the DriverManager to instantiate a driver for a given URI, and it handles marshalling the implementation, which is hidden behind interfaces and abstract classes). cheers
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26734378
tagged with: logging
tagged with: java
tagged with: formatter
type: Question
tagged with: properties-file
has title: Setting a custom user defined formatter in logger.properties file
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26767372
has body: I have been asked to format logger messages so that they display on a single line. The problem is that the logger has programatically defined handlers and I cannot change any of these. Is it possible to override the format of the log messages in the .properties file even though the syntax has been defined in the logger class within a logp method? I apologise for not being able to provide code. I have tried creating a custom formatter and pointing to this in the logger.properties file but the changes are not visible. Thanks, Daniel
type: UnansweredQuestion

http://stackoverflow.com/comment/58354325
type: AnswerComment
comment on: http://stackoverflow.com/a/30631659
has text: Yes, that is true, tho you can (and I think should) use **<meta-data android:name="AA_DB_VERSION" android:value="X" />** in manifest (as documentation suggests) and increment X when you want to recreate your AA database (default X = 1).
type: Comment
score: 1

http://stackoverflow.com/a/26711129
has body: @Raghu I think this question has been asked here. The simple answer is to convert the hex string to byte as shown in the link I provided. Then you can use bitwise AND operation to mask individual bit positions. For example, to isolate the second bit from the right, you can mask the byte with the number 2. Why? 1111 0110 (value) 0000 0010 (mask) --------- 0000 0010 (isolated bit) If the value obtain is the same as the mask, the bit position is asserted (high), else it is low. In Java, the bitwise AND and OR operators are '&amp;' and '|' respectively.
has comment: http://stackoverflow.com/comment/42013980
type: Answer
has comment: http://stackoverflow.com/comment/42018642
answers question: http://stackoverflow.com/q/26708181
has comment: http://stackoverflow.com/comment/42013747
score: 0

http://stackoverflow.com/comment/42072317
score: 0
type: Comment
type: QuestionComment
has text: @cecilg23 using name.hashCode() didn't help
comment on: http://stackoverflow.com/q/26742850

http://stackoverflow.com/q/26715904
accepted answer: http://stackoverflow.com/a/26716218
type: Question
has body: I try to run an Java Agent in XPage. The Agent runs in the beforePageLoad Event to manipulate the current document. &lt;xp:this.beforePageLoad&gt;&lt;![CDATA[#{javascript: var agent:NotesAgent =database.getAgent("RedirectGroups") agent.runWithDocumentContext(currentDocument.getDocument()) }]]&gt;&lt;/xp:this.beforePageLoad&gt; For testing the agent prints a simple message to the console. If I run the XPage in Browser I get an error 500 message. I'm using Notes 9.01 on an Domino 9 Server Will I have to run the agent in an other event of the XPage?
tagged with: xpages
answer count: 2
has title: Run Java Agent XPage
possible better answer: http://stackoverflow.com/a/26716184
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26716184
favorite count: 0
has answer: http://stackoverflow.com/a/26716218
type: AnsweredQuestion
tagged with: java
tagged with: agent
upvote count: 1

drag-and-drop
tags question: http://stackoverflow.com/q/26781289
tag name: drag-and-drop
tags question: http://stackoverflow.com/q/26733927
type: Tag

http://stackoverflow.com/comment/42022813
type: QuestionComment
has text: @janih I appreciate your response. I was able to somewhat determine what's the problem. At runtime, it throws exceptions of NoSuchMethodError whenn trying to access objects or classes from an external Jar which is in the library. It's throwing me exceptions like com.sun.javafx.css.StyleManager.getPseudoClassMask. I have no idea what to do...
type: Comment
comment on: http://stackoverflow.com/q/26679385
score: 0

http://stackoverflow.com/comment/68851814
score: 0
type: AnswerComment
type: Comment
has text: I am having same problem what is the data inputs you have done for User, Password info in table.
comment on: http://stackoverflow.com/a/26766462

http://stackoverflow.com/comment/42036794
type: QuestionComment
has text: It does not look like an Android related class. Android won't run a main method. Try removing that and creating a propper Android project. That'll do the trick.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26719773

http://stackoverflow.com/comment/42017883
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26713484
type: Comment
has text: Hi, the `https://www.sandbox.paypal.com/cgi-bin/webscr` redirects to the PayPal Sandbox site which is required. The reason I want to call another test-servlet is for it to set a boolean `isPaypalButtonClicked`. Is that possible?

http://stackoverflow.com/a/26810463
answers question: http://stackoverflow.com/q/26809906
type: Answer
score: 2
upvote count: 2
has body: This isn't really a question but I can offer a suggestion at least. I would start by trying to write your exception so that you understand what you should be doing. You can find this in the Oracle docs here: http://docs.oracle.com/javase/tutorial/essential/exceptions/creating.html If you know that you can't divide by 0, think about what kinds of expressions a user (or you) could input that would cause a BadArithmeticException.
downvote count: 0

recursion
type: Tag
tags question: http://stackoverflow.com/q/26682075
tags question: http://stackoverflow.com/q/26769969
tags question: http://stackoverflow.com/q/26783543
tags question: http://stackoverflow.com/q/26694816
tags question: http://stackoverflow.com/q/26791717
tags question: http://stackoverflow.com/q/26683168
tags question: http://stackoverflow.com/q/26793827
tags question: http://stackoverflow.com/q/26708463
tag name: recursion
tags question: http://stackoverflow.com/q/26767585
tags question: http://stackoverflow.com/q/26701310
tags question: http://stackoverflow.com/q/26684007
tags question: http://stackoverflow.com/q/26813030
tags question: http://stackoverflow.com/q/26702193
tags question: http://stackoverflow.com/q/26749231
tags question: http://stackoverflow.com/q/26785129
tags question: http://stackoverflow.com/q/26689929
tags question: http://stackoverflow.com/q/26749709
tags question: http://stackoverflow.com/q/26817849
tags question: http://stackoverflow.com/q/26770846
tags question: http://stackoverflow.com/q/26820462
tags question: http://stackoverflow.com/q/26794596
tags question: http://stackoverflow.com/q/26749516
tags question: http://stackoverflow.com/q/26675461
tags question: http://stackoverflow.com/q/26826299
tags question: http://stackoverflow.com/q/26681427
tags question: http://stackoverflow.com/q/26684809
tags question: http://stackoverflow.com/q/26704926
tags question: http://stackoverflow.com/q/26812215
tags question: http://stackoverflow.com/q/26742020
tags question: http://stackoverflow.com/q/26719994
tags question: http://stackoverflow.com/q/26826254
tags question: http://stackoverflow.com/q/26760888
tags question: http://stackoverflow.com/q/26776523

http://stackoverflow.com/q/26726259
has body: I am facing a problem with an app that is built to run as Android service and should start on boot without any user interaction or existing activity. From other sources, we know that this is basically not possible: http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html Currently for testing purposes the application has a very simple GUI and it registers a broadcast receiver as follows: public class MyAppReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { Intent serviceIntent = new Intent(context, MyAppService.class); context.startService(serviceIntent); } } } This works great if the user launches the app at least once in order to allow the receiver to get ACTION_BOOT_COMPLETED. The goal is to remove the GUI completely and yet have the application starting on boot without any action needed from the user. Note that this software will not be deployed on the Play Store but rather it's built to be part of a custom AOSP build not for public usage. The only solution I found is to build the application as system service by adding it to the Android application framework. See references: http://www.androidenea.com/2009/12/adding-system-server-to-android.html http://processors.wiki.ti.com/index.php/Android-Adding_SystemService However I am a bit confused about the advantages and disadvantages of this possibility and I hope someone can answer the following questions: 1) Does the app need to be built with the whole system (AOSP from source) and therefore it cannot be deployed as APK? 2) Is there any way to update the application afterwards (with an APK) once the system has been built? 3) Is it even possible or convenient to run the app this way (as system service) purely because it needs to start on boot and not because of other reasons (such as instantiating code from it etc.)? The app itself is nothing special - it's a client/remote-server …
has title: How to build an Android app as system service
type: Question
has answer: http://stackoverflow.com/a/26726668
has comment: http://stackoverflow.com/comment/42041536
tagged with: android-source
tagged with: android-service
answer count: 3
score: 3
has answer: http://stackoverflow.com/a/26726465
downvote count: 0
favorite count: 0
tagged with: android-framework
has answer: http://stackoverflow.com/a/57563385
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42052514
has comment: http://stackoverflow.com/comment/42042323
upvote count: 3
tagged with: java

http://stackoverflow.com/a/26748303
has body: The key thing you should observe when reading this method is that the iterations of the loop are data-flow independent; the effect of iteration i can be analyzed in isolation, without needing to know what happened at any other iterations. Thus there's really only one fact you need to be thinking about: resulti = i2 mod x. Then you can forget about the code and just do the math. Where x = 10: result0 = 02 mod 10 = 0 result1 = 12 mod 10 = 1 result2 = 22 mod 10 = 4 result3 = 32 mod 10 = 9 result4 = 42 mod 10 = 6
answers question: http://stackoverflow.com/q/26747405
type: Answer
score: 0

http://stackoverflow.com/q/26781990
tagged with: exception
has title: Buffer Underflow Exception java
answer count: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26782105
has body: I have a class-comparator, that compares my files with different algoritms. In this part I try to get a byte block from file to compare with another file's block. public class CompareFiles { private byte[] getBytesFromFile(File file) throws IOException { long BUFFER_SIZE = 4 * 1024; RandomAccessFile raf = new RandomAccessFile(file, "rw"); FileChannel fc = raf.getChannel(); MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, BUFFER_SIZE); byte[] bytes = new byte[(int) fc.size()]; buffer.get(bytes); buffer.clear(); return bytes; } } If I try to use one on big files I get Exception in thread "main" java.nio.BufferUnderflowException at java.nio.DirectByteBuffer.get(Unknown Source) at java.nio.ByteBuffer.get(Unknown Source) I guess, i make mistake in my minds and get compare blocks in wrong way.
downvote count: 0
tagged with: bytebuffer
type: AnsweredQuestion
tagged with: compare
tagged with: memory-mapped-files
accepted answer: http://stackoverflow.com/a/26782105
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/26673722
has comment: http://stackoverflow.com/comment/41949297
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41949378
upvote count: 1
tagged with: webview
has title: sms html link in android webview
has comment: http://stackoverflow.com/comment/41947922
tagged with: java
has body: I have created a WebView, and i can't figure out how I can handle href links like sms: or tel:, etc.. Μy code does not work: @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { boolean result; result = false; // for telephone if (url.startsWith("tel:")) { view.getContext().startActivity( new Intent(Intent.ACTION_CALL, Uri.parse(url))); result = true; } // for SMS or message. if (url.startsWith("sms:")) { view.getContext().startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse(url))); Intent.addCategory(Intent.CATEGORY_DEFAULT); Intent.addCategory(Intent.CATEGORY_BROWSABLE); result = true; } return result; }
type: Question
has comment: http://stackoverflow.com/comment/41949481
has answer: http://stackoverflow.com/a/26673795
answer count: 2
has answer: http://stackoverflow.com/a/26675761
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/26674246
has comment: http://stackoverflow.com/comment/41962367
has body: Yes, you can get the path from where the file is being executed. For example, you have the file : C:\Users\Name\Documents\Workspace\Project\Src\Com\Name\Foo.java After compiling, it will change to : C:\Users\Name\Documents\Workspace\Project\Src\Com\Name\Foo.class You can use this to get the directory of the file: System.getProperty("user.dir"); and then you can add this String to it: String cPath = System.getProperty("user.dir")+"\\Foo.class"; Thus, cPath would be the complete path to the file.
type: Answer
answers question: http://stackoverflow.com/q/26674037
score: 0

http://stackoverflow.com/comment/77613351
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26678738
has text: Your resteasy-jackson2-provider link points to resteasy-jackson-provider

http://stackoverflow.com/q/26701420
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42007379
has answer: http://stackoverflow.com/a/27767266
tagged with: gmail-api
type: Question
has title: gmail java api sending with attachment takes ages
has body: Google seems to send devs here for help with the gmail api, so please excuse my first post. I am connecting and sending an email using the java gmail api with an attachment. The problem I am having is it seems to take up to 10 minutes to actually execute the ....send("me", message).execute() method. I have tried enabling gzip compression by setting the necessary header values which seems to have helped, but it is still unacceptably slow for what is basically just a small file upload which should complete in a few seconds. So, my questions to the experts here are: 1) Is anyone else experiencing this slow performance with attachments? 2) Is there a better way to do this perhaps using the upload features? Any help greatly appreciated. Matt
has comment: http://stackoverflow.com/comment/41997174
tagged with: gmail
score: 0
tagged with: java

http://stackoverflow.com/q/26707480
has body: I have downloaded an android application from http://mobiforge.com/design-development/sms-messaging-android which sends and receives SMS. Once I run the app in Eclipse, I got this error of "Public final class R is already defined". I have searched for the solution and I found one of the way is to remove R.java in the source file before importing it to Eclipse. The problem has been solved but now whenever I run the app in my android phone, it crashes. As far as I know, there is no bug in the app. Could someone help me on this? Link for the source code: https://docs.google.com/file/d/0B8hGK166N4U2RTBjV0Q4akIwVG8/edit Log: W/InputEventReceiver(30305): Attempted to finish an input event but the input event receiver has already been disposed. E/ViewRootImpl(30305): sendUserActionEvent() mView == null
has title: Public final class R is already defined
score: 0
has comment: http://stackoverflow.com/comment/42007610
tagged with: sms
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42007521
tagged with: android
has comment: http://stackoverflow.com/comment/42008110
has answer: http://stackoverflow.com/a/26707560
has comment: http://stackoverflow.com/comment/42007769
has answer: http://stackoverflow.com/a/26726852
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/42076585
has text: ..... I just want to retreive the password I set on the keystore when I created it two years ago. What kind of harm do you think I'm going to cause?
comment on: http://stackoverflow.com/q/26745387
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42207589
has text: @JordiCastilla If this does not work, then there must be an *addtional* unrelated problem within your code. Check what is beeing return when you call registerVisitBean.paid (e.g. by putting some System.out in the getter method) ... probably your bean class is defective as well. You should provide the code of the bean (including the used import statements etc)
type: AnswerComment
comment on: http://stackoverflow.com/a/26818291
type: Comment
score: 1

http://stackoverflow.com/a/26796683
answers question: http://stackoverflow.com/q/26796662
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42167579
score: 2
has comment: http://stackoverflow.com/comment/42167665
has body: use .equals instead ==. you can't use == for this case as String is a object type.it only works for primitives like int,char....you are checking reference quality that's why it's not work. for more information see this How do I compare strings in Java? int selectedRow = tblJournalBatchList.getSelectedRow(); if ((String)tblJournalBatchList.getValueAt(selectedRow, 3).equals("NO")) { btnPost.setEnabled(false); }
has comment: http://stackoverflow.com/comment/42167419
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26796662

http://stackoverflow.com/a/26689001
type: Answer
answers question: http://stackoverflow.com/q/26688990
upvote count: 23
score: 23
has body: This is the correct way to write that: if ( fieldNames.charAt(4) == 'f' ) In your original version, "f" is a String and fieldNames.charAt(4) is a char, and you cannot compare a String with a char using ==. If you write 'f' instead of "f" (as above) you will be comparing a char with a char. Note that "g" == "h" is also accepted by the compiler because both "g" and "h" are String objects. However, you shouldn't do that. You should use "g".equals("h") instead. To understand why, please read How do I compare strings in Java?. (The short version is that someString == otherString comparisons will often give an unexpected answer!) By contrast 'g' == 'h' is both accepted by the compiler AND correct code. More background: a Java String literal is surrounded by double quotes, but a char literal is surrounded by single quotes; e.g. String s = "g"; char c = 'g'; A char value consists of one and only one character1 but String value can contain more than one character ... or zero characters. String s2 = "gg"; valid char c2 = 'gg'; not valid String s3 = ""; valid char c3 = ''; not valid 1 - Actually, calling them characters is technically a stretch. A char ... or a value returned by String.getChar is actually an unsigned 16 bit number. But Java natively uses Unicode, and 16 bits is not enough to represent all Unicode code points. It was when Java was designed, but then Unicode added more code planes.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26688990

http://stackoverflow.com/q/26690527
possible better answer: http://stackoverflow.com/a/26690632
has body: I am currently writing an application in Java, and am struggling to extract the values from a String which is in a JSON format. Could someone help me with the easiest, most simplest way to extract data from this string? I'd prefer not to use external library if at all possible. {"exchange":{"status":"Enabled","message":"Broadband on Fibre Technology","exchange_code":"NIWBY","exchange_name":"WHITEABBEY"},"products":[{"name":"20CN ADSL Max","likely_down_speed":1.5,"likely_up_speed":0.15,"availability":true.... Could someone explain how I could return the "likely down speed" of "20CN ADSL Max for example? Thanks
has comment: http://stackoverflow.com/comment/41977749
type: Question
has answer: http://stackoverflow.com/a/26690658
linked to: http://stackoverflow.com/q/2591098
accepted answer: http://stackoverflow.com/a/26690658
score: 0
has comment: http://stackoverflow.com/comment/41978352
answer count: 3
has answer: http://stackoverflow.com/a/26690672
has answer: http://stackoverflow.com/a/26690632
has title: Need a real simple way to read json value in java
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/42236327
comment on: http://stackoverflow.com/q/26825502
score: 0
type: Comment
has text: Thank you for you guys help, I will have a individual some test project to test this issue again the what is the different. worst case is, I have to redo this part from scratch.
type: QuestionComment

email
tags question: http://stackoverflow.com/q/26747053
tags question: http://stackoverflow.com/q/26777308
tags question: http://stackoverflow.com/q/26730475
tags question: http://stackoverflow.com/q/26760363
tags question: http://stackoverflow.com/q/26768208
tags question: http://stackoverflow.com/q/26714735
tags question: http://stackoverflow.com/q/26734351
tags question: http://stackoverflow.com/q/26796573
type: Tag
tag name: email
tags question: http://stackoverflow.com/q/26817570

http://stackoverflow.com/q/26766079
has answer: http://stackoverflow.com/a/26766180
accepted answer: http://stackoverflow.com/a/26766180
has comment: http://stackoverflow.com/comment/42113693
score: 0
has body: Hey guys I have a java file not java script my line.tostring() is something like this area = 1.446097987730157 m2 and i would need to get only the 1.44 value String inputLine = line.toString(); String regex = "\\d+(\\.\\d{1,2})?"; String replace = ""; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(inputLine); inputLine = m.replaceAll(replace); dataArray[0] = inputLine; This is what i get obviously area = m And I need to get only 1.44 Thank you and best regards
tagged with: regex
has comment: http://stackoverflow.com/comment/42113099
possible better answer: http://stackoverflow.com/a/26766396
has comment: http://stackoverflow.com/comment/42113137
has comment: http://stackoverflow.com/comment/42113974
has comment: http://stackoverflow.com/comment/42114237
has comment: http://stackoverflow.com/comment/42114143
type: AnsweredQuestion
has title: Java Regex How to get 2 decimal valu out of alphanumeric string
tagged with: java
has answer: http://stackoverflow.com/a/26766396
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42113046

http://stackoverflow.com/q/26772311
type: UnansweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26772508
has comment: http://stackoverflow.com/comment/42124514
upvote count: 2
has body: I am reading Java LinkedBlockingQueue source code, and I have two questions about the put operation. public void put(E e) throws InterruptedException { if (e == null) throw new NullPointerException(); // Note: convention in all put/take/etc is to preset local var // holding count negative to indicate failure unless set. int c = -1; Node&lt;E&gt; node = new Node&lt;E&gt;(e); final ReentrantLock putLock = this.putLock; final AtomicInteger count = this.count; putLock.lockInterruptibly(); try { /* * Note that count is used in wait guard even though it is * not protected by lock. This works because count can * only decrease at this point (all other puts are shut * out by lock), and we (or some other waiting put) are * signalled if it ever changes from capacity. Similarly * for all other uses of count in other wait guards. */ while (count.get() == capacity) { notFull.await(); } enqueue(node); c = count.getAndIncrement(); if (c + 1 &lt; capacity) notFull.signal(); } finally { putLock.unlock(); } if (c == 0) signalNotEmpty(); } I don't understand: It checks c + 1 &lt; capacity, when it emits notFull.signal(). Why not use c &lt; capacity? Why it emits signalNotEmpty when c == 0 at the end of function? Besides, I also don't understand why head/tail need to be transient?
answer count: 1
tagged with: blockingqueue
tagged with: java
has title: Java LinkedBlockingQueue source code confusion
has comment: http://stackoverflow.com/comment/42124808
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42124736

receipt
type: Tag
tags question: http://stackoverflow.com/q/26803877
tag name: receipt

http://stackoverflow.com/q/26751633
has comment: http://stackoverflow.com/comment/42087011
tagged with: mysql
has title: Is it possible to create standalone JavaFx application that uses Spring Jdbc and Mysql
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/5117248
has comment: http://stackoverflow.com/comment/42086978
has comment: http://stackoverflow.com/comment/42087186
score: 0
has body: As i am new to JavaFx and of course spring jdbc, i am in blocker state. My application is almost ready and i have even created installation file for windows using inno setup. This installation file works fine on my system but when i run on another system it does not run; probably due to missing database and its server. So, i need a standalone application that manages all the database and other requirements itself through installer. After research i found many people suggesting to use Sqlite or hsqldb. Do i really have to use these database, can't i create standalone application that uses existing technology i.e. spring jdbc and mysql. Thank you.
linked to: http://stackoverflow.com/q/22315672
has answer: http://stackoverflow.com/a/26751662
type: UnansweredQuestion
tagged with: spring
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/26783388
has comment: http://stackoverflow.com/comment/42144998
has comment: http://stackoverflow.com/comment/42158871
has comment: http://stackoverflow.com/comment/42158843
answers question: http://stackoverflow.com/q/26783215
score: 0
has comment: http://stackoverflow.com/comment/42146604
has comment: http://stackoverflow.com/comment/42177941
has body: If you want to know how to run jetty from maven, you leverage the plugin org.mortbay.jetty jetty-maven-plugin ${jetty.version} 8080 3600000 8443 3600000 ${project.build.directory}/test-classes/keystore wicket wicket In your pom file.
has comment: http://stackoverflow.com/comment/42176381
has comment: http://stackoverflow.com/comment/42144138
type: Answer
has comment: http://stackoverflow.com/comment/42145906
has comment: http://stackoverflow.com/comment/42145830

http://stackoverflow.com/a/26686574
has body: HashMap does not need keys to be Comparable but still implements Map interface. Only TreeMap has this requirement. Moreover TreeMap can be used with non Comparable keys too, provided a comparator at creation time
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26686466
downvote count: 0
has comment: http://stackoverflow.com/comment/41972681
answers question: http://stackoverflow.com/q/26686466

jsp
tags question: http://stackoverflow.com/q/26721936
tags question: http://stackoverflow.com/q/26823203
tags question: http://stackoverflow.com/q/26684025
tags question: http://stackoverflow.com/q/26825502
tags question: http://stackoverflow.com/q/26793117
tags question: http://stackoverflow.com/q/26725286
tags question: http://stackoverflow.com/q/26770383
tags question: http://stackoverflow.com/q/26817059
tags question: http://stackoverflow.com/q/26708782
tags question: http://stackoverflow.com/q/26710151
tags question: http://stackoverflow.com/q/26798858
tags question: http://stackoverflow.com/q/26712370
tags question: http://stackoverflow.com/q/26721370
tags question: http://stackoverflow.com/q/26750488
tags question: http://stackoverflow.com/q/26682945
tags question: http://stackoverflow.com/q/26745644
tags question: http://stackoverflow.com/q/26804526
tags question: http://stackoverflow.com/q/26730663
tags question: http://stackoverflow.com/q/26745379
tags question: http://stackoverflow.com/q/26688915
tags question: http://stackoverflow.com/q/26791888
tags question: http://stackoverflow.com/q/26773975
tags question: http://stackoverflow.com/q/26729554
tags question: http://stackoverflow.com/q/26795429
tags question: http://stackoverflow.com/q/26796352
tags question: http://stackoverflow.com/q/26770516
tags question: http://stackoverflow.com/q/26721881
tags question: http://stackoverflow.com/q/26740414
tags question: http://stackoverflow.com/q/26731055
tags question: http://stackoverflow.com/q/26715548
tags question: http://stackoverflow.com/q/26716327
tags question: http://stackoverflow.com/q/26692286
tags question: http://stackoverflow.com/q/26713270
tags question: http://stackoverflow.com/q/26805904
tags question: http://stackoverflow.com/q/26747831
tags question: http://stackoverflow.com/q/26721810
tags question: http://stackoverflow.com/q/26822127
tags question: http://stackoverflow.com/q/26787382
type: Tag
tags question: http://stackoverflow.com/q/26767407
tags question: http://stackoverflow.com/q/26821764
tags question: http://stackoverflow.com/q/26751307
tags question: http://stackoverflow.com/q/26816680
tags question: http://stackoverflow.com/q/26700491
tags question: http://stackoverflow.com/q/26729208
tags question: http://stackoverflow.com/q/26737628
tags question: http://stackoverflow.com/q/26710053
tags question: http://stackoverflow.com/q/26758244
tags question: http://stackoverflow.com/q/26829459
tag name: jsp
tags question: http://stackoverflow.com/q/26689901
tags question: http://stackoverflow.com/q/26709325
tags question: http://stackoverflow.com/q/26771485
tags question: http://stackoverflow.com/q/26806120
tags question: http://stackoverflow.com/q/26673072
tags question: http://stackoverflow.com/q/26789165
tags question: http://stackoverflow.com/q/26727527
tags question: http://stackoverflow.com/q/26717153
tags question: http://stackoverflow.com/q/26796457
tags question: http://stackoverflow.com/q/26752362
tags question: http://stackoverflow.com/q/26692370
tags question: http://stackoverflow.com/q/26760369
tags question: http://stackoverflow.com/q/26818006
tags question: http://stackoverflow.com/q/26718042
tags question: http://stackoverflow.com/q/26750994
tags question: http://stackoverflow.com/q/26739660
tags question: http://stackoverflow.com/q/26752434
tags question: http://stackoverflow.com/q/26801038
tags question: http://stackoverflow.com/q/26802337
tags question: http://stackoverflow.com/q/26752213
tags question: http://stackoverflow.com/q/26793671
tags question: http://stackoverflow.com/q/26692480
tags question: http://stackoverflow.com/q/26820700
tags question: http://stackoverflow.com/q/26735147
tags question: http://stackoverflow.com/q/26798485
tags question: http://stackoverflow.com/q/26719177
tags question: http://stackoverflow.com/q/26694107
tags question: http://stackoverflow.com/q/26716458
tags question: http://stackoverflow.com/q/26768035
tags question: http://stackoverflow.com/q/26698454

http://stackoverflow.com/comment/70596072
comment on: http://stackoverflow.com/a/34934921
score: 0
type: Comment
has text: Hope that helps someone, it was usefull for me that time
type: AnswerComment

http://stackoverflow.com/q/26758099
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42098333
has comment: http://stackoverflow.com/comment/42100919
type: Question
accepted answer: http://stackoverflow.com/a/26784636
has comment: http://stackoverflow.com/comment/42102366
has body: I'm working on setting up an automated processing system for a (ever growing) unstructured collection of excel documents. The collection consists of both old-school .xls files and new .xlsx files. In my Java-based solution I am already making use of the Apache POI toolkit to analyse the documents. One challenges that I have not been able to tackle yet, is how to identify links between documents so as to chart dependencies. I have not yet been able to figure out how to conveniently extract a list of external references. For .xlsx files I have a workaround in place that unzips the file, and opens the xml file holding the references. This works but is inefficient for large document collections, and also does not provide a solution for .xls files. I prefer to have a solution that is not dependent on Microsoft Office or associated libraries as the solution needs to run on a Linux environment. Is POI capable of doing this somehow? If not, what would be suggested libraries/tools/area's that I could further investigate?
has title: How to extract a list of external references from a excel file
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42130560
favorite count: 0
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/42118462
upvote count: 2
has answer: http://stackoverflow.com/a/26784636
tagged with: excel
has comment: http://stackoverflow.com/comment/42131001

http://stackoverflow.com/q/26775923
has comment: http://stackoverflow.com/comment/42130731
downvote count: 0
has comment: http://stackoverflow.com/comment/42130569
has comment: http://stackoverflow.com/comment/42132686
score: 10
has body: When I tried to run this program couple of times the final value of i is 11407, 11417, 11400 etc. before displaying stack overflow error. Why is the final value of i not same every time this program is executed? public class MainRecursive { static int i=0; public static void main (String arg[]) { i++; System.out.println(i); main(arg); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/42130640
type: Question
has comment: http://stackoverflow.com/comment/42130859
has comment: http://stackoverflow.com/comment/42130504
has title: Why is main method not getting called same no. of times recursively in java every time it is executed?
answer count: 1
has answer: http://stackoverflow.com/a/26776330
tagged with: java
has comment: http://stackoverflow.com/comment/42130606
upvote count: 10
has comment: http://stackoverflow.com/comment/42132337
has comment: http://stackoverflow.com/comment/42130680
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42132065

http://stackoverflow.com/comment/42001917
type: Comment
has text: Thanks a lot for your support.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26702049

http://stackoverflow.com/q/26830745
upvote count: 1
possible better answer: http://stackoverflow.com/a/47178736
type: Question
has answer: http://stackoverflow.com/a/47178736
has answer: http://stackoverflow.com/a/26830763
has comment: http://stackoverflow.com/comment/42228267
tagged with: eclipse
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26830763
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26830781
score: 1
tagged with: java
has body: Firstly, I know that similar questions have been asked and answered before, however none of the solutions worked in my case. For some reason, eclipse keeps showing a launch error saying that no main method is found despite there being a public static void main(String[] args) in my main class. Could there be an issue in the class path? I'm really unsure whats causing it.
has answer: http://stackoverflow.com/a/65666394
has title: Eclipse not finding a main method

http://stackoverflow.com/comment/42175195
type: Comment
has text: Btw, you split line is doing nothing. `String#split` returns a `String[]` and you're not using it.
comment on: http://stackoverflow.com/q/26798896
score: 0
type: QuestionComment

http://stackoverflow.com/comment/105666433
comment on: http://stackoverflow.com/q/26673670
score: 0
type: QuestionComment
has text: which SQL Server driver are you using?
type: Comment

http://stackoverflow.com/a/26675739
answers question: http://stackoverflow.com/q/26675629
upvote count: 1
score: 1
downvote count: 0
has body: The problem of your logcat is here: public class Reservation extends Activity implements OnClickListener You are implementing OnClickListener and then you are implementing an anonymous onClickListener in your btnMenues. Remove your implements OnClickListener and the error will go away.
type: Answer

http://stackoverflow.com/q/26768035
upvote count: 1
type: Question
tagged with: ognl
tagged with: displaytag
tagged with: struts2
has answer: http://stackoverflow.com/a/26777025
accepted answer: http://stackoverflow.com/a/26777025
answer count: 1
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/42129764
favorite count: 0
has body: Is there a chance to get the size of a property which is a list? &lt;display:column property="reminderSend" title="Anzahl der Mahnungen" sortable="true" /&gt; reminderSet is a list. I want to display the size of it and not the values.
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is there a chance to get the size of a list property in Struts 2?

http://stackoverflow.com/q/26740415
type: UnansweredQuestion
tagged with: fxml
answer count: 0
tagged with: java
tagged with: javafx
has body: After trying many different ways, I have not been able to get this TableView to display any strings. Originally, the data was supposed to come from a ResultSet object but, I could not get that work. My latest attempt (below) seems like the most straightforward way to display data but, the strings still will not show. As you can see, the TableView and ListView are described in an FXML document. The ListView shows it's strings without any problems. Am I missing something? public class AudioPlayerFXMLController implements Initializable { @FXML private ListView playList; @FXML private TableView playListTableView; @FXML private TableColumn pathColumn, artistColumn, titleColumn, albumColumn, trackNumberColumn, lengthColumn, descriptionColumn, ratingColumn, dateColumn, settingColumn, URLColumn, languageColumn, nowPlayingColumn, publishedByColumn, encodedByColumn, artworkURLColumn, trackIDColumn; private static final String NEW_PLAYLIST = "New Playlist"; private static final String FRIEND_PLAYLIST = "Friend's Playlist"; private static final String LIBRARY = "Library"; private static ButtonCell bc; ObservableList&lt;String&gt; observablePlayList; ObservableList&lt;String&gt; observableListForTableView; @Override public void initialize(URL url, ResourceBundle rb) { observablePlayList = FXCollections.observableArrayList(); observablePlayList.add(NEW_PLAYLIST); observablePlayList.add(FRIEND_PLAYLIST); observablePlayList.add(LIBRARY); observableListForTableView = FXCollections.observableArrayList(); observableListForTableView.add(NEW_PLAYLIST); observableListForTableView.add(FRIEND_PLAYLIST); observableListForTableView.add(LIBRARY); List&lt;String&gt; values = Arrays.asList("one", "two", "three", "three", "three", "three", "three", "three", "three", "three", "three", "three", "three", "" + "three", "three", "three", "three"); System.out.println(FXCollections.observableArrayList(values)); playListTableView.setItems(FXCollections.observableArrayList(values)); playList.setItems(obs…
type: Question
has comment: http://stackoverflow.com/comment/42071643
has comment: http://stackoverflow.com/comment/42069839
has comment: http://stackoverflow.com/comment/42071569
has comment: http://stackoverflow.com/comment/42067553
score: 0
has comment: http://stackoverflow.com/comment/42072366
has comment: http://stackoverflow.com/comment/42068876
tagged with: javafx-8
has title: JavaFX - how can I get a TableView to show the strings in an array?
has comment: http://stackoverflow.com/comment/42071525

http://stackoverflow.com/comment/42146656
type: AnswerComment
comment on: http://stackoverflow.com/a/26784477
type: Comment
has text: @NeilPlain but did you execute the command from the parent directory of 'ok'? (as i wrote on my last edit). On my filesystem I have 'C:\prova\ok\MyApp.class' and I executed the command from 'C:\prova\
score: 1

http://stackoverflow.com/a/26713016
answers question: http://stackoverflow.com/q/26676331
has comment: http://stackoverflow.com/comment/42206932
type: Answer
has comment: http://stackoverflow.com/comment/42210370
has body: You can try this, forcing the appender to write each line whenever it's logged by the application : rollingFileAppender.setImmediateFlush(true); rollingFileAppender.setBufferedIO(false); The weird thing is that these values are the default one, but you can try it anyway.
score: 0

http://stackoverflow.com/comment/41966513
has text: What API are you using to show the dialogs? JDK8_40? ControlsFX? Custom scene? Are there any more controls besides the list on that dialog?
comment on: http://stackoverflow.com/q/26682013
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26717315
type: Answer
has body: Try replacing the following line (note the removal of the blanks after ? and the opening bracket at the end (): String YahooURL = "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quote where symbol in ("; After pasting the correct link into my browser I get a response and the same should apply for your snippet.
accepted answer of: http://stackoverflow.com/q/26717176
has comment: http://stackoverflow.com/comment/42035317
has comment: http://stackoverflow.com/comment/42034937
score: 0
answers question: http://stackoverflow.com/q/26717176
type: AcceptedAnswer

http://stackoverflow.com/q/26686637
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/26686685
has body: I'm writing an app with a method that will be accessing data online. However, we are maximally allowed to query the website at most once every 15 minutes. If the 15 minutes has not elapsed, I want to use the data from the most recent query. What are the best practices for checking the last time a method was called?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26686685
tagged with: android
has title: Android - only calling a method every 15 minutes max, and using saved data otherwise
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26683751
has comment: http://stackoverflow.com/comment/41968439
has comment: http://stackoverflow.com/comment/41985470
upvote count: 1
has comment: http://stackoverflow.com/comment/41966783
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/41966171
has comment: http://stackoverflow.com/comment/41966174
has title: Remaining time from current time to 18:30
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4566132
has comment: http://stackoverflow.com/comment/41966098
has comment: http://stackoverflow.com/comment/41966064
has comment: http://stackoverflow.com/comment/41966221
has comment: http://stackoverflow.com/comment/41966076
has comment: http://stackoverflow.com/comment/41966014
has answer: http://stackoverflow.com/a/26686801
favorite count: 0
has comment: http://stackoverflow.com/comment/41966030
has comment: http://stackoverflow.com/comment/42057183
type: Question
has comment: http://stackoverflow.com/comment/41968428
tagged with: time
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/26683781
has body: i want learn remaining time from current time to 18.30 My code is not working: long currentTime = System.currentTimeMillis(); long endTime = 18:30; long remaining = endTime - currentTime; long hours = remaining / 3600000; long mins = remaining / 60000 % 60; long seconds = remaining / 1000 % 60; String remainingText = String.format("%02d:%02d:%02d", hours,mins,seconds);
has comment: http://stackoverflow.com/comment/41966120
has comment: http://stackoverflow.com/comment/41966347
score: 0
tagged with: java

http://stackoverflow.com/q/26729048
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42070961
answer count: 1
tagged with: apache-servicemix
has body: I am trying to create a bundle using camel-kafka, and run it inside servicemix. The module is a very basic kafka consumer which uses camel-kafka connector, and consumes messages from a kafka topic. I am able to successfully run the module using mvn camel:run, however installing the same module inside service mix as a osgi bundle gives following error: 014-11-03 21:07:25,929 | ERROR | rint Extender: 1 | BlueprintContainerImpl | ? ? | 17 - org.apache.aries.blueprint.core - 1.4.1 | Unable to start blueprint container for bundle kafka-test due to unresolved dependencies [(&amp;(component=kafka)(objectClass=org.apache.camel.spi.ComponentResolver))] java.util.concurrent.TimeoutException at org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:336)[17:org.apache.aries.blueprint.core:1.4.1] at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[17:org.apache.aries.blueprint.core:1.4.1] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_67] at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_67] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_67] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_67] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_67] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_67] UPDATE The above warning got resolved after installing camel-kafka feature in the servicemix. (Thanks to Achim) However, then i started getting the following error: EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError: org/I0Itec/zkclient/serialize/ZkSerializer) java.lang.NoClassDefFoundError: org/I0Itec/zkclient/serialize/ZkSerializer at kafka.javaapi.consumer.ZookeeperConsumerConnector.&lt;init…
favorite count: 0
has title: Running Kafka consumer inside Apache ServiceMix
type: UnansweredQuestion
downvote count: 2
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/26768183
type: Question
tagged with: apache-kafka

http://stackoverflow.com/a/26714291
downvote count: 0
has body: why the resource files need to be cnverted to Java source files They are not being "cnverted to Java source files". A Java source file -- R.java -- is built using the data from the resources, and that file represents a listing of all of the available resources. This file provides constants for Android app developers to use to refer to these resources from the rest of their Java code. To draw an analogy, the Web is not "cnverted" to Google's search engine; Google's search engine represents an index of the Web. Similarly, resources are not "cnverted to Java source files" like R.java; R.java represents an index of the resources.
score: 1
has comment: http://stackoverflow.com/comment/42019716
answers question: http://stackoverflow.com/q/26714157
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26714157
has comment: http://stackoverflow.com/comment/42019516
type: Answer

http://stackoverflow.com/a/26766249
has body: OK, the mystery is resolved. I looked though the project and found in the pom.xml in its root, the old url http://xyz.repo.site is inside the tag pluginRepository, I didn't notice it thus it's never updated. I supposed this one takes over if no explicit repo is set in the settings.xml. My bad.
type: Answer
answers question: http://stackoverflow.com/q/26762861
score: 0

http://stackoverflow.com/a/26809233
answers question: http://stackoverflow.com/q/26808987
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42191404
has comment: http://stackoverflow.com/comment/42191649
has body: you can have both (Book.java on client package and on server package). But why did you do that? They do the same work, so no need to have two classes. Remove one class and use the other one on both sides. That would also resolve your issue. And move the class into a neutral package because it is used on both sides server an client. Hope it helps.
downvote count: 0

http://stackoverflow.com/q/26725278
linked to: http://stackoverflow.com/q/12046786
answer count: 3
score: 14
has comment: http://stackoverflow.com/comment/42098954
has answer: http://stackoverflow.com/a/26827582
has comment: http://stackoverflow.com/comment/42095425
has body: The input stream I am parsing with Jackson contains latitude and longitude values such as here: { "name": "product 23", "latitude": "52,48264", "longitude": "13,31822" } For some reason the server uses commas as the decimal separator which produces an InvalidFormatException. Since I cannot change the server output format I would like to teach Jackson's ObjectMapper to handle those cases. Here is the relevant code: public static Object getProducts(final String inputStream) { ObjectMapper objectMapper = new ObjectMapper(); try { return objectMapper.readValue(inputStream, new TypeReference&lt;Product&gt;() {} ); } catch (UnrecognizedPropertyException e) { e.printStackTrace(); } catch (InvalidFormatException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (JsonParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } And here is the POJO: import com.fasterxml.jackson.annotation.JsonProperty; public class Product { @JsonProperty("name") public String name; @JsonProperty("latitude") public float latitude; @JsonProperty("longitude") public float longitude; } How can I tell Jackson that those coordinate values come with a German locale? I suppose a custom deserializer for the specific fields as discussed here would be the way to go. I drafted this: public class GermanFloatDeserializer extends JsonDeserializer&lt;Float&gt; { @Override public Float deserialize(JsonParser parser, DeserializationContext context) throws IOException { // TODO Do some comma magic return floatValue; } } Then the POJO would look like this: import com.fasterxml.jackson.annotation.JsonProperty; public class Product { @JsonProperty("name") public String name; @JsonDeserialize(using = GermanFloatDeserializer.class, as = Float.class) @JsonProperty("latitude") public float latitude; @JsonDeserialize(using = GermanFloatDeserializer.class, as = Float.class) @JsonProperty("longitude") public float longitude; }
favorite count: 0
has comment: http://stackoverflow.com/comment/42080265
tagged with: formatexception
tagged with: decimalformat
tagged with: json-deserialization
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26827582
has title: How to deserialize a float value with a localized decimal separator with Jackson
has comment: http://stackoverflow.com/comment/42105391
has comment: http://stackoverflow.com/comment/42090621
tagged with: java
downvote count: 1
type: Question
upvote count: 15
possible better answer: http://stackoverflow.com/a/30482806
has answer: http://stackoverflow.com/a/39704352
has answer: http://stackoverflow.com/a/30482806
tagged with: jackson

http://stackoverflow.com/comment/42166797
score: 0
has text: Can we assume there is only one occurrence of each of the swappable words in the input?
comment on: http://stackoverflow.com/q/26791441
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26831893
score: 21
has comment: http://stackoverflow.com/comment/42232232
has answer: http://stackoverflow.com/a/62720545
has comment: http://stackoverflow.com/comment/42230857
favorite count: 0
has answer: http://stackoverflow.com/a/26832286
possible better answer: http://stackoverflow.com/a/28223822
has body: I have an easy problem at the first glance: entityManager() .createNativeQuery("select count(*) as total, select sum(field) as total_sum ... blabla") And I want to write select result into POJO, like this: public class AggregateStatsDto { private int total; private long totalSum; // getters, setters, cosntructors } What the best way to achieve this? I can use JPA 2.1 and tried to use @SqlResultSetMapping in conjuction with @ConstructorResult: @SqlResultSetMapping(name = "AggregateStatsResult", classes = { @ConstructorResult(targetClass = AggregateStatsDto.class, columns = { @ColumnResult(name = "total"), @ColumnResult(name = "totalSum") }) }) public class AggregateStatsDto { private long total; private int totalSum; // getters, setters, cosntructors } Query: AggregateStatsDto result = (AggregateStatsDto) entityManager() .createNativeQuery("select count(*) as total, select sum(field) as total_sum ... blabla", "AggregateStatsResult") .getSingleResult(); But no luck. It seems that it wants @Entity anyway. But I want just a POJO. org.hibernate.MappingException: Unknown SqlResultSetMapping [AggregateStatsResult]" Thanks in advance!
has answer: http://stackoverflow.com/a/53906781
accepted answer: http://stackoverflow.com/a/28262220
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3937131
has title: createNativeQuery mapping to POJO (non-entity)
tagged with: java
tagged with: hibernate
upvote count: 21
has comment: http://stackoverflow.com/comment/42234746
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/67992969
answer count: 6
has answer: http://stackoverflow.com/a/28262220
tagged with: sql
has answer: http://stackoverflow.com/a/28223822
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/41984784
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26694772
type: QuestionComment
has text: As you say, it would be too big to make sense of. What I would do is run it, and step through various parts of it. Having done this in the past, there's no silver bullet. It has taken me months to get to the point where I understood something well enough to dare to try fixing it.

http://stackoverflow.com/comment/42067265
has text: You can use `setToRotation(Vector3 direction, Vector3 face)`, where the direction is the `direction` you want to look and `face` is the face, which should look in this `direction`.
comment on: http://stackoverflow.com/q/26733103
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26751971
answers question: http://stackoverflow.com/q/26751930
has comment: http://stackoverflow.com/comment/42087865
type: Answer
has comment: http://stackoverflow.com/comment/42089426
has comment: http://stackoverflow.com/comment/42089243
has comment: http://stackoverflow.com/comment/42087751
has comment: http://stackoverflow.com/comment/42089278
score: 4
has comment: http://stackoverflow.com/comment/42087462
has comment: http://stackoverflow.com/comment/42088308
has body: Move the FileWriter open and close outside the loop, FileWriter fw = new FileWriter(filename,true); // &lt;-- here! while(data.hasNextLine()){ String line = data.nextLine(); String[] split = line.split("\t"); String filename = "D:\\P&amp;G\\March Sample Data\\" + split[0] + " " + split[1]+ ".txt"; //System.out.println((filename)); //System.out.println(line); // FileWriter fw = new FileWriter(filename,true); Otherwise it has to open the file and seek to the end for every line of input! Edit I noticed you don't have the filename until in your loop. Let's use a Map to keep a cache. FileWriter fw = null; Map&lt;String, FileWriter&gt; map = new HashMap&lt;&gt;(); while (data.hasNextLine()) { String line = data.nextLine(); String[] split = line.split("\t"); String filename = "D:\\P&amp;G\\March Sample Data\\" + split[0] + " " + split[1] + ".txt"; // System.out.println((filename)); // System.out.println(line); if (map.containsKey(filename)) { fw = map.get(filename); } else { fw = new FileWriter(filename, true); map.put(filename, fw); } // ... } for (FileWriter file : map.values()) { file.close(); }
upvote count: 4
has comment: http://stackoverflow.com/comment/42087676
accepted answer of: http://stackoverflow.com/q/26751930
has comment: http://stackoverflow.com/comment/42087438
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26708740
has body: It seems like you could pass info to your Adjust Constructor. That should break the cycle. Basically, something like public class Gui extends JFrame{ public Gui(){ Adjust adjust = new Adjust(this.getInformation()); ... // There are some codes int length = adjust.getLength(); } public static void main(String[] args){ Gui input = new Gui(); input.setVisible(true); input.pack(); } } Then public Adjust(int info) { // Gui gui = new Gui(); // this.info = gui.getInformation(); this.info = info;
has comment: http://stackoverflow.com/comment/42021004
has comment: http://stackoverflow.com/comment/42022552
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26707124
has comment: http://stackoverflow.com/comment/42020945

actionevent
tags question: http://stackoverflow.com/q/26720123
tag name: actionevent
type: Tag
tags question: http://stackoverflow.com/q/26747617

http://stackoverflow.com/comment/42087177
type: Comment
has text: NO not like that.you have to install MySQL to the client machine where you want your application installed.
comment on: http://stackoverflow.com/a/26751662
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42109333
score: 0
has text: JSoup is pretty good with that type of stuff. I would see what their library has to offer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26764153

http://stackoverflow.com/q/26768523
has answer: http://stackoverflow.com/a/26768716
has answer: http://stackoverflow.com/a/73622526
has body: Is there such a thing? I have googled javafx virtual keyboard, but nothing seems to appear that is valid. I saw this article, but no code or example http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm Does anyone have prior experience with a virtual keyboard in a javafx application? I need to be able to show either a normal keyboard or numeric keypad when a textfield is focused.
tagged with: java-8
upvote count: 6
answer count: 4
tagged with: javafx-2
type: AnsweredQuestion
tagged with: java
tagged with: javafx
score: 6
type: Question
accepted answer: http://stackoverflow.com/a/26768716
has answer: http://stackoverflow.com/a/32308548
possible better answer: http://stackoverflow.com/a/36561319
has answer: http://stackoverflow.com/a/36561319
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/12704457
has title: JavaFX virtual keyboard
linked to: http://stackoverflow.com/q/23564413

http://stackoverflow.com/q/26805079
tagged with: validation
favorite count: 0
has body: I am working on a simple project as a point of reference for new projects or to try new technologies. The project has Hibernate &amp; Spring capabilities. I tried to add some anotations for validate fields. Those are the validation which I am using import javax.validation.constraints.Digits; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; The problem is that I need javax.validation dependecy and There are a lot of jars which includes those clases but none of Spring or Hibernate. Which one is the standard? Note: I check the dependency in the big project and I am using the validation-api
has title: What is the right place for javax.validation
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26832542
tagged with: dependencies
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26805227
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/41960176
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26680710
has text: Are you reading your pipe in the Java process? I'm guessing no.
type: QuestionComment

http://stackoverflow.com/q/26746103
accepted answer: http://stackoverflow.com/a/26764554
answer count: 2
has body: I'm new to Project Tango and for now I'm trying to run the demo apps provided but I keep on bumping into this error message in both the motion tracking and area learning demo projects because I can't see that action be declared in the manifest file. I know this error complains about either the activity not being declared in the manifest but it is there. Do I need to have anything else installed on the device so this line doesn't make the app crash? 11-04 13:04:21.789: E/AndroidRuntime(2867): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.projecttango.motiontrackingjava/com.projecttango.motiontrackingjava.StartActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.REQUEST_TANGO_PERMISSION (has extras) } This is how StartActivity is being declared on the manifest: &lt;activity android:name=".StartActivity" android:screenOrientation="landscape" android:icon="@drawable/ic_launcher"&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;
downvote count: 0
has title: No activity found to handle Intent android.intent.action.REQUEST_TANGO_PERMISSION (has extras)
favorite count: 0
tagged with: android
tagged with: google-project-tango
tagged with: android-intent
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26949524
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26949524
has answer: http://stackoverflow.com/a/26764554

http://stackoverflow.com/comment/42020624
score: 0
has text: wait , i'll insert when i start the thread, but i think this is secondary...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26715070

http://stackoverflow.com/comment/42080964
has text: i think this link can help to you. http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26745202
score: 0

http://stackoverflow.com/q/26791338
has body: I've written three rmi servers which send data to each other using UDP unicast. Every time a method is executed on a particular instance of a server the initiated server sends requests to the other servers which respond with the result of the method executed on that particular instance of the server. I've implemented them using threads. The method executes the first time but when i execute it again I get the following error: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.net.SocketException: Connection reset at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) at com.sun.proxy.$Proxy0.getNonReturners(Unknown Source) at drms.org.client.DRMSClient.main(DRMSClient.java:379) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) at java.io.DataInputStream.readByte(Unknown Source) ... 6 more getNonReturners-Method where the threads are created for udp communication requestData: Send request message to the other servers responseData: Send response message to the server which requests it Server side code: public class DRMSServer implements DRMSInterface, Serializable { final static int _concordiaPortNumber = 1098; final static int _mcgillPortNumber = 222; final static int _dawsonPortNumber = 223; /** * Description: Sends UDP request from invoked Server to the other servers * * @param: Port Number * @param: Data */ public String requestData(final int portNumber, final String data) { StringBuilder sb = new StringBuilder(); try { final DatagramSocket clientSocket = new DatagramSocket(); final byte[] receiveData = new…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26791464
type: AnsweredQuestion
score: 2
upvote count: 2
has title: Java RMI Error : Connection Reset
type: Question
accepted answer: http://stackoverflow.com/a/26791464
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/137192529

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26809495
tags question: http://stackoverflow.com/q/26819022
tags question: http://stackoverflow.com/q/26821649
tags question: http://stackoverflow.com/q/26809302
type: Tag
tags question: http://stackoverflow.com/q/26787362
tags question: http://stackoverflow.com/q/26828462
tags question: http://stackoverflow.com/q/26770030
tags question: http://stackoverflow.com/q/26701922
tags question: http://stackoverflow.com/q/26779371
tags question: http://stackoverflow.com/q/26695904
tags question: http://stackoverflow.com/q/26760829
tags question: http://stackoverflow.com/q/26679417

http://stackoverflow.com/comment/42019790
type: QuestionComment
comment on: http://stackoverflow.com/q/26714607
has text: That still doesn't let maven replace things. I strongly suggest a read of the sprnig docs. Add a `<context:property-placeholder />` which loads a properties file which in turn will replace the `${...}` placeholders.
score: 0
type: Comment

http://stackoverflow.com/q/26745277
score: 1
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/42076260
upvote count: 1
accepted answer: http://stackoverflow.com/a/26752017
has body: I am creating a PDF made of several PdfPTables where some PdfCell's consist of simple Phrases and others need to be parsed HTML snippets. To make sure the parsed HTML is added with the needed styling and in the correct place I have been storing it in a Paragraph then adding it to a PdfPCell. However doing this causes me to run into issues when dealing with some HTML tags like lists and quotes. Below is a rough example of what I am doing, what can I do to properly handle HTML lists, quotes, etc. ? For example: iText properly handles a HTML list and knows to convert it to an iText List/ListItem. I need to add that List into my PdfTable. I know putting the List Element in a Paragraph cancels out the proper styling (the entire list ends up being on one line with no numbering) and would like to know the proper way of handling this PdfPTable table = new PdfPTable(1); table.addCell(parseHtmlToParagraph(htmlString)); table.addCell(new Phrase("Name" + user.getName())); public Paragraph parseHtmlToParagraph(String str) throws IOException { StringReader body = new StringReader(str); final Paragraph para = new Paragraph(); XMLWorkerHelper.getInstance().parseXHtml(new ElementHandler() { @Override public void add(Writable w) { if (w instanceof WritableElement) { List&lt;Element&gt; elements = ((WritableElement) w).elements(); for (Element e : elements) { para.add(e); } } } }, body); return para; }
tagged with: xmlworker
type: Question
has title: Parsing HTML snippets and adding to PdfPTable
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26752017
type: AnsweredQuestion

http://stackoverflow.com/comment/42222615
score: 0
type: QuestionComment
type: Comment
has text: But, if I will not assign the value of mTitle in class and simply write it like:- private String mTitle; It will not throw Exception.
comment on: http://stackoverflow.com/q/26827244

http://stackoverflow.com/comment/42178866
type: Comment
type: QuestionComment
has text: Have you seen [this link](http://stackoverflow.com/a/25720364/3364187)?
score: 0
comment on: http://stackoverflow.com/q/26802450

http://stackoverflow.com/comment/42220822
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26750314
type: QuestionComment
has text: I appreciate any extra help since this is for a university project

http://stackoverflow.com/comment/42087060
type: Comment
has text: @Kescha That's not a problem. Spring integration tests are wired with Spring and run with `SpringJUnit4ClassRunner.class`. `@Autowired` will be injected.
comment on: http://stackoverflow.com/a/26742982
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42076596
score: 0
type: AnswerComment
has text: Yes ... but from the context, the OP is clearly not talking about javadoc comments.
type: Comment
comment on: http://stackoverflow.com/a/26745559

http://stackoverflow.com/q/26827182
tagged with: php
has title: Define a property in sub class, then use it in parent class, strange behavour in PHP?
tagged with: c#
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/26827420
accepted answer: http://stackoverflow.com/a/26827420
type: Question
has comment: http://stackoverflow.com/comment/42222376
has comment: http://stackoverflow.com/comment/42222392
answer count: 1
has comment: http://stackoverflow.com/comment/42222444
has comment: http://stackoverflow.com/comment/42222274
score: 0
has body: In PHP, I define a property named $table_name in the sub class, then in the parent class, I can use this property: class A{ public function getTable(){ return $this-&gt;table_name; } } class B extends A{ protected $table_name='admin; } Could this be possible in Java or C++? I just wonder if this is a good OOP practice, or it is just doable in PHP as PHP is an interpreting language. Update: I didn't realized this is possible in PHP until I found a MVC framework uses it!When I was learning Java, I didn't remember anything like this, so I thought it might worth discussing.
tagged with: c++
has comment: http://stackoverflow.com/comment/42222313

http://stackoverflow.com/comment/42078396
type: QuestionComment
has text: We don't know. Use a debugger. Not enough information to help you. I'd say that `txt1` being static looks extra suspicious.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26746435

http://stackoverflow.com/comment/46992828
type: Comment
comment on: http://stackoverflow.com/a/26676028
has text: Similar question: http://stackoverflow.com/questions/16029973/beans-xml-file-and-java-lang-unsupportedoperationexception-jbas011859-naming-c
score: 0
type: AnswerComment

http://stackoverflow.com/q/26739357
has comment: http://stackoverflow.com/comment/42064874
answer count: 2
has comment: http://stackoverflow.com/comment/42064630
upvote count: 0
has title: Java - how to make class 1 and class 2 both know about each other?
has answer: http://stackoverflow.com/a/26739626
has answer: http://stackoverflow.com/a/26739608
favorite count: 0
linked to: http://stackoverflow.com/q/519520
type: UnansweredQuestion
tagged with: simulation
tagged with: reference
has comment: http://stackoverflow.com/comment/42065307
tagged with: java
has comment: http://stackoverflow.com/comment/42064824
linked to: http://stackoverflow.com/q/40480
tagged with: parameter-passing
downvote count: 1
type: Question
has body: I have a program I am in the middle of writing that is meant to simulate bugs finding food. In brief i have a grid (a world) in which there are bugs, obstacles and food of different energy values. Each bug will look in every direction, get the closest food within its "seeing distance" and move one cell towards it otherwise moving in a random direction. I have 3 clases: ABug AWorld Main ABug and AWorld obviously contain all the methods to populate a grid with food and obstacles, sense food, move a bug etc, and the Main class is the controller that creates a world, creates a number of bugs based on user input and adds them to the world. My question is: Is there a better way to make a bug know about a world it is in whilst a world also knows about the bugs in it other than passing a reference of the world into every function that needs it inside a bug? I currently have an arraylist of bugs inside the world class and then pass the 2D array into the functions that need it in the bug class. Sorry for the long explanation, wasnt sure how much detail people would want so I just put it all :) Thanks for any suggestions
has comment: http://stackoverflow.com/comment/42064859
score: -1
has comment: http://stackoverflow.com/comment/42064741
tagged with: class

http://stackoverflow.com/a/26762680
has comment: http://stackoverflow.com/comment/42140353
has comment: http://stackoverflow.com/comment/42130157
accepted answer of: http://stackoverflow.com/q/26758751
score: 9
has body: Good question. The thing to notice about JMockit's (or any other mocking API) support for dependency injection is that it's meant to be used only when the code under test actually relies on the injection of its dependencies. The example Translator class does not rely on injection for the TranslatorWebService dependency; instead, it obtains it directly through internal instantiation. So, in a situation like this you can simply mock the dependency: public class TranslatorTest { @Tested Translator tested; @Mocked TranslatorWebService transWebServiceDependency; @Test public void translateEnglishToGerman() { new Expectations() {{ transWebServiceDependency.performTranslation("House"); result = "Haus"; }}; String translated = tested.translateEnglishToGerman("House"); assertEquals("Haus", translated); } }
upvote count: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42333119
answers question: http://stackoverflow.com/q/26758751
type: Answer
has comment: http://stackoverflow.com/comment/42310209

http://stackoverflow.com/comment/42068516
score: 0
type: Comment
has text: I was hoping that maybe there would be a way to change the `plan.xml` file from the console itself (using fields or plain text)), even if an update of the application would be required after! I'll accept your answer if nobody else knows if it's possible. Thanks for the help!
type: AnswerComment
comment on: http://stackoverflow.com/a/26739475

http://stackoverflow.com/comment/42075062
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26744498
has text: Actually, I got it. Didn't think to set the SpannableString to the entire string, not just the boolean. Thanks again!
type: AnswerComment

http://stackoverflow.com/q/26674850
tagged with: memory-leaks
favorite count: 0
linked to: http://stackoverflow.com/q/10085028
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26674979
has title: Tomcat memory usage grows in IDLE
upvote count: 5
tagged with: rmi
tagged with: threadpool
tagged with: java
linked to: http://stackoverflow.com/q/542979
has body: I have problem with growing memory consuming on Tomcat. Just after start nothing happens,but if some user login, after this memory usage start growing in Edem. PermGen does not grow, but anyway, it anormal. My analyze shows that thread RMI TCP Connection produces lot of Object[] char[] and String[] objects. I can not understand what's wrong and where to dig. Who starts this thread, is is postgres connections and what is this?
type: Question
has answer: http://stackoverflow.com/a/26675168
linked to: http://stackoverflow.com/q/15111365
answer count: 2
score: 5
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/q/26692749
type: Question
has title: Error "The operator == is undefined for the argument type(s) char, boolean"
score: 0
answer count: 2
has body: I'm trying to do this: System.out.println("Do you want to solve an equation (y/n)?"); char first = In.getChar(); boolean y = true; boolean n = false; if(first == y) System.out.println("Enter a:"); if(first == n) System.out.println("Thanks"); Basically, what I'm trying to do is that if I ask the user to solve the equation and the user presses y (meaning yes), then it will go through the if statement for which y is true; but if the user enters n (meaning no), then it will say something like "thanks for using the system". I'm getting the error "The operator == is undefined for the argument type(s) char, boolean". What am I doing wrong, and how can I fix this?
favorite count: 0
has answer: http://stackoverflow.com/a/26692761
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26692787
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42029374
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26719260
score: 0
has text: Yes, why _do_ you add the label _and_ paint the image? Are you getting "IMAGE IMPORT ERROR"?

http://stackoverflow.com/q/26731460
has body: I'm new into java and xml parsing processes, so i got stucked. My xml is: <?xml version="1.0" encoding="utf-16"?> <File Name="parakstitais.edoc" Location="vieta_kur_saglabat" /> <FileReference Name="Document1.doc" Address="some url" /> <FileReference Name="Scan7.pdf" Address="some url" /> <FileReference Name="Scan8.pdf" Address="some url" /> and my goal is to extract all Action part, so it should be like: <FileReference Name="Document1.doc" Address="some url" /> <FileReference Name="Scan7.pdf" Address="some url" /> <FileReference Name="Scan8.pdf" Address="some url" /> Currently my Java code is public static void main(String[] args) throws ParserConfigurationException, MalformedURLException, SAXException, IOException, TransformerException, XPathExpressionException { String URL = "my xml URL"; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new URL(URL).openStream()); URL namespaceURL = new URL("http://www.w3.org/2001/XMLSchema-instance"); String namespace = "xmlns:xsi="+namespaceURL.toString(); Element messages = doc.createElementNS(namespace, "messages"); doc.appendChild(messages); XPath xPath = XPathFactory.newInstance().newXPath(); Node result = (Node) xPath.evaluate("LauncherInfo/Action", doc, XPathConstants.NODE); System.out.println(nodeToString(result)); System.out.println("..."); } private static String nodeToString(Node node) throws TransformerException { StringWriter buf = new StringWriter(); Transformer xform = TransformerFactory.newInstance().newTransformer(); xform.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); xform.transform(new DOMSource(node), new StreamResult(buf)); return (buf.toString()); } When launching an error appears: ERROR: 'Namespace for prefix 'xsi' has not been declared.'. I suppose that something with namespace declaration should be done. Is there any way to declare namepace URI in xpath…
has answer: http://stackoverflow.com/a/26735014
favorite count: 0
has answer: http://stackoverflow.com/a/26731571
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has answer: http://stackoverflow.com/a/26731685
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: namespaces
type: Question
has title: Namespace for prefix 'xsi' has not been declared
linked to: http://stackoverflow.com/q/33693341
has comment: http://stackoverflow.com/comment/42071884
tagged with: dom
answer count: 3
downvote count: 0

http://stackoverflow.com/a/26769282
type: Answer
answers question: http://stackoverflow.com/q/26769207
score: 0
has body: If you want to repeat something in a program, the natural answer should be for you to use a loop. Change your exit condition aux == false (which would better be !aux, it is equivalent but better programming style). For example : // initialize it to false in case the first iteration of the loop throws an exception boolean exit = false; do { //... exit = option == 0; while (!exit);

http://stackoverflow.com/a/26738212
score: 0
type: Answer
has body: The problem that occurred in your code was due to scope of the variable. Scope refers to the lifetime and accessibility of a variable. How large the scope is depends on where a variable is declared. For example, if a variable is declared at the top of a class then it will accessible to all of the class methods. If it’s declared in a method then it can only be used in that method. The correct version is as below : int sum = 0; for(int x = 0 ; x &lt;10 ; x++) { sum += x; } System.out.println(sum);
answers question: http://stackoverflow.com/q/26738056

http://stackoverflow.com/a/26830664
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26830617
upvote count: 2
has comment: http://stackoverflow.com/comment/42228173
has body: each command you are running has its own bash shell, so once you cd to that directory and for next command you are opening new bash shell try changing your command to ls bin
has comment: http://stackoverflow.com/comment/42228978
has comment: http://stackoverflow.com/comment/42228130

http://stackoverflow.com/comment/42207149
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26814087
has text: Nice solution. It should also be noted that this is more efficient only when the frequency of progress updates is faster than 10 milliseconds.
score: 0

http://stackoverflow.com/comment/42030634
type: QuestionComment
has text: i don't need hibernate to understand or map the column. Just need to pass a value to the query before execution.
comment on: http://stackoverflow.com/q/26718200
score: 0
type: Comment

http://stackoverflow.com/a/26723506
answers question: http://stackoverflow.com/q/26723417
has comment: http://stackoverflow.com/comment/42037019
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Please, no. Find an algorithm book and write a simple sort method that takes an array and sorts it. Even a bubble sort would be better than what you posted.

sharedpreferences
tags question: http://stackoverflow.com/q/26689442
tags question: http://stackoverflow.com/q/26720815
type: Tag
tag name: sharedpreferences
tags question: http://stackoverflow.com/q/26753927

http://stackoverflow.com/comment/42027552
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26699718
has text: @Basil Your are correct. I edited my answer. Now every things goes through EDT. But now, I thinks, using Swing-Timer is a more convenient solution.
type: AnswerComment

http://stackoverflow.com/comment/42013617
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26711084
score: 0
has text: u need to caste B as object i think.

versionone
tags question: http://stackoverflow.com/q/26759454
tags question: http://stackoverflow.com/q/26771667
tag name: versionone
type: Tag

http://stackoverflow.com/a/26714934
upvote count: 3
type: Answer
has body: The only array you are accessing is args. You are accessing the first element of that array without checking that it's not empty. This array contains the command line arguments passed to your Java application. You should check the array before accessing it : String aNumber = null; if (args.length &gt; 0) aNumber = args[0]; And you should pass an argument to your program.
accepted answer of: http://stackoverflow.com/q/26714911
downvote count: 0
answers question: http://stackoverflow.com/q/26714911
score: 3
type: AcceptedAnswer

http://stackoverflow.com/a/26725812
accepted answer of: http://stackoverflow.com/q/26725693
answers question: http://stackoverflow.com/q/26725693
type: Answer
downvote count: 0
score: 1
has body: What you are after requires refactoring of your code. I suggest you write some tests to verify your working logic before you start refactoring. Once you think you have enough coverage of your code, start refactoring small pieces of code at a time (only small pieces of code at a time). After every change you make, run your tests to see if you have broken anything. Repeat the process of making small changes and running tests until you are satisfied.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42212883
has text: What does _not pulling correctly to new class_ mean?
comment on: http://stackoverflow.com/q/26821736
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42197928
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26812693
has text: Also, there is another thing to mention. If a pipeline has some expensive operation (like `map((a) -> doSomethingReallySlow(a))`) then we still have to perform it on ALL elements even if we just want one. `limit(2)` can save us, but not in all cases. See [`limit` documentation](http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#limit-long-) for details. So be careful and don't expect this collector to skip all elements but one (or, at least, use it like `stream.of(...).limit(2).collect(singleOrEmpty())`).
score: 0

http://stackoverflow.com/q/26764041
tagged with: java
has body: Is there anything like bounded primitives in Java or C++? What I want is a variable that acts just like a float or double, except that it has a user-settable minimum and maximum. So for example, if I were to set up such a floating-point variable to be bound between 0 and 100, I could try to set it to any number, and generally use it just in the same fashion as I would a primitive, except that when the value assigned to it would be greater than the allowed maximum, it would assume the maximum, and when it would be less than the minimum, it would assume the minimum. I want to be able to do basic operations on it, like addition, multiplication and subtraction - particularly using the operators I would use on analogous normal variables. Do these exist in some library somewhere?
type: Question
has comment: http://stackoverflow.com/comment/42109832
answer count: 2
possible better answer: http://stackoverflow.com/a/26764237
accepted answer: http://stackoverflow.com/a/26764297
downvote count: 0
favorite count: 0
tagged with: c++
upvote count: 3
has title: Bounded primitives
has answer: http://stackoverflow.com/a/26764297
tagged with: primitive
tagged with: operator-overloading
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26764237

http://stackoverflow.com/q/26824663
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26824664
score: 21
has answer: http://stackoverflow.com/a/38817181
tagged with: java
has body: This question is usually asked as a part of another question but it turns out that the answer is long. I've decided to answer it here so I can link to it elsewhere. Although I'm not aware of a way that Java can produce audio samples for us at this time, if that changes in the future, this can be a place for it. I know that JavaFX has some stuff like this, for example AudioSpectrumListener, but still not a way to access samples directly. I'm using javax.sound.sampled for playback and/or recording but I'd like to do something with the audio. Perhaps I'd like to display it visually or process it in some way. How do I access audio sample data to do that with Java Sound? See also: Java Sound Tutorials (Official) Java Sound Resources (Unofficial)
favorite count: 0
linked to: http://stackoverflow.com/q/47981
has title: How do I use audio sample data from Java Sound?
tagged with: javax.sound.sampled
has answer: http://stackoverflow.com/a/26824664
answer count: 2
possible better answer: http://stackoverflow.com/a/38817181
tagged with: javasound
linked to: http://stackoverflow.com/q/11380062
upvote count: 21
tagged with: audio-processing
downvote count: 0
type: Question
tagged with: audio

http://stackoverflow.com/comment/105436763
type: Comment
has text: Then what? What type would be method return? How to convert `Bitmap` to `Image`?
comment on: http://stackoverflow.com/a/27277607
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42159106
has text: I took the liberty to edit the code formatting of your answer. Please read this help page to see how that works: http://stackoverflow.com/help/formatting. :)
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/26791655
type: Comment

http://stackoverflow.com/q/26793508
tagged with: connection-pooling
answer count: 0
type: UnansweredQuestion
type: Question
has title: How to test for dropped JAVA database connections
tagged with: java
has comment: http://stackoverflow.com/comment/42235204
tagged with: sql-server
score: 0
has comment: http://stackoverflow.com/comment/42162212
has comment: http://stackoverflow.com/comment/42162217
tagged with: sql
has comment: http://stackoverflow.com/comment/42162323
has body: I have a DBPool connection pool - Class jdbcClass = Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Driver jdbcDriver = (Driver)jdbcClass.newInstance(); DriverManager.registerDriver(jdbcDriver); pool = new ConnectionPool("pool",5,10,30,180,"jdbc:sqlserver://serverip", "login", "password"); and I get connections by pool.getConnection(500); The problem I have is that the application hangs if the network connection is lost to the server. The 500mS timeout provided to the doesn't actually timeout and my application just hangs if there is no network connection. What is the best way to check if the connection is lost or if the connection times out? I want it to fail and return null if there is no connection after 500mS

http://stackoverflow.com/q/26764596
has answer: http://stackoverflow.com/a/26765607
score: 0
tagged with: sqlite
possible better answer: http://stackoverflow.com/a/26764869
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42110126
has body: I have gotten this message when I want to create a Database on my Android application. I am newbie with android sqlite database. now i just try to create my custom database manager and i got the error at oncreate() function. @Override public void onCreate(SQLiteDatabase db) { // TODO Crear tablas sqlDB.execSQL(Cuenta.CREATE_TABLE); } Could you help me please? 11-05 12:21:01.468: E/AndroidRuntime(1064): FATAL EXCEPTION: main 11-05 12:21:01.468: E/AndroidRuntime(1064): java.lang.RuntimeException: Unable to create application com.example.database.BDApplication: java.lang.NullPointerException 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3451) 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.app.ActivityThread.access$2200(ActivityThread.java:124) 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1012) 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.os.Handler.dispatchMessage(Handler.java:99) 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.os.Looper.loop(Looper.java:130) 11-05 12:21:01.468: E/AndroidRuntime(1064): at android.app.ActivityThread.main(ActivityThread.java:3859) 11-05 12:21:01.468: E/AndroidRuntime(1064): at java.lang.reflect.Method.invokeNative(Native Method) 11-05 12:21:01.468: E/AndroidRuntime(1064): at java.lang.reflect.Method.invoke(Method.java:507) 11-05 12:21:01.468: E/AndroidRuntime(1064): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890) 11-05 12:21:01.468: E/AndroidRuntime(1064): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648) 11-05 12:21:01.468: E/AndroidRuntime(1064): at dalvik.system.NativeStart.main(Native Method) 11-05 12:21:01.468: E/AndroidRuntime(1064): Caused by: java.lang.NullPointerException 11-05 12:21:01.468: E/AndroidRuntime(1064): at com.example.database.DBAdapter$DBOpenHelper.onCreate(DBAdapter.java:61) 11-05 12:21:01.468: E/AndroidRuntim…
tagged with: java
has answer: http://stackoverflow.com/a/26764869
type: Question
accepted answer: http://stackoverflow.com/a/26765607
answer count: 2
has comment: http://stackoverflow.com/comment/42110373
has title: Android, Creating DB error (SQLITE)

android
tags question: http://stackoverflow.com/q/26822413
tags question: http://stackoverflow.com/q/26781436
tags question: http://stackoverflow.com/q/26730873
tags question: http://stackoverflow.com/q/26710099
tags question: http://stackoverflow.com/q/26778969
tags question: http://stackoverflow.com/q/26715038
tags question: http://stackoverflow.com/q/26714842
tags question: http://stackoverflow.com/q/26755110
tags question: http://stackoverflow.com/q/26823436
tags question: http://stackoverflow.com/q/26680249
tags question: http://stackoverflow.com/q/26827968
tags question: http://stackoverflow.com/q/26820081
tags question: http://stackoverflow.com/q/26811458
tags question: http://stackoverflow.com/q/26707363
tags question: http://stackoverflow.com/q/26696277
tags question: http://stackoverflow.com/q/26715121
tags question: http://stackoverflow.com/q/26772855
tags question: http://stackoverflow.com/q/26831425
tags question: http://stackoverflow.com/q/26792641
tags question: http://stackoverflow.com/q/26703405
tags question: http://stackoverflow.com/q/26727136
tags question: http://stackoverflow.com/q/26760393
tags question: http://stackoverflow.com/q/26673631
tags question: http://stackoverflow.com/q/26743646
tags question: http://stackoverflow.com/q/26825826
tags question: http://stackoverflow.com/q/26814275
tags question: http://stackoverflow.com/q/26769019
tags question: http://stackoverflow.com/q/26773617
tags question: http://stackoverflow.com/q/26695923
tags question: http://stackoverflow.com/q/26825765
tags question: http://stackoverflow.com/q/26829417
tags question: http://stackoverflow.com/q/26797804
tags question: http://stackoverflow.com/q/26709652
tags question: http://stackoverflow.com/q/26832050
tags question: http://stackoverflow.com/q/26747828
tags question: http://stackoverflow.com/q/26823246
tags question: http://stackoverflow.com/q/26759060
tags question: http://stackoverflow.com/q/26703395
tags question: http://stackoverflow.com/q/26704813
tags question: http://stackoverflow.com/q/26784383
tags question: http://stackoverflow.com/q/26764404
tags question: http://stackoverflow.com/q/26682619
tags question: http://stackoverflow.com/q/26798374
tags question: http://stackoverflow.com/q/26733148
tags question: http://stackoverflow.com/q/26820900
tags question: http://stackoverflow.com/q/26777368
tags question: http://stackoverflow.com/q/26820325
tags question: http://stackoverflow.com/q/26698888
tags question: http://stackoverflow.com/q/26802603
tags question: http://stackoverflow.com/q/26701709
tags question: http://stackoverflow.com/q/26719773
tags question: http://stackoverflow.com/q/26701567
tags question: http://stackoverflow.com/q/26707480
tags question: http://stackoverflow.com/q/26753635
tags question: http://stackoverflow.com/q/26729105
tags question: http://stackoverflow.com/q/26700315
tags question: http://stackoverflow.com/q/26765020
tags question: http://stackoverflow.com/q/26800506
tags question: http://stackoverflow.com/q/26685101
tags question: http://stackoverflow.com/q/26774312
tags question: http://stackoverflow.com/q/26830505
tags question: http://stackoverflow.com/q/26792133
tags question: http://stackoverflow.com/q/26778807
tags question: http://stackoverflow.com/q/26824934
tags question: http://stackoverflow.com/q/26737270
tags question: http://stackoverflow.com/q/26744636
tags question: http://stackoverflow.com/q/26729349
tags question: http://stackoverflow.com/q/26724601
tags question: http://stackoverflow.com/q/26779198
tags question: http://stackoverflow.com/q/26695664
tags question: http://stackoverflow.com/q/26811815
tags question: http://stackoverflow.com/q/26800772
tags question: http://stackoverflow.com/q/26738906
tags question: http://stackoverflow.com/q/26701469
tags question: http://stackoverflow.com/q/26779070
tags question: http://stackoverflow.com/q/26829245
tags question: http://stackoverflow.com/q/26823156
tags question: http://stackoverflow.com/q/26689442
tags question: http://stackoverflow.com/q/26821595
tags question: http://stackoverflow.com/q/26725177

http://stackoverflow.com/q/26734836
has comment: http://stackoverflow.com/comment/42056311
tagged with: war
has answer: http://stackoverflow.com/a/26735518
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26735518
has comment: http://stackoverflow.com/comment/42057241
has comment: http://stackoverflow.com/comment/42056870
type: Question
has comment: http://stackoverflow.com/comment/42056553
downvote count: 0
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/42056472
has title: Maven - maven-war-plugin to generate jar and install it to maven local repository
has comment: http://stackoverflow.com/comment/42057127
answer count: 1
tagged with: vs-web-application-project
tagged with: maven-war-plugin
has body: I am using maven-war-plugin in my pom.xml to generate a jar file in parallel with my war file in an java web project build. My maven build is creating war and jar files in the target directory. And only war file is installed to local repository. Is there a way to push the jar file created as well to local repository. Below is the snippet of my pom.xml org.apache.maven.plugins maven-war-plugin false true WEB-INF/lib/x*.jar ${project.basedir}\src\main\webapp\WEB-INF\web.xml ${project.basedir}\src\main\webapp **/*.* Thanks in advance! pom.xml content: 4.0.0 com.xyz x war 1.0.0-SNAPSHOT x http://maven.apache.org org.apache.maven.plugins maven-war-plugin false true WEB-INF/lib/x*.jar ${project.basedir}\src\main\webapp\WEB-INF\web.xml ${project.basedir}\src\main\webapp **/*.* org.apache.maven.plugins maven-compiler-plugin ${java-version} ${java-version} UTF-8 com.googlecode.addjars-maven-plugin addjars-maven-plugin 1.0.2 add-jars ${project.basedir}/src/main/webapp/WEB-INF/lib
upvote count: 1

http://stackoverflow.com/comment/42209736
score: 0
type: AnswerComment
has text: Yup I tried that too. To my astonishment the debug line was printed 3 times(because i connected 3 clients) but the client got the server message only once(I expected client also to get message 3 times).
comment on: http://stackoverflow.com/a/26819892
type: Comment

http://stackoverflow.com/comment/42267863
type: Comment
comment on: http://stackoverflow.com/a/26808262
score: 0
type: AnswerComment
has text: Just curious, why the missing field is represented as 'null' other than ""?

http://stackoverflow.com/a/26700893
has comment: http://stackoverflow.com/comment/41995751
has comment: http://stackoverflow.com/comment/41996762
answers question: http://stackoverflow.com/q/26700775
type: Answer
has body: try this <constructor-arg value="google" /> <constructor-arg value="gooogle" />
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41995922
has comment: http://stackoverflow.com/comment/41995512
downvote count: 0

http://stackoverflow.com/a/28409239
answers question: http://stackoverflow.com/q/26812770
has body: For Macports : sudo port install maven3 Change maven3 to maven1 or maven2 for corresponding version number.
type: Answer
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/q/26698788
score: 0
answer count: 3
tagged with: ebean
accepted answer: http://stackoverflow.com/a/26704897
has title: JPA/Ebean - force @Id to strictly increment by +1 with PostgreSQL
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26699499
tagged with: java
has comment: http://stackoverflow.com/comment/41992127
type: Question
possible better answer: http://stackoverflow.com/a/26699499
has answer: http://stackoverflow.com/a/26704897
has answer: http://stackoverflow.com/a/48688564
tagged with: jpa
has body: I have the following Model: public class Parameter extends Model { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public long id; } The records created by save() look like this: play=&gt; select id from parameter; id ---- 1 2 3 4 5 21 (6 rows) Is there a way that I can tell JPA to always increment the id by exactly one, instead of randomly jumping to 21?
tagged with: postgresql

http://stackoverflow.com/comment/42010847
comment on: http://stackoverflow.com/q/26709343
has text: Well default will be bad practice what about define package and import?
type: QuestionComment
type: Comment
score: 1

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

http://stackoverflow.com/q/26735846
type: UnansweredQuestion
tagged with: maven
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26738765
has comment: http://stackoverflow.com/comment/42061596
has comment: http://stackoverflow.com/comment/42069211
has comment: http://stackoverflow.com/comment/42059926
tagged with: groovy
upvote count: 1
answer count: 1
favorite count: 0
has body: I am having issues getting my Groovy script to compile. When I was developing the Groovy script everything worked fine, I used IntelliJ IDEA IDE for it and groovy command line utility to run it, with @Grapes and @Grab annotations. Now, I need to move to compiled model using Maven. Unfortunately, I am unable to figure out what is wrong with my pom.xml, why the Groovy compiler complains like this: [ERROR] import org.slf4j.LoggerFactory [ERROR] ^ [ERROR] The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files [...] [ERROR] import org.slf4j.LoggerFactory [ERROR] ^ [ERROR] The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files This is my current pom.xml: 4.0.0 com.xyz com.xyz.parent 1.0-SNAPSHOT com.uvw verifymetrics 1.0-SNAPSHOT jar org.codehaus.groovy groovy-all 2.3.7 com.xyz com.xyz.client ${project.version} net.sf.json-lib json-lib 2.3 jdk15 commons-logging commons-logging org.codehaus.groovy.modules.http-builder http-builder 0.7.1 org.codehaus.gpars gpars 1.2.1 commons-cli commons-cli 1.2 com.google.guava guava 18.0 org.slf4j slf4j-api 1.7.7 org.slf4j jul-to-slf4j 1.7.7 org.slf4j jcl-over-slf4j 1.7.7 org.slf4j slf4j-log4j12 1.7.7 log4j log4j 1.2.17 org.apache.maven.plugins maven-compiler-plugin groovy-eclipse-compiler 1.7 1.7 true org.codehaus.groovy groovy-eclipse-compiler 2.8.0-01 org.codehaus.groovy groovy-eclipse-batch 2.3.4-01
has title: Compiling Groovy with Maven and groovy-eclipse-compiler

http://stackoverflow.com/a/26781310
answers question: http://stackoverflow.com/q/26779059
score: 0
type: Answer
has body: The root error message is Access denied for user 'root'@'localhost' (using password: YES) Maybe it helps to change the following line db.url=jdbc:mysql://127.0.0.1:3306/dms to db.url=jdbc:mysql://localhost:3306/dms
has comment: http://stackoverflow.com/comment/42140633

http://stackoverflow.com/comment/42140721
comment on: http://stackoverflow.com/a/26781632
type: Comment
has text: I think theres a moral to this story for the O.P
score: 1
type: AnswerComment

http://stackoverflow.com/q/26747515
tagged with: java
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/26747571
upvote count: 0
has body: I have two classes. Color.java and Light.java, I'm trying to use the Color members in the Light class. without using any other attributes in the Light class(I need to have only the two below.) i wrote for the Color class a toString method, getters and setters . and a copy constructor. i just didnt wrote it here . this is an exercise . and i cant use extends or any other private members in Light. weird exercise.(they didnt write i cant use extend. they just didnt said anything about it) public class Color { private int red; private int green; private int blue; public Color(){ red = 0; green = 0; blue = 0; } } and I have the Light class public class Light { private Color color1; private boolean switchedon; public Light(int red, int green, int blue){ //dont know what to write here . how can i use the members of the Color class here ? without using extends. and without adding another attributes. } }
favorite count: 0
has comment: http://stackoverflow.com/comment/42079975
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42080254
type: Question
has title: How can I use the members of a Color object
has answer: http://stackoverflow.com/a/26747568

http://stackoverflow.com/a/26742109
score: 0
has comment: http://stackoverflow.com/comment/42072866
has comment: http://stackoverflow.com/comment/42071625
type: Answer
has comment: http://stackoverflow.com/comment/42071256
has body: The problem is the String goes from 0... n-1. Say length is 3 but the str.charAt(n) n should be from 0...2. You are calling it with 3 fix it. The line if referring to is : if(str.charAt(n)&lt;'2' &amp;&amp; str.charAt(n+1)!='0') || (str.charAt(n)=='2' &amp;&amp; str.charAt(n+1)&lt;'6')) Even after fix that you will get errors cause you are doing n+1 also in that same line. EDIT: Check the code now: private void decodings(String str, int n,String temp,int len){ if(n == len ){ System.out.println(temp); return; } if(str.charAt(n)&gt;='0'){ char[] c = Character.toChars(96 + str.charAt(n)-'0'); temp = temp +c[0]; decodings(str,n+1,temp,len); } System.out.println("temp is "+temp); } public static void main(String[]args){ String str="121"; new countDecoding().decodings(str, 0,"",3); } OUTPUT IS : aba temp is aba temp is ab temp is a
has comment: http://stackoverflow.com/comment/42071922
answers question: http://stackoverflow.com/q/26742020
has comment: http://stackoverflow.com/comment/42071880
has comment: http://stackoverflow.com/comment/42071347
has comment: http://stackoverflow.com/comment/42071430

http://stackoverflow.com/comment/42168322
has text: When dose the serveltContextListener childs are created ?
type: Comment
comment on: http://stackoverflow.com/a/26796657
score: 0
type: AnswerComment

http://stackoverflow.com/a/26698671
has comment: http://stackoverflow.com/comment/41991961
has comment: http://stackoverflow.com/comment/41992062
upvote count: 1
type: AcceptedAnswer
has body: Problem 1 In your viewTable method String list[] = null;. You never initialize it with a new String[..]. So you will new a NullPointerException. But it would be better to use an ArrayList, since you may not know exactly how many values will be returned private List&lt;String&gt; viewTable(Connection con, String command) { List&lt;String&gt; list = new ArrayList&lt;&gt;(); ... while (rs.next()) { list.add(rs.getString("itemName")); } return list; } Problem 2 You are creating the JComboBox in the ActionListener. So you can't add the combo before the action is performed. With combo boxes, it's preferred to work with it's model, rather then the component, when working with the data. JComboBox has a ComboBoxModel. We can use the concrete DefaultComboBoxModel. You can pass an array to its constructor. List, has the method toArray we can call to create an array from the List. Then just pass the array to the DefaultComboBoxModel constructor and call the combo box setModel List&lt;String&gt; list = null; String command = "SELECT itemName FROM item"; try { list = viewTable(conn, command); } catch (SQLException e) { e.printStackTrace(); } ComboBoxModel model = new DefaultComboBoxModel(list.toArray()); itemList.setModel(model); This way, you can initialize the combo box before the action is performed. Update If you want the combo box loaded on application start up, I don't see what the problem is. Just create a method in you class, using the code in the actionPerformed. Then just call that method, like in your main constructor or something. Maybe you could do something like below, where you have the method return a ComboBoxModel and you can use to set the model for the combo box import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import ja…
has comment: http://stackoverflow.com/comment/41991563
type: Answer
has comment: http://stackoverflow.com/comment/41991550
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41992070
has comment: http://stackoverflow.com/comment/41992036
accepted answer of: http://stackoverflow.com/q/26698351
answers question: http://stackoverflow.com/q/26698351

http://stackoverflow.com/comment/42186245
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26805731
type: Comment
has text: Edited: you subclass JFrame you can just write repaint() it will call the method in the super class

http://stackoverflow.com/comment/42113046
comment on: http://stackoverflow.com/q/26766079
type: Comment
type: QuestionComment
score: 0
has text: Please demonstrate minimal efforts. We don't encourage questions that don't show minimal research.

http://stackoverflow.com/q/26820980
has body: I am supposed to implement a simple Client/Server application similar to FTP Server/Client . Both the client and the server should be able to send and receive files, but for now let's address just sending a file from the server to the client. There is already an open socket between them, I do not wish to use a byte buffer. I tried the Files.copy() method, it created a file at the client side but it was filled with rubbish. I have been trying to use FileChannel.transferFrom/To but I can't seem to get it right. could someone provide an example of how to use it over a socket ?
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: nio
type: Question
upvote count: 2
has title: How to copy files over socket using Java NIO FileChannel?
has comment: http://stackoverflow.com/comment/42211667
has comment: http://stackoverflow.com/comment/42211806
tagged with: filechannel
tagged with: sockets
has comment: http://stackoverflow.com/comment/42211852
favorite count: 0
score: 2
answer count: 0

http://stackoverflow.com/q/26807844
type: Question
tagged with: ant
has title: ApplicationContext loads when JUnit test run from eclipse, but not from ant build
score: 0
answer count: 1
tagged with: junit
accepted answer: http://stackoverflow.com/a/26852474
tagged with: applicationcontext
has body: Seems weird to me. JUnit test runs fine from eclipse. But when I run from Ant command line, it shows error. Looks like its not loading / application context. Here is the base class of test class. @ContextConfiguration(locations = { "classpath*:applicationContext.xml"}) public abstract class TransactionalTestCase extends StrutsSpringTransactionalTests { @Before public void onSetUp() throws Exception { super.setUp(); } @Override protected void setupBeforeInitDispatcher() throws Exception { servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appContext); } When I try to print appContext in this method, it prints org.springframework.context.support.GenericApplicationContext@9320aa71: startup date xxxxxxx But it prints null from ant build command line. I compared the classpath of both eclipse and ant. Both are same. Includes same set of files and folders. @ContextConfiguration not taking effect when I run from ant build? What else could be wrong? StrutsSrpingTransactionalTests class @RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners({ TransactionalTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class }) @Transactional public abstract class StrutsSpringTransactionalTests extends StrutsTestCase implements ApplicationContextAware { protected ApplicationContext appContext; @Override public void setApplicationContext(ApplicationContext appContext) throws BeansException { this.appContext = appContext; } }
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26852474

http://stackoverflow.com/comment/140132398
type: Comment
has text: Could you please provide code sample?
type: AnswerComment
comment on: http://stackoverflow.com/a/26710611
score: 0

http://stackoverflow.com/q/26716246
tagged with: hibernate-criteria
type: Question
possible better answer: http://stackoverflow.com/a/26848623
accepted answer: http://stackoverflow.com/a/26765791
tagged with: criteria
has answer: http://stackoverflow.com/a/26848623
has title: Hibernate: dynamic join multiple tables
score: 0
answer count: 2
has body: I'm new to Hibernate and I'm trying to dynamically join more table. I have built an example with three tables: Employee, Address, Country. I want to retrieve all employees of a certain country. Here my config file: <generator class="native"/> <property name="firstName" column="first_name" type="string"/> <property name="lastName" column="last_name" type="string"/> <property name="salary" column="salary" type="int"/> <many-to-one name="address" column="address" unique="true" class="Address" not-null="true"/> <generator class="native"/> <property name="street" column="street_name" type="string"/> <property name="city" column="city_name" type="string"/> <property name="state" column="state_name" type="string"/> <property name="zipcode" column="zipcode" type="string"/> <many-to-one name="country" column="country" unique="true" class="Country" not-null="true"/> <generator class="native"/> <property name="name" column="name" type="string"/> <property name="code" column="code" type="string"/> If I do List employees = session.createCriteria("Employee") .createCriteria("address") .createCriteria("country") .add(Restrictions.eq("code","IT")) .list(); I get the right result back but my goal is not to manually specify the whole path between start table and filter table: I want that hibernate makes the job for me. I would like to write something like this: List employees = session.createCriteria("Employee") .createCriteria("country") .add(Restrictions.eq("code","IT")) .list(); but I get the error message org.hibernate.QueryException: could not resolve property: country of: Employee
has answer: http://stackoverflow.com/a/26765791
type: AnsweredQuestion
tagged with: join
tagged with: java
tagged with: hibernate

mysql
tags question: http://stackoverflow.com/q/26744914
tags question: http://stackoverflow.com/q/26814293
tags question: http://stackoverflow.com/q/26678963
tags question: http://stackoverflow.com/q/26769989
tags question: http://stackoverflow.com/q/26728805
tags question: http://stackoverflow.com/q/26787761
tags question: http://stackoverflow.com/q/26745082
tags question: http://stackoverflow.com/q/26761157
tags question: http://stackoverflow.com/q/26711094
tags question: http://stackoverflow.com/q/26800618
tags question: http://stackoverflow.com/q/26755397
tags question: http://stackoverflow.com/q/26743258
tags question: http://stackoverflow.com/q/26673676
tags question: http://stackoverflow.com/q/26813889
tags question: http://stackoverflow.com/q/26794011
tags question: http://stackoverflow.com/q/26729067
tags question: http://stackoverflow.com/q/26722875
tags question: http://stackoverflow.com/q/26718200
tags question: http://stackoverflow.com/q/26751633
tags question: http://stackoverflow.com/q/26693470
tags question: http://stackoverflow.com/q/26757660
tag name: mysql
tags question: http://stackoverflow.com/q/26776904
tags question: http://stackoverflow.com/q/26769908
tags question: http://stackoverflow.com/q/26698774
tags question: http://stackoverflow.com/q/26725538
tags question: http://stackoverflow.com/q/26783755
tags question: http://stackoverflow.com/q/26775678
tags question: http://stackoverflow.com/q/26721835
tags question: http://stackoverflow.com/q/26779059
tags question: http://stackoverflow.com/q/26708178
tags question: http://stackoverflow.com/q/26687552
tags question: http://stackoverflow.com/q/26828909
tags question: http://stackoverflow.com/q/26754178
tags question: http://stackoverflow.com/q/26743073
tags question: http://stackoverflow.com/q/26790722
tags question: http://stackoverflow.com/q/26723753
tags question: http://stackoverflow.com/q/26680829
tags question: http://stackoverflow.com/q/26700304
tags question: http://stackoverflow.com/q/26770669
tags question: http://stackoverflow.com/q/26792363
tags question: http://stackoverflow.com/q/26750895
tags question: http://stackoverflow.com/q/26794073
tags question: http://stackoverflow.com/q/26714110
tags question: http://stackoverflow.com/q/26688104
tags question: http://stackoverflow.com/q/26689668
tags question: http://stackoverflow.com/q/26761436
tags question: http://stackoverflow.com/q/26804040
tags question: http://stackoverflow.com/q/26825796
tags question: http://stackoverflow.com/q/26748055
tags question: http://stackoverflow.com/q/26767073
tags question: http://stackoverflow.com/q/26718078
tags question: http://stackoverflow.com/q/26815807
tags question: http://stackoverflow.com/q/26725177
tags question: http://stackoverflow.com/q/26711486
tags question: http://stackoverflow.com/q/26721704
tags question: http://stackoverflow.com/q/26774684
tags question: http://stackoverflow.com/q/26828331
tags question: http://stackoverflow.com/q/26720684
tags question: http://stackoverflow.com/q/26759435
tags question: http://stackoverflow.com/q/26729559
tags question: http://stackoverflow.com/q/26721478
tags question: http://stackoverflow.com/q/26698571
tags question: http://stackoverflow.com/q/26712230
tags question: http://stackoverflow.com/q/26740615
tags question: http://stackoverflow.com/q/26819846
tags question: http://stackoverflow.com/q/26716969
tags question: http://stackoverflow.com/q/26701101
tags question: http://stackoverflow.com/q/26794304
tags question: http://stackoverflow.com/q/26732899
tags question: http://stackoverflow.com/q/26788245
tags question: http://stackoverflow.com/q/26760759
tags question: http://stackoverflow.com/q/26770083
tags question: http://stackoverflow.com/q/26742936
type: Tag
tags question: http://stackoverflow.com/q/26810900
tags question: http://stackoverflow.com/q/26764820
tags question: http://stackoverflow.com/q/26678215
tags question: http://stackoverflow.com/q/26751307
tags question: http://stackoverflow.com/q/26797717

http://stackoverflow.com/comment/42090205
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26752747
has text: Your problem is that you dont know about java web projet, so you have to search how to run one java web projet, if you projet is only the source code (*.java) you have to compile it, if is already compile you have to run it in some java ee wrapper like tomcat/jetty... you can find a lots of this information in the web. And normally you have the instruction of what to do with the projet, so search README or something like that in the projet or in the page where did you found the projet
score: 0

http://stackoverflow.com/comment/42224349
type: Comment
has text: Not quite _just syntax sugar_. In Java, a lambda is more efficient than creating an anonymous class.
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/26828325

http://stackoverflow.com/q/26691959
type: UnansweredQuestion
tagged with: plugins
tagged with: classloader
has answer: http://stackoverflow.com/a/26696177
type: Question
tagged with: java
has title: Unable to load classes in a jar file
score: 0
has body: I am currently working on a project that is designed to accept plugins. In order to load the plugins from their jar file, I am using a ClassLoader. This is the code that I am using to load the plugins. URLClassLoader loader = URLClassLoader.newInstance(new URL[] {pluginJar.toURI().toURL()}, this.getClass().getClassLoader()); try { Class&lt;?&gt; clazz= Class.forName("msciplugin.PluginDriver", true, loader); Constructor&lt;?&gt; constructor=clazz.getConstructor(ProgramManager.class); MSCIPlugin plugin=(MSCIPlugin) constructor.newInstance(programManager); plugins.add(plugin); plugin.addMSCIPluginListener(this); this.pluginAdded(plugin); } catch (Exception e) { e.printStackTrace(); return false; } loader.close(); When I run the program, I am able to load the test plugin that I created, but later in the program, I ask the plugin to perform an operation, which uses a class from the plugin jar that was not used initially. The program then throws a NoClassDefFoundError caused by ClassNotFoundException Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: msciplugin/TimeUtils at msciplugin.ServerControllerConfigurationWindow.refreashEditor(ServerControllerConfigurationWindow.java:195) at msciplugin.ServerControllerConfigurationWindow.valueChanged(ServerControllerConfigurationWindow.java:299) at javax.swing.JList.fireSelectionValueChanged(Unknown Source) at javax.swing.JList$ListSelectionHandler.valueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source) at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source) at javax.swing.DefaultListSelectionModel.setSelectionInterval(Unknown Source) at javax.swing.JList.setSelectionInterval(Unknown Source) at javax.swing.plaf.basic.BasicListUI$Ha…
answer count: 1
linked to: http://stackoverflow.com/q/15720822

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

http://stackoverflow.com/a/26820532
type: Answer
upvote count: 6
has body: So after a little testing with: Jersey 1.18.1 (with jersey-json-1.18.1 for JSON support) Jersey 2.13 (with jersey-media-json-jackson-2.13 for JSON support) Jersey 2.13 (with jersey-media-moxy-2.13 for JSON support) The last test (jersey-media-moxy-2.13) was the only one to produce this exact output { "books": { "entry": [ { "key": "54567bbce4b0e0ef9379993e", "value": "BookSummary{id='54567bbde4b0e0ef9379993f', title='title 1', authors=[Steve,James] } BookSummary{id='54567bd9e4b0e0ef93799940', title='Title 2', authors=[Simon, Austin]}" } ] } } That being said, I'll make the assumption you're using a Jersey 2.x version. I'm not sure if there is any configuration in MOXy to better support this use case, but to make things easy, just add the following dependency, and get rid of the MOXy org.glassfish.jersey.media jersey-media-json-jackson ${jersey-version} With this, you will get the correct JSON output { // BookOfFriendsAnswer object "books": { // Map<String, List<BookSummary>> books "randomKey": [ // String (key) , List<BookSummary> (value) { // BookSummary object "id": "54567bbde4b0e0ef9379993f", "title": "Title 1", "authors": ["Steve", "James"] } ] } } Simple Test Resource method @GET @Produces(MediaType.APPLICATION_JSON) public Response getResponse() { BookOfFriendsAnswer books = new BookOfFriendsAnswer(); String id = "randomKey"; <===== Not sure if you want the key to be the BookSummary id BookSummary summary = new BookSummary(); summary.setId(id); summary.setTitle("Title 1"); summary.getAuthors().add("Steve"); summary.getAuthors().add("James"); List<BookSummary> summaries = new ArrayList<>(); summaries.add(summary); books.getBooks().put("randomKey", summaries); return Response.ok(books).build(); } Test With ObjectMapper @Test public void testGetIt() throws Exception { String responseMsg = target.path("book").request().get(String.class); ObjectMapper mapper = new ObjectMapper(); BookOfFriendsAnswer books = mapper.readValue( responseMsg, BookOfFriendsAnswer.class);…
has comment: http://stackoverflow.com/comment/42222752
score: 6
accepted answer of: http://stackoverflow.com/q/26818492
answers question: http://stackoverflow.com/q/26818492
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26762038
has body: I have this regex example at this link: http://regexr.com/39rr0 Text input: 1. This camera support Monochrome, Neutral, Standard, Landscape and Portrait! Expected Output on string replace using this regex: 1 This camera support Monochrome Neutral Standard Landscape and Portrait I'm trying to remove punctuation which comes after words so I get only the words without it. My regex is (([\S]+)(,|:|;|\?|!)) and it matches fine in that regex editor. However when I do string.replace( (([\S]+)(,|:|;|\?|!)), "") or even string.find( (([\S]+)(,|:|;|\?|!)) ) it finds nothing. What's the regex to do this? Is my regex broken or am I using it incorrectly.
possible better answer: http://stackoverflow.com/a/26762112
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26762112
downvote count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/26762166
has title: regex - match punctuation at end of word in Java/Scala String
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26762174
accepted answer: http://stackoverflow.com/a/26762174
upvote count: 2
favorite count: 0
answer count: 3
tagged with: regex

http://stackoverflow.com/a/31414217
has comment: http://stackoverflow.com/comment/50817936
type: Answer
answers question: http://stackoverflow.com/q/26753414
has body: You can try minuteproject check the documentation. MinuteProject 4 JPA2 generates: JPA2 entities with annotations, embeddedId classes for composite key. The entities can be generated in java or in groovy. JPA2 metamodel associated to entities to enable the user to build compilable queries. Enumeration Other maven pom.xml, querydsl integration...
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/q/26819261
score: -4
has comment: http://stackoverflow.com/comment/42208288
type: Question
has body: I have been fighting with this for quite a while and in th eend I took all the errors away but I do not seem to be able to get why the last two errors appear. Here are the errors: I keep getting these: java:101: error: while expected } java:102: error: reached end of file while parsing } { BufferedReader bReader = new BufferedReader (new InputStreamReader (System.in)); String people; int tickets; // here we start setting all the variables char ticketloop; double price; String movie, surname; price = 20.00; tickets = 0; Scanner sc = new Scanner(System.in); { System.out.println("Please enter surname of patron: "); Scanner surnameScan = new Scanner(System.in); surname = surnameScan.nextLine(); } { System.out.println("Please enter name of the show: "); Scanner movieScan = new Scanner(System.in); movie = movieScan.nextLine(); } { System.out.println("Please enter number of people: "); int x= Integer; parseInt (people); //converting people string into an integer people = bReader.readLine(); } { while(people &lt;0 || people &gt;10) { System.out.println("Wait, way to many people!"); // I just use this in case th euser puts more than 10 users Scanner peopleScan = new Scanner(System.in); people = peopleScan.nextLine(); // User Input } tickets = tickets + 1; // Adds 1 to counter if(people &gt;6) price=20.00-(20.00/100)*10; // Uses discount price if there are more than 6 people else price=20.00; // If less than 6, then does not use the discount System.out.println("Movie : " +movie); // Prints show name entered by user on the screen System.out.println("Surname : " +surname); // Prints the surname entered by user on the screen System.out.println("How many are you: " +people); // Prints the number of people entered by user on the screen if(people &gt;6) // If statement System.out.println("Final Price: " +price*people); // If number of people is bigger than 6 it prints out 10% DISCOUNT message and calculates total cost else // Else statement System.out.println("Final Price : " +pric…
has answer: http://stackoverflow.com/a/26819316
tagged with: java
has comment: http://stackoverflow.com/comment/42208330
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/42208310
has comment: http://stackoverflow.com/comment/42208281
favorite count: 0
has answer: http://stackoverflow.com/a/26821155
has comment: http://stackoverflow.com/comment/42208242
has title: Java Ticketing system error on last two lines
tagged with: parsing
has comment: http://stackoverflow.com/comment/42209754
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/42208280
type: UnansweredQuestion

jpa
tags question: http://stackoverflow.com/q/26677044
tags question: http://stackoverflow.com/q/26797060
tags question: http://stackoverflow.com/q/26750342
tags question: http://stackoverflow.com/q/26723277
tags question: http://stackoverflow.com/q/26689717
tags question: http://stackoverflow.com/q/26757486
tags question: http://stackoverflow.com/q/26806666
tags question: http://stackoverflow.com/q/26675483
tags question: http://stackoverflow.com/q/26684419
tags question: http://stackoverflow.com/q/26769989
tags question: http://stackoverflow.com/q/26780304
tags question: http://stackoverflow.com/q/26754881
tags question: http://stackoverflow.com/q/26750895
tags question: http://stackoverflow.com/q/26801901
tags question: http://stackoverflow.com/q/26721370
tags question: http://stackoverflow.com/q/26801731
tags question: http://stackoverflow.com/q/26783852
tags question: http://stackoverflow.com/q/26709967
tags question: http://stackoverflow.com/q/26717257
tags question: http://stackoverflow.com/q/26748055
tags question: http://stackoverflow.com/q/26726544
tags question: http://stackoverflow.com/q/26801632
tags question: http://stackoverflow.com/q/26718078
tags question: http://stackoverflow.com/q/26747098
tags question: http://stackoverflow.com/q/26778706
tags question: http://stackoverflow.com/q/26767064
tags question: http://stackoverflow.com/q/26711486
tags question: http://stackoverflow.com/q/26677400
tags question: http://stackoverflow.com/q/26780035
tags question: http://stackoverflow.com/q/26763213
tags question: http://stackoverflow.com/q/26732775
tags question: http://stackoverflow.com/q/26823283
tags question: http://stackoverflow.com/q/26807530
tags question: http://stackoverflow.com/q/26792363
tags question: http://stackoverflow.com/q/26696275
tags question: http://stackoverflow.com/q/26747473
tags question: http://stackoverflow.com/q/26810900
tags question: http://stackoverflow.com/q/26773939
type: Tag
tags question: http://stackoverflow.com/q/26789225
tags question: http://stackoverflow.com/q/26781201
tags question: http://stackoverflow.com/q/26767232
tags question: http://stackoverflow.com/q/26809308
tags question: http://stackoverflow.com/q/26709176
tags question: http://stackoverflow.com/q/26826033
tags question: http://stackoverflow.com/q/26782583
tags question: http://stackoverflow.com/q/26828270
tags question: http://stackoverflow.com/q/26733141
tags question: http://stackoverflow.com/q/26725011
tags question: http://stackoverflow.com/q/26751922
tags question: http://stackoverflow.com/q/26787231
tags question: http://stackoverflow.com/q/26790571
tags question: http://stackoverflow.com/q/26741762
tags question: http://stackoverflow.com/q/26777843
tags question: http://stackoverflow.com/q/26730047
tags question: http://stackoverflow.com/q/26758301
tags question: http://stackoverflow.com/q/26798182
tags question: http://stackoverflow.com/q/26673409
tags question: http://stackoverflow.com/q/26743505
tags question: http://stackoverflow.com/q/26674556
tags question: http://stackoverflow.com/q/26713197
tags question: http://stackoverflow.com/q/26709314
tags question: http://stackoverflow.com/q/26677310
tags question: http://stackoverflow.com/q/26761870
tags question: http://stackoverflow.com/q/26762559
tags question: http://stackoverflow.com/q/26680604
tags question: http://stackoverflow.com/q/26719731
tag name: jpa
tags question: http://stackoverflow.com/q/26748640
tags question: http://stackoverflow.com/q/26765175
tags question: http://stackoverflow.com/q/26832100
tags question: http://stackoverflow.com/q/26713576
tags question: http://stackoverflow.com/q/26832235
tags question: http://stackoverflow.com/q/26782535
tags question: http://stackoverflow.com/q/26780801
tags question: http://stackoverflow.com/q/26764532
tags question: http://stackoverflow.com/q/26698788
tags question: http://stackoverflow.com/q/26795436
tags question: http://stackoverflow.com/q/26727478
tags question: http://stackoverflow.com/q/26827287

http://stackoverflow.com/comment/42102250
has text: possible duplicate of [Map of Maps data structure](http://stackoverflow.com/questions/3093718/map-of-maps-data-structure)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26760453

http://stackoverflow.com/comment/41991524
comment on: http://stackoverflow.com/q/26698707
has text: In C++ many things of what you wrote don't make sense. You're probably getting downvotes because you've added totally different and unrelated tags without having studied the differences yourself first.
type: Comment
type: QuestionComment
score: 5

http://stackoverflow.com/q/26740262
has title: Primefaces ConfirmDialog not vertically centered in form updated with ajax
tagged with: http://stackoverflow.com/tag/html
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a form that "grows" through Ajax+Rendered when some operations are clicked. The problem is that my p:confirmDialog is not vertically centered when the form grows. When in "normal size", the dialog is correctly centered. I have already tried: Remove or add "appendToBody" attribute Change the position of the declaration in the page (before and after h:form) Overwrite the "Top" in CSS Is that an issue from Primefaces (currently using v4) or am I doing something wrong? Since I use lots of "rendered" attributes, should I "rerender" the dialog? Here follows a snippet of my code. &lt;h:form id="myForm"&gt; &lt;p:fieldset legend="Hello"&gt; &lt;!-- lots of things here --&gt; &lt;/p:fieldset&gt; &lt;p:spacer height="20px" /&gt; &lt;p:fieldset legend="Dashboard" id="thisOneMakesTheFormGrows" rendered="#{bean.include or bean.edit}"&gt; &lt;!-- this one has lots of items, making the page grow when the 'rendered' attribute is true --&gt; &lt;/p:fieldset&gt; &lt;/h:form&gt; &lt;p:confirmDialog global="true" id="meuConfirmDlg" appendToBody="true" showEffect="fade" width="500px" hideEffect="fade" widgetVar="confirmDlg" closable="false"&gt; &lt;p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" /&gt; &lt;p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" /&gt; &lt;/p:confirmDialog&gt;
accepted answer: http://stackoverflow.com/a/27121579
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: primefaces
has answer: http://stackoverflow.com/a/27121579

http://stackoverflow.com/q/26765020
has answer: http://stackoverflow.com/a/26765097
tagged with: java
has comment: http://stackoverflow.com/comment/42110936
accepted answer: http://stackoverflow.com/a/26765097
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has body: My problem is that this won't work: if (result.equals("success")) { Toast.makeText(MainActivity.myContext, "Hausaufgabe eingetragen!", Toast.LENGTH_LONG).show(); startSync(lv); } else if (result.equals("already exists")) { Toast.makeText(MainActivity.myContext, "Hausaufgabe wurde bereits eingetragen!", Toast.LENGTH_LONG).show(); } else if (result.equals("user not exists")){ Toast.makeText(MainActivity.myContext, "Das eingespeicherte Benutzerkonto ist ungültig oder gelöscht worden!", Toast.LENGTH_LONG).show(); } else if (result.equals("server problem")){ Toast.makeText(MainActivity.myContext, "Ein Server Problem ist aufgetreten!\n" + "Bitte melden!", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.myContext, "Unbekannte Rückmeldung des Servers:\n" + result, Toast.LENGTH_LONG).show(); } Log.d("API",result); LogCat says API:success, but feedback in the app is "Unbekannte Rückmeldung des Servers: success"
has title: String.equals() won't work
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42111269

http://stackoverflow.com/comment/42045309
comment on: http://stackoverflow.com/a/26702297
type: AnswerComment
type: Comment
has text: A bounty it is then, sorry I couldn't help more
score: 1

http://stackoverflow.com/q/26706792
score: 0
has comment: http://stackoverflow.com/comment/42006906
has body: I am designing a race game. There is a list of question each user needs to answer in this game. I have two types of questions. The first one is multiple choice question. This question contains a list of choice, and each choice is a String. The other is searching question. This type of question has only one correct answer, which is type of Country. We will display a map and let user to find the correct country. public class Country { String countryName; LatLng ll; } These two types of questions will be mixed together and display as a list to each user. If the question displayed to user is a multiple choice questions, we will show a list of choices and let user to select; If user sees a searching question, then s/he is required to search the corresponding country on a map. There are two types of answer here, String and Country. Here are my questions: Should I design two type classes for each question, MCQuestion and SearchingQuestion, and let them extend the same abstract class Question? public abstract class Question { String questionText; } How to design each type of question. I need methods to return the correct answer and check whether one input is correct or not? Should I also design two types answer for each type of answer?
answer count: 1
has title: Design Pattern: how to decide the pattern of q/a race game
has answer: http://stackoverflow.com/a/26707279
type: UnansweredQuestion
tagged with: design-patterns
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42006528
has comment: http://stackoverflow.com/comment/42006404

http://stackoverflow.com/comment/42059157
type: Comment
type: QuestionComment
has text: I tried using real device, and still same error + My emulator supports GL2.0
comment on: http://stackoverflow.com/q/26721442
score: 0

http://stackoverflow.com/q/26823156
has comment: http://stackoverflow.com/comment/42225726
has body: I have a problem with Android. I want to open file, check it and just return a simple value. public void setMessageCode(String code){ try { messageCode = setMsg(code); } catch (IOException e) { e.printStackTrace(); } } public String setMsg(String messageCode) throws IOException{ String FILE = "src/dialogs.txt", msg; BufferedReader in = new BufferedReader(new FileReader(FILE)); //IO Exception here msg = in.readLine(); while(msg!=null){ message = msg.split(","); for(int i=0; i&lt;message.length; i++) if(message[i].equals(messageCode)){ in.close(); return message[i++]; } msg = in.readLine(); } in.close(); return "Nothing to get"; } So Eclipse don`t see the problem and work perfect. ADT failed. Dialogs.txt is in src/... and I checked this milion of times. What to do?
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26823849
tagged with: java
tagged with: adt
has comment: http://stackoverflow.com/comment/42215975
tagged with: eclipse
has title: How to read files in Android Assets
answer count: 3
possible better answer: http://stackoverflow.com/a/26827366
score: 0
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/26823483
accepted answer: http://stackoverflow.com/a/26823849
has answer: http://stackoverflow.com/a/26827366

throws
tags question: http://stackoverflow.com/q/26722639
tag name: throws
type: Tag

http://stackoverflow.com/q/26797574
tagged with: java
has comment: http://stackoverflow.com/comment/42171253
type: Question
accepted answer: http://stackoverflow.com/a/26797670
has comment: http://stackoverflow.com/comment/42169266
has title: Big double number up to two decimal places
upvote count: 0
has comment: http://stackoverflow.com/comment/42169289
downvote count: 5
has comment: http://stackoverflow.com/comment/42169430
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/42169299
has comment: http://stackoverflow.com/comment/42169329
favorite count: 0
has comment: http://stackoverflow.com/comment/42170888
has body: I want to round a double value upto 2 decimal places - double d = 1.13452289575668E8; DecimalFormat f = new DecimalFormat("##.00"); System.out.println(f.format(d)); OUTPUT: 113452289.58 double d = 2.34568; DecimalFormat f = new DecimalFormat("##.00"); System.out.println(f.format(d)); OUTPUT: 2.35 So how can I get the double number like 1.13452289575668E8 to correctly display upto 2 decimal places ?
tagged with: double
has answer: http://stackoverflow.com/a/26797670
has comment: http://stackoverflow.com/comment/42169218
has comment: http://stackoverflow.com/comment/42169293
has comment: http://stackoverflow.com/comment/42169283
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42169342
score: -5
tagged with: numbers

http://stackoverflow.com/comment/42228325
score: 0
type: Comment
type: AnswerComment
has text: I would argue that it's not for the throwing class to decide how an exception is handled. The whole point is that some general IO class might declare that it throws an `IOException`. A class that handles renaming files, for example, might throw a `FileNotFoundException`.
comment on: http://stackoverflow.com/a/26829959

http://stackoverflow.com/a/26751713
has comment: http://stackoverflow.com/comment/135103254
downvote count: 0
answers question: http://stackoverflow.com/q/26751627
type: Answer
has comment: http://stackoverflow.com/comment/135088945
upvote count: 1
has comment: http://stackoverflow.com/comment/128620917
score: 1
has body: JNI doesn't have anythung to do with it. The variable is there in the .cpp file, the C++ function uses it, it compiles and links, period.

http://stackoverflow.com/comment/42106557
score: 0
type: Comment
type: QuestionComment
has text: I increase the wait time, it's working fine now. Thanks Rishi.
comment on: http://stackoverflow.com/q/26673319

http://stackoverflow.com/q/26778279
tagged with: key
has comment: http://stackoverflow.com/comment/42134520
has comment: http://stackoverflow.com/comment/42135960
has comment: http://stackoverflow.com/comment/42134497
type: UnansweredQuestion
has body: How do I print out the corresponding key of the value in that map? I don't think there's a getKey() method for a HashMap. Map &lt;Integer, String &gt; map1 = new HashMap &lt;Integer, String&gt; (); map1.put(7,"GREAT"); map1.put(8,"Try Again!"); if (map1.containsValue("GREAT")){ System.out.println(WHAT DO I PUT HERE?); }
tagged with: dictionary
linked to: http://stackoverflow.com/q/1383797
tagged with: java
duplicate of: http://stackoverflow.com/q/1383797
type: Question
has answer: http://stackoverflow.com/a/26778586
has title: How do I get out the corresponding key of the value in that HashMap?
has comment: http://stackoverflow.com/comment/42135934
score: 0
answer count: 1

http://stackoverflow.com/comment/42013519
type: Comment
type: QuestionComment
score: 0
has text: I guess, it’s because Eclipse’s Java 8 support will need some years to catch up with `javac` (and even `javac` is far away from being stable and bug free…).
comment on: http://stackoverflow.com/q/26700929

http://stackoverflow.com/q/26763975
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/26941309
has body: Write a program for finding duplicate parenthesis in a expression. For example : (( a + b ) + (( c + d ))) = a + b + c + d (( a + b ) * (( c + d ))) = (a + b) * (c + d) One approach that I am aware of involves the following two steps: Convert the given infix expression to postfix expression. Convert back the postfix to infix I don't want to do this entire process of converting from one representation to another, and then convert it back. I want to do this using stack(s) but in a single pass. Is it possible ? Please suggest an algorithm or share the code.
answer count: 5
has title: Removing unnecessary/duplicates parentheses from arithmetic expressions using stack(s)
has comment: http://stackoverflow.com/comment/42411104
accepted answer: http://stackoverflow.com/a/26941309
type: AnsweredQuestion
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/42393356
has answer: http://stackoverflow.com/a/27020659
has answer: http://stackoverflow.com/a/26930747
type: Question
has answer: http://stackoverflow.com/a/27051016
possible better answer: http://stackoverflow.com/a/27020659
tagged with: data-structures
linked to: http://stackoverflow.com/q/4589951
has answer: http://stackoverflow.com/a/27045314
has comment: http://stackoverflow.com/comment/42567123
has comment: http://stackoverflow.com/comment/42558621

http://stackoverflow.com/comment/42017557
type: AnswerComment
comment on: http://stackoverflow.com/a/26705442
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64169/discussion-between-dermetfan-and-parampalp).
type: Comment
score: 0

http://stackoverflow.com/q/26822266
answer count: 2
tagged with: javafx-8
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/33888152
tagged with: equinox
tagged with: osgi
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26824662
accepted answer: http://stackoverflow.com/a/26824662
tagged with: eclipse
has title: How to build java desktop application runtime modular?
type: Question
has answer: http://stackoverflow.com/a/33888152
has body: I have a java desktop application and I want to add plugin/addons support feature to my app After search I see Blender3D addons is very nice just copy some file to Blender directory and enable it on preferences window then that addons can add new engine, menu, button and panel and ..... I like this style and want to have something like this in my app to develop it just with plugin after release the main application I find OSGi but can't understand how to use the plugin created with this feature in my main app?! and also I don't want to use Eclipse RCP or Netbeans RCP, I want to add this feature to my current main application that use javafx for gui. thanks,
has comment: http://stackoverflow.com/comment/42221410

http://stackoverflow.com/comment/42052558
comment on: http://stackoverflow.com/q/26731723
type: QuestionComment
type: Comment
has text: @kiheru Bum, then create a callback interface to act as bridge...
score: 0

http://stackoverflow.com/comment/42155453
type: Comment
comment on: http://stackoverflow.com/a/26789590
has text: Careful with this approach, because people tend to do `List<Whatever> list = ...; for(Whatever w : list) { ... }` and you may encounter with `NullPointerException`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26789739
has body: I'm developing Android application, where to phones performing some computation over Wifi-Direct. In my case efficiency is critical. Bottleneck of my protocol is a network. I use SocketChannel to receive/transmit data. Here is my pseudo-code: byte[] array = new byte[]{20,20,20,20,20,20,20,20,20,20}; for (int i=0; i&lt;10; i++) { ByteBuffer sendBB = ByteBuffer.allocate(buffSize); sendBB.put(array, 0, array.length); sendBB.rewind(); ByteBuffer receiveBB = ByteBuffer.allocate(buffSize); try { socketChannel.read(receiveBB); socketChannel.write(sendBB); byte[] received = new byte[10]; receiveBB.rewind(); receiveBB.get(received, 0, 10); Log.i("Received", Arrays.toString(received)); } catch (IOException e) { e.printStackTrace(); } } Similar code is for other party. Connection is created like this: serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.socket().bind(socketAddress); socketChannel = serverSocketChannel.accept(); It turned out, that everything is transmitted well, when buffSize is small : 100, 200. When it is 500 and higher I have a data loss. I receive something like: [20,20,20,20,20,20,20,20,20,20] [0,0,0,0,0,0,0,0,0,0] [20,20,20,20,20,20,20,20,20,20] [20,20,20,20,20,20,20,20,20,20] [0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0] [20,20,20,20,20,20,20,20,20,20] [20,20,20,20,20,20,20,20,20,20] [20,20,20,20,20,20,20,20,20,20] [20,20,20,20,20,20,20,20,20,20] Higher buffer gives way higher speed. Is there a way, how to keep a speed and prevent data loss? Thank you
tagged with: android
has answer: http://stackoverflow.com/a/26809677
score: 0
has title: Data loss during high speed transfer over SocketChannel
type: Question
type: AnsweredQuestion
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/26809677
tagged with: java
tagged with: socketchannel
tagged with: nio
possible better answer: http://stackoverflow.com/a/26790576
answer count: 2
has answer: http://stackoverflow.com/a/26790576

http://stackoverflow.com/a/26812458
has body: Although the answer by jrahhali is correct. My version scales nicely if you chose to add more than 2 fraction. int comd = denom1 * denom2; int answer = (comd/denom1 * nom1) + (comd/denom2 * nom2); System.out.println(nom1 + "/" + denom1 + " + " + nom2 + "/" + denom2 + " = " + answer + "/" + comd); This is because I don't skip the division like he does.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26812131
downvote count: 0
score: 1

http://stackoverflow.com/q/26797296
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/28767266
has title: RTC 4.0.5 extension in a Delivery action
type: Question
tagged with: rational-team-concert
has answer: http://stackoverflow.com/a/28767316
answer count: 3
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/28767412
has body: I am programming an extension for analyzing files in an deliver changesets to a stream. It is an Advisor because if the analyze fails then you can't deliver anything. In addition I have read the articles: https://jazz.net/library/article/1000 https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ https://jazz.net/wiki/bin/view/Main/CustomPreconditionsTable But I have some doubts yet. I have created a plugin project with extension point ID: com.ibm.team.scm.server.deliver and a java class, but I don't know how to get the path of the files included in the deliver for analyzing them: import org.eclipse.core.runtime.IProgressMonitor; import com.ibm.team.process.common.IProcessConfigurationElement; import com.ibm.team.process.common.advice.AdvisableOperation; import com.ibm.team.process.common.advice.IAdvisorInfoCollector; import com.ibm.team.process.common.advice.runtime.IOperationAdvisor; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.repository.service.AbstractService; public class CheckBadCharacterAdvisor extends AbstractService implements IOperationAdvisor{ @Override public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException { Object data = operation.getOperationData(); // what else here? } } How could I get the change sets included in the delivery? or What javadoc or steps do you follow for getting this information?
favorite count: 0

http://stackoverflow.com/comment/42047930
score: 0
type: Comment
type: QuestionComment
has text: ^You also need to worry about signed vs. unsigned PCM and a working knowledge of 2's complement to do the correct conversions.
comment on: http://stackoverflow.com/q/26729926

http://stackoverflow.com/q/26721881
tagged with: struts-tags
has answer: http://stackoverflow.com/a/26846877
has answer: http://stackoverflow.com/a/26723556
type: Question
has body: I have a dropdown list that needs to be populated using Struts 2 <s:select> tag. <s:select label="Country" headerKey="-1" headerValue="Select Country" list="countries" listKey="key" listValue="label" name="searchForm.custCountry"/> in my action class I have the following declaration followed by getters and setters. ArrayList<DropDown> countries = new ArrayList<DropDown>(); I got the below exception. Where is the mistake? SEVERE: Servlet.service() for servlet jsp threw exception tag 'select', field 'list', name 'searchForm.custCountry': The requested list key 'countries' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] at org.apache.struts2.components.Component.fieldError(Component.java:240) at org.apache.struts2.components.Component.findValue(Component.java:333) at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80) at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105) at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:902) at org.apache.struts2.components.UIBean.end(UIBean.java:544) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) at org.apache.jsp.accountSearchDtls_jsp._jspx_meth_s_005fselect_005f0(accountSearchDtls_jsp.java:979) at org.apache.jsp.accountSearchDtls_jsp._jspx_meth_s_005fdiv_005f0(accountSearchDtls_jsp.java:935) at org.apache.jsp.accountSearchDtls_jsp._jspService(accountSearchDtls_jsp.java:521) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.i…
tagged with: struts2
score: 0
answer count: 2
tagged with: jsp
tagged with: drop-down-menu
type: UnansweredQuestion
has title: The requested list key 'countries' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}
tagged with: java
has comment: http://stackoverflow.com/comment/42033751

http://stackoverflow.com/a/26686763
downvote count: 1
has body: Please see this link. Try to increase your size more upto 1000 that depends on ur size http://help.hannonhill.com/kb/common-error-messages/mysql-packet-for-query-is-too-large Also refer this link to get an idea http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html
answers question: http://stackoverflow.com/q/26686735
type: Answer
score: 1
upvote count: 2

http://stackoverflow.com/a/26824050
has body: As far as I know the Calendar class and all derived from it return the date using the get(). See the documentation for this class. Also here is an example taken from here: SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd HH:mm:ss"); Calendar calendar = new GregorianCalendar(2013,1,28,13,24,56); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); // Jan = 0, dec = 11 int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR); int weekOfMonth= calendar.get(Calendar.WEEK_OF_MONTH); int hour = calendar.get(Calendar.HOUR); // 12 hour clock int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); // 24 hour clock int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); int millisecond= calendar.get(Calendar.MILLISECOND); System.out.println(sdf.format(calendar.getTime())); System.out.println("year \t\t: " + year); System.out.println("month \t\t: " + month); System.out.println("dayOfMonth \t: " + dayOfMonth); System.out.println("dayOfWeek \t: " + dayOfWeek); System.out.println("weekOfYear \t: " + weekOfYear); System.out.println("weekOfMonth \t: " + weekOfMonth); System.out.println("hour \t\t: " + hour); System.out.println("hourOfDay \t: " + hourOfDay); System.out.println("minute \t\t: " + minute); System.out.println("second \t\t: " + second); System.out.println("millisecond \t: " + millisecond); which outputs 2013 Feb 28 13:24:56 year : 2013 month : 1 dayOfMonth : 28 dayOfWeek : 5 weekOfYear : 9 weekOfMonth : 5 hour : 1 hourOfDay : 13 minute : 24 second : 56 millisecond : 0 I think it was replaced because the new way offers a much simpler handling using a single function, which is much easier to remember.
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26824020
upvote count: 4

http://stackoverflow.com/q/26737852
linked to: http://stackoverflow.com/q/13465098
has body: I have written a java program that is supposed to convert decimals from 1 to 256 to hexadecimal but the problem comes when i try decimals above 256 after which i start getting incorrect results. Here is a my code: public class Conversion { public static void main(String[] args) { System.out.printf("%s%14s", "Decimal", "Hexadecimal"); for(int i = 1; i &lt;= 300; i++) { System.out.printf("%7d ", i); decimalToHex(i); System.out.println(); } } private static void decimalToHex(int decimal) { int count; if(decimal &gt;= 256) { count = 2; } else { count = 1; } for (int i = 1; i &lt;= count; i++) { if(decimal &gt;= 256) { returnHex(decimal / 256); decimal %= 256; } if(decimal &gt;= 16) { returnHex(decimal / 16); decimal %= 16; } returnHex(decimal); decimal /= 16; } } private static void returnHex(int number) { switch(number) { case 15: System.out.print("F"); break; case 14: System.out.print("E"); break; case 13: System.out.print("D"); break; case 12: System.out.print("C"); break; case 11: System.out.print("B"); break; case 10: System.out.print("A"); break; default: System.out.printf("%d", number); break; } } } This is the sample of the results that i got: 254 FE 255 FF 256 100 257 111 264 199 266 1AA 271 1FF 272 1100 273 1111 Note: I have just started learning java so keep it simple if you can. Thank you
has answer: http://stackoverflow.com/a/26738104
favorite count: 0
has answer: http://stackoverflow.com/a/26738143
type: Question
has comment: http://stackoverflow.com/comment/42061984
has comment: http://stackoverflow.com/comment/42065332
answer count: 6
has answer: http://stackoverflow.com/a/26738443
has title: Converting from decimal to hexadecimal
has comment: http://stackoverflow.com/comment/42073440
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42071263
has comment: http://stackoverflow.com/comment/42061860
has answer: http://stackoverflow.com/a/26738067
has answer: http://stackoverflow.com/a/26738642
score: 8
upvote count: 9
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42065170
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26737959
has comment: http://stackoverflow.com/comment/42072532

http://stackoverflow.com/comment/41956383
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26677044
has text: op: You'll have to persist it somewhere. Have a look at Alan Hay link.
score: 0

http://stackoverflow.com/a/26776534
score: 1
upvote count: 1
downvote count: 0
has body: Have a look at the flyway documentation! There is a very good example - even for Spring configuration. You can store the classes inside the specified db.migration package. According to the documentation, subpackages are also scanned by flyway.
answers question: http://stackoverflow.com/q/26775678
type: Answer

http://stackoverflow.com/a/26746316
score: 0
type: Answer
has body: You can get it as a char[] by using String.toCharArray() - char[] chars = str.toCharArray(); Or, you could get is as a String[] by using String.split(String) like, String str = "0123"; char[] chars = str.toCharArray(); System.out.println(Arrays.toString(chars)); String[] strings = str.split(""); System.out.println(Arrays.toString(strings)); Output is [0, 1, 2, 3] [0, 1, 2, 3]
answers question: http://stackoverflow.com/q/26746231

http://stackoverflow.com/a/26686365
has comment: http://stackoverflow.com/comment/41970686
type: Answer
has comment: http://stackoverflow.com/comment/41970756
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41970701
has comment: http://stackoverflow.com/comment/41970761
has comment: http://stackoverflow.com/comment/41970743
accepted answer of: http://stackoverflow.com/q/26686336
has body: You are missing removing the Handler callbacks in onDestroy() of Your Activity Add this line in your onDestroy() method myHandler.removeCallbacks(this);
answers question: http://stackoverflow.com/q/26686336
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41970594

http://stackoverflow.com/q/26768810
answer count: 2
accepted answer: http://stackoverflow.com/a/26780902
tagged with: scene
downvote count: 0
linked to: http://stackoverflow.com/q/16606162
linked to: http://stackoverflow.com/q/16680295
favorite count: 0
tagged with: javafx-8
linked to: http://stackoverflow.com/q/23229149
has answer: http://stackoverflow.com/a/26774402
has comment: http://stackoverflow.com/comment/42118689
has body: I've got a simple control that is nothing but a label and a VBox. The purpose is to inform the user of things in the program. I want to make it so that the label will scale with the scene properly. I have the methods in place to accomplish this task (I think, anyway): public void reScaleX(){ this.Message.setScaleX(( //Message is the Label Variables name. this.getWidth() - 40 //40 is the 20 + 20 padding given to the control. ) / this.Message.getBoundsInLocal().getWidth() ); } public void reScaleY(){ this.Message.setScaleY(( this.getHeight() - 40 //40 is the 20 + 20 padding given to the control. ) / this.Message.getBoundsInLocal().getHeight() ); } I add a listener to the controls Width and Height properties in the Initialize method: @Override public void initialize(URL location, ResourceBundle resources){ this.widthProperty().addListener(( ObservableValue&lt;? extends Number&gt; obsV, Number oldV, Number newV ) -&gt; this.reScaleX()); this.heightProperty().addListener(( ObservableValue&lt;? extends Number&gt; obsV, Number oldV, Number newV ) -&gt; this.reScaleY()); } But the problem is that it behaves oddly (Sometimes it will rescale, others it won't). I've also tried to add listeners to the height and width properties of the stage into which the control is being placed to make it rescale when the control resizes: this.PreviewStage.widthProperty().addListener(( ObservableValue&lt;? extends Number&gt; obsV, Number oldV, Number newV ) -&gt; this.PreviewPlaque.reScaleX() ); this.PreviewStage.heightProperty().addListener(( ObservableValue&lt;? extends Number&gt; obsV, Number oldV, Number newV ) -&gt; this.PreviewPlaque.reScaleY() ); But it's still not behaving correctly. I feel like I'm doing this wrong but I don't know how to do it right. What is the proper method for rescaling a control on a form like this? Is there a better method for achieving the result for which I am looking?
possible better answer: http://stackoverflow.com/a/26774402
upvote count: 1
has answer: http://stackoverflow.com/a/26780902
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
tagged with: rescale
has title: JavaFX : What is the proper method for scaling controls on a scene/stage/window?
type: Question

http://stackoverflow.com/a/26688134
has comment: http://stackoverflow.com/comment/41973661
has comment: http://stackoverflow.com/comment/41973483
has comment: http://stackoverflow.com/comment/41973751
score: 3
has comment: http://stackoverflow.com/comment/41973611
upvote count: 3
has body: First Problem You are trying to add a KeyListener to the frame. I don't see why you would need this. As I understand the question, when the user hits enter after typing, something should happen. You can accomplish this just by adding an ActionListener to the text field. As long as the field still has focus, this will work. And this is how you want it (for the field to have focus). So get rid of the KeyListener Second Problem Even if the KeyListener did work, you aren't even doing anything but adding a new listener to the component. So every time the key is pressed, all that's happening is another listener is added to the component... nothing else. Third Problem You need to revalidate and repaint the panel1 after any of the layout changes have been made panel1.revalidate(); panel1.repaint(); In Conclusion Get completely rid of the KeyListener (Delete it, and leave everything else the same - leaving the code inside the keypressed method) Revalidate and repaint the panel1 in both the ActionListeners and the ItemListener. This is all you need to get it to work Oh and you are missing a break in the 0 case case 0: { exL.setAlignment(FlowLayout.LEFT); break; } UPDATE User selects "Left" or "Right", types HGap and VGap, only after user presses enter, they change. You basically have to take out all the listeners we were just working on, and add a key binding to the content pane. You can see this post and use the same code. Just change the "LEFT" to "ENTER". And the doSomethingWhenLeftIsPressed() method you should just get the values from the combo box and fields and set the layout, all in one I'll post code here JPanel panel = (JPanel)frame.getContentPane(); InputMap imap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); imap.put(KeyStroke.getKeyStroke("ENTER"), "layoutAction"); ActionMap amap = panel.getActionMap(); Action leftAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { doSomethingWhenEnterIsPressed(); } }; amap.put("layoutAc…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41973619
type: Answer
accepted answer of: http://stackoverflow.com/q/26687780
has comment: http://stackoverflow.com/comment/41973648
downvote count: 0
answers question: http://stackoverflow.com/q/26687780
has comment: http://stackoverflow.com/comment/41973707

http://stackoverflow.com/a/26752091
answers question: http://stackoverflow.com/q/26752021
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26752021
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: Private fields are accessible from within the class, you cannot access them out of class for example:- class PrivateCons{ private PrivateCons(){ System.out.println("I'm executed"); } } public class Test{ public static void main(String[] args) { PrivateCons p=new PrivateCons(); //this will fail- compiler error PrivateCons q=new PrivateCons();//this will fail- compiler error } } Also Private constructors are mostly used for implementing Singleton Pattern , this is used when only one object of that class is needed. Taking an example from the wikipedia article in the link itself:- public class singleton { private static singleton _obj; private singleton() { // prevents instantiation from external entities } // Instead of creating new operator, declare a method // and that will create object and return it. public static singleton GetObject() { // Check if the instance is null, then it // will create new one and return it. // Otherwise it will return previous one. if (_obj == null) { _obj = new singleton(); } return _obj; } } You can extend this example and restrict your objects to 2,3 or any number, Or in other words restrciting number of instances of your class.
has comment: http://stackoverflow.com/comment/42101984
has comment: http://stackoverflow.com/comment/42088471

http://stackoverflow.com/comment/42159431
type: Comment
has text: a=3 and because 3 < -1 = FALSE, Your loop stops immediatelly.
score: 1
comment on: http://stackoverflow.com/q/26791913
type: QuestionComment

prepared-statement
tags question: http://stackoverflow.com/q/26721835
type: Tag
tags question: http://stackoverflow.com/q/26698914
tags question: http://stackoverflow.com/q/26735179
tags question: http://stackoverflow.com/q/26676527
tags question: http://stackoverflow.com/q/26709184
tag name: prepared-statement

javafx
tags question: http://stackoverflow.com/q/26682013
tags question: http://stackoverflow.com/q/26768523
tags question: http://stackoverflow.com/q/26811445
tags question: http://stackoverflow.com/q/26687918
tags question: http://stackoverflow.com/q/26677697
tags question: http://stackoverflow.com/q/26821319
tags question: http://stackoverflow.com/q/26688537
tags question: http://stackoverflow.com/q/26762905
tags question: http://stackoverflow.com/q/26819788
type: Tag
tags question: http://stackoverflow.com/q/26733720
tags question: http://stackoverflow.com/q/26677385
tags question: http://stackoverflow.com/q/26768955
tags question: http://stackoverflow.com/q/26709754
tags question: http://stackoverflow.com/q/26774309
tags question: http://stackoverflow.com/q/26715570
tags question: http://stackoverflow.com/q/26783723
tags question: http://stackoverflow.com/q/26795514
tags question: http://stackoverflow.com/q/26756224
tags question: http://stackoverflow.com/q/26787911
tags question: http://stackoverflow.com/q/26788965
tags question: http://stackoverflow.com/q/26730034
tags question: http://stackoverflow.com/q/26795483
tags question: http://stackoverflow.com/q/26788263
tags question: http://stackoverflow.com/q/26808261
tags question: http://stackoverflow.com/q/26679385
tags question: http://stackoverflow.com/q/26759284
tags question: http://stackoverflow.com/q/26674715
tag name: javafx
tags question: http://stackoverflow.com/q/26673829
tags question: http://stackoverflow.com/q/26823040
tags question: http://stackoverflow.com/q/26831978
tags question: http://stackoverflow.com/q/26752443
tags question: http://stackoverflow.com/q/26768497
tags question: http://stackoverflow.com/q/26774255
tags question: http://stackoverflow.com/q/26715454
tags question: http://stackoverflow.com/q/26829296
tags question: http://stackoverflow.com/q/26747657
tags question: http://stackoverflow.com/q/26823157
tags question: http://stackoverflow.com/q/26701005
tags question: http://stackoverflow.com/q/26740415
tags question: http://stackoverflow.com/q/26693246
tags question: http://stackoverflow.com/q/26806095
tags question: http://stackoverflow.com/q/26747386
tags question: http://stackoverflow.com/q/26803380
tags question: http://stackoverflow.com/q/26828708
tags question: http://stackoverflow.com/q/26690247
tags question: http://stackoverflow.com/q/26753018
tags question: http://stackoverflow.com/q/26753091
tags question: http://stackoverflow.com/q/26827367
tags question: http://stackoverflow.com/q/26712884
tags question: http://stackoverflow.com/q/26708481
tags question: http://stackoverflow.com/q/26781416
tags question: http://stackoverflow.com/q/26768529
tags question: http://stackoverflow.com/q/26760177
tags question: http://stackoverflow.com/q/26734001
tags question: http://stackoverflow.com/q/26751633
tags question: http://stackoverflow.com/q/26823191
tags question: http://stackoverflow.com/q/26768810
tags question: http://stackoverflow.com/q/26698200
tags question: http://stackoverflow.com/q/26732116
tags question: http://stackoverflow.com/q/26830490
tags question: http://stackoverflow.com/q/26794785
tags question: http://stackoverflow.com/q/26771972
tags question: http://stackoverflow.com/q/26673704
tags question: http://stackoverflow.com/q/26806595
tags question: http://stackoverflow.com/q/26786550
tags question: http://stackoverflow.com/q/26805966

http://stackoverflow.com/a/26789013
has comment: http://stackoverflow.com/comment/42155741
has comment: http://stackoverflow.com/comment/42155943
has comment: http://stackoverflow.com/comment/42155460
has comment: http://stackoverflow.com/comment/42155520
has comment: http://stackoverflow.com/comment/42157019
has body: The short answer is that you can't do it with .readLine(), because it strips off the end-of-line characters. You will need to use .read() instead, which will read in character by character, and do your own EOL processing. This returns an int, but you can cast it to a char: char c = (char)reader.read(); A CR/LF will come out as two separate characters, so you'll have to watch for that and process accordingly. If you know that your files will only have either CR/LF or just LF, then it's a little easier, because whenever you read a CR you know an LF is following straight behind. The bytes you're reading won't vary. You'll be reading them as UTF-8 by default, which will always encode CR and LF as single byte characters. In int terms, they'll come out as 13 and 10 respectively.
downvote count: 0
has comment: http://stackoverflow.com/comment/42154943
has comment: http://stackoverflow.com/comment/42155962
has comment: http://stackoverflow.com/comment/42154939
has comment: http://stackoverflow.com/comment/42155319
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42155095
answers question: http://stackoverflow.com/q/26788931
has comment: http://stackoverflow.com/comment/42154374
has comment: http://stackoverflow.com/comment/42154974
score: 1

http://stackoverflow.com/q/26803294
has answer: http://stackoverflow.com/a/26816787
has title: How to write a GWT CustomSerializer for XMLGregorianCalendar?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: serialization
type: UnansweredQuestion
score: 1
linked to: http://stackoverflow.com/q/20717811
upvote count: 1
type: Question
tagged with: gwt
tagged with: java
has body: I need a solution for serializing the XMLGregorianCalendar through RPC. I wrote a custom serializer for the XMLGregorianCalendar object so far, but the object to be serialized is the internal Xerxes implementation of the Calendar type (com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl). So my serializer fails miserably because it is not used. Writing a serializer for the internal object is not a good idea and produces warnings in eclipse, that the class is restricted (Access restriction: The type XMLGregorianCalendarImpl is not accessible due to restriction on required library C:\java\jre\lib\rt.jar). Did anyone ever manage to use this XMLGC with GWT successfully on the client side? Can I replace the XMLGC class in gwt.xml possibly and replace it by something different? Any help appreciated! UPDATE: Wanted to tell you what did not work so far: Added a Supersource path and replaced the XMLGC class with a much simpler class, only carrying the data elements. Added a custom serializer class for XMLGC to serialize XMLGC from/to the lightweight supersource class. The approach failed at runtime, as the object beeing transported is not a XMLGC, but a com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl, that is in a sealed package in the rt.jar. The approach to repeat the same steps for the XMLGCImpl failed for me, maybe because I am too stupid, maybe because the sealed package is hindering the process. Can someone confirm, that this approach should be working or is the approach doomed because of the Impl class? Maybe there is a GWT annotation/configuration, where I could tell the serializer to accept the XMLGC serializer for any extension of XMLGC?

http://stackoverflow.com/q/26675045
has body: I trying to get java.lang;Class object from not yet compiled file (*.java). I develop a plugin to netbeans plaform and i know how to find specify classLoader for source folder (src) and after that i would like to get Class object for specify file. I can call loadClass to get it but this dosent work on not compiled file. For example: ClassPath classPath = ClassPath.getClassPath(someFileObject, ClassPath.SOURCE); ClassLoader loader = classPath.getClassLoader(true); Class myLookingForClass = loader.loadClass("web.users.User"); // it is file User.java in package web.users it is some way to get it? UPDATE: Ok, I trying to implements mechanism whitch will generate dynamic class with their body (methods,variables etc.). To do that i need class definition of for example: method returning type or some variables types. Example scenario: User working on IDE (Netbeans) and he created a some class (but not compiled). This class will be userd in body of some class whitch we will dynamic create after some event(For example in using some button). And now it is no problem to getClassLoader and load class definition as java.lang.Class and them using. But files need to be already compiled. And now i would like to know if it is some way to get java.lang.Class from file for example" someFile.java and package somePackage
type: Question
has comment: http://stackoverflow.com/comment/41949953
has answer: http://stackoverflow.com/a/26675685
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41949980
has title: How to get java.lang;Class from classLoader and not compiled file *.java
answer count: 1
linked to: http://stackoverflow.com/q/12173294
tagged with: netbeans-platform
type: AnsweredQuestion
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/26675685

http://stackoverflow.com/a/26684706
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26684367
answers question: http://stackoverflow.com/q/26684367
has comment: http://stackoverflow.com/comment/41967605
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41967820
has body: First, I'd advise defining held as volatile. Second, since you start the thread from the init() method, it will start running before you ever pressed the key, and thus finish right away. I'd leave init like this: public void init() { addKeyListener(this); } And change the keyPressed listener to: public void keyPressed(KeyEvent e) { boolean wasHeld = held; held = true; System.out.println(held); if ( !wasHeld) { Thread t = new Thread(this); t.start(); } } The reasoning behind the wasHeld variable is that when you hold down a key, it actually sends multiple keyPressed events until it is released. If you just created a thread for each of these, you'll have many threads created during one key holding, all of them busily writing to your console. So you want to create the thread only if this is the first time the keyPressed event was sent for this particular key press. A new thread will be created when you press a key again after releasing the previous one.
upvote count: 1

http://stackoverflow.com/a/27044111
upvote count: 1
has body: Well, the shorter answer is... String word1 = "bar"; String word2 = "foo"; String story = "Once upon a time, there was a foo and a bar."; story = story.replace("foo", "@"+ word1).replace("bar", word2).replace("@" + word2, word1); System.out.println(story);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26791441

http://stackoverflow.com/a/26758058
type: Answer
answers question: http://stackoverflow.com/q/26757751
has comment: http://stackoverflow.com/comment/42097839
downvote count: 1
score: -1
has body: There are some reasons, because your code will fail. Did you added the class file of ROLE_TABLE, USER_TABLE to the SessionFactory ? Place your annotations properly.. @Entity @Table(name = "ROLE_TABLE") public class Role { private long id; private String roleName; private Set&lt;User&gt; users = new HashSet&lt;User&gt;(); /** * @return the id */ @Id @GeneratedValue @Column(name = "ROLE_ID") public long getId() { return id; } Replace this with: @Entity @Table(name = "ROLE_TABLE") public class Role { @Id @GeneratedValue @Column(name = "ROLE_ID") private long id; private String roleName; private Set&lt;User&gt; users = new HashSet&lt;User&gt;(); /** * @return the id */ public long getId() { return id; } You need to place the hibernate annotations before declaring the variable. I pasted your code in my app with my changes and it worked.
has comment: http://stackoverflow.com/comment/79483871
has comment: http://stackoverflow.com/comment/42098054
upvote count: 0
has comment: http://stackoverflow.com/comment/42097958
has comment: http://stackoverflow.com/comment/42097912

http://stackoverflow.com/a/27681523
upvote count: 10
type: AcceptedAnswer
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/43869701
type: Answer
has body: It is matter of your approach. If you have the constants you can build a default Map of values required for your call. @FieldMap will be suitable for building a Map with all your required fields private void extendSession(String token){ Map params = buildDefaultParams(); params.put("refreshToken", token); getRestAdapter().create(MyApi.class).extendsSession(params); } private Map buildDefaultParams(){ Map defaults = new HashMap(); defaults.put("client_id", CLIENT_ID); defaults.put("client_secret", CLIENT_SECRET); defaults.put("grant_type", GRANT_TYPE); return defaults; } /**then you change your interface to this **/ @POST("/token") @FormUrlEncoded void extendSession(@FieldMap() Map refreshToken);
has comment: http://stackoverflow.com/comment/51319641
accepted answer of: http://stackoverflow.com/q/26697054
answers question: http://stackoverflow.com/q/26697054

http://stackoverflow.com/a/26712358
upvote count: 1
downvote count: 0
has body: In your main class you need to get the return value in the Connection object, Connection con=sqlConn.connectToDatabase(); Now, con will hold the connection object . so that you can use it to query the database as normal.
has comment: http://stackoverflow.com/comment/42015922
has comment: http://stackoverflow.com/comment/42015851
type: Answer
has comment: http://stackoverflow.com/comment/42017366
has comment: http://stackoverflow.com/comment/42016841
answers question: http://stackoverflow.com/q/26712230
score: 1

http://stackoverflow.com/comment/42167233
score: 1
comment on: http://stackoverflow.com/q/26796507
type: QuestionComment
type: Comment
has text: this looks like it could be that your activity did not call super.onCreate()

http://stackoverflow.com/a/30999542
answers question: http://stackoverflow.com/q/26747076
downvote count: 1
has comment: http://stackoverflow.com/comment/50110578
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/50104096
has body: Try not to scan com.projectname.* , in general it's a bad practice which could lead to problematic bean initialization, not only because on errors at startup, it could also lead to load beans that shouldn't be part of your current context. Try to use correct package naming standards and scan only services, components and repositories packages... one time. @Configuration @EnableWebMvc @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableSpringDataWebSupport @Import(value = ComponentScanConfig.class) public class WebappConfig extends WebMvcConfigurerAdapter { } Component scan configuration file: @Configuration @ComponentScan(basePackages = { "com.example.serviceModule.service", "com.example.webModule.controller" }) public class ComponentScanConfig { }
score: -1

http://stackoverflow.com/q/26823901
has answer: http://stackoverflow.com/a/26824110
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42217328
upvote count: 0
accepted answer: http://stackoverflow.com/a/26824110
answer count: 1
has body: I have a starting time (in this case 9 o'clock), and there are a certain amount of hours being added to it, and then the current time needs to be calculated. The current method that I am using is add the hours passed to the original time, then modulo by 12, like so: timeAndHoursPassed % 12 = currentTime this works well in all cases except for when the added time is divisible by 12, in which case I get the current time to be zero instead of 12. How can I fix this? In addition, if possible, I would prefer to use some basic math if possible, instead of using the GregorianCalender class. Thanks for any and all help in advance. My code is as follows: package week11; import java.util.Scanner; public class PassingTrains { static int currentTime = 9, firstDistance = 0, secondDistance = 0, firstSpeed = 40, secondSpeed; static Scanner input = new Scanner(System.in); public static String passTime(){ System.out.print("Enter the speed of the passenger train: "); secondSpeed = input.nextInt(); while (currentTime &lt; 11) { firstDistance += firstSpeed; currentTime++; } while (firstDistance &gt; secondDistance) { firstDistance += firstSpeed; secondDistance += secondSpeed; currentTime++; } if (firstDistance == secondDistance){ return ("at " + currentTime % 12); } else { return ("between " + (currentTime - 1) % 12 + " o'clock and " + currentTime % 12); } } public static void main(String[] args) { System.out.println("The passenger train passed the freight train at " + passTime() + " o'clock"); System.out.println("The freight train was traveling " + firstSpeed + " mph"); System.out.println("The passenger train was traveling at " + secondSpeed + " mph"); } }
has comment: http://stackoverflow.com/comment/42217303
favorite count: 0
has comment: http://stackoverflow.com/comment/42217041
score: -1
has title: Converting Hours passed to Current Time
type: AnsweredQuestion

http://stackoverflow.com/q/26798511
tagged with: callback
possible better answer: http://stackoverflow.com/a/26798692
has body: I'd like to do something simple, but I can't express it in a google search. So, I come here ^^ I have an Async task like this : class RequestTask extends AsyncTask&lt;String, String, String&gt; { final MyCallbackInterface callback; RequestTask(MyCallbackInterface callback) { this.callback = callback; } @Override protected String doInBackground(String... uri) { ... } @Override protected void onPostExecute(String result) { super.onPostExecute(result); callback.onTaskFinished(result); } } interface MyCallbackInterface { void onTaskFinished(String result); } So, I have a task with a callback to execute when the task ends. Now I can call it like this : class Program { public void DoAsyncRequest(String stringUrl, MyCallbackInterface callback) { new RequestTask(callback).execute(stringUrl); } public static void Main(){ DoAsyncRequest("http://toto.com", new MyCallbackInterface() { @Override public void onDownloadFinished(String result) { //do something ... } }); } } But, instead of having an "inline" function as callback, is it possible to do something like this : (if yes, how ?) class Program { public void DoAsyncRequest(String stringUrl, MyCallbackInterface callback) { new RequestTask(callback).execute(stringUrl); } public static void Main(){ DoAsyncRequest("http://toto.com", MyCallBack); } private void MyCallBack(string result){ //do something } } Thanks!
has answer: http://stackoverflow.com/a/26798692
accepted answer: http://stackoverflow.com/a/26798581
tagged with: inline
downvote count: 0
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26798581
score: 1
tagged with: java
type: Question
answer count: 2
has title: Java callback functions as parameter

http://stackoverflow.com/a/27879417
answers question: http://stackoverflow.com/q/26735619
type: Answer
score: 1
has body: You can retrieve the HTTP query parameters through the inbound property http.query.params. To obtain the age parameter, use the following MEL expression #[message.inboundProperties.'http.query.params'.get('age')]
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/26787305
has answer: http://stackoverflow.com/a/28167727
has comment: http://stackoverflow.com/comment/42151367
has comment: http://stackoverflow.com/comment/42152530
has title: Java Null pointer exception on creating an intent?
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/42151285
answer count: 1
has comment: http://stackoverflow.com/comment/42151087
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
has body: I am not sure why I keep getting a null pointer error: This is the error: 11-06 13:50:03.539 27297-27297/com.example.lior.winklio E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example, PID: 27297 java.lang.NullPointerException at android.content.ComponentName.&lt;init&gt;(ComponentName.java:77) at android.content.Intent.&lt;init&gt;(Intent.java:3813) at com.example.StarterFragment.sendToHomePage(StarterFragment.java:227) at com.example.StarterFragment.access$1700(StarterFragment.java:37) at com.example.StarterFragment$2.success(StarterFragment.java:184) at com.example.StarterFragment$2.success(StarterFragment.java:176) at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:45) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) this is the code: (the error points to the Intent homeInter ...) private void sendToHomePage() { Log.i(TAG, " SENDING TO HOME PAGE..."); Intent homeIntent = new Intent(getActivity(), MainActivity.class); // Closing all the Activities homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring add item startActivity(homeIntent); getActivity().finish(); }

http://stackoverflow.com/a/26794360
type: Answer
has body: Start by adding scan.nextLine() after low[i] = high[i] = scan.nextInt();. There is still a carriage return/new line feed in the Scanner's buffer after scan.nextInt() which will cause it to error the next time it tries to read it... so i copy pasted 300 ints when it asked for the input data and as soon as i pasted it This changes things, try something more like... String text = scan.nextLine(); Scanner parse = new Scanner(text); int i = 0; while (parse.hasNextInt()) { highLow[i] = parse.nextInt(); if (highLow[i] &gt; highest) { highest = highLow[i]; } if (highLow[i] &lt; lowest) { lowest = highLow[i]; } i++; } Updated A better solution might be to put all the numbers into a text file and read the text file instead... try { Scanner parse = new Scanner(new File("Test.txt")); int i = 0; while (parse.hasNextInt()) { highLow[i] = parse.nextInt(); if (highLow[i] &gt; highest) { highest = highLow[i]; } if (highLow[i] &lt; lowest) { lowest = highLow[i]; } i++; } System.out.println("answer:"); System.out.println(highest + " " + lowest); } catch (FileNotFoundException exp) { exp.printStackTrace(); } You could use Scanner to prompt the user for the name of the text file instead of hardcoding it
score: 2
answers question: http://stackoverflow.com/q/26794315
upvote count: 2
has comment: http://stackoverflow.com/comment/42163810
has comment: http://stackoverflow.com/comment/42163891
downvote count: 0
has comment: http://stackoverflow.com/comment/42163918

http://stackoverflow.com/comment/42182149
comment on: http://stackoverflow.com/q/26804489
score: 0
has text: http://stackoverflow.com/questions/1647260/java-dynamic-array-sizes
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26757788
upvote count: 1
has comment: http://stackoverflow.com/comment/42107125
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42107679
score: 1
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26764496
has comment: http://stackoverflow.com/comment/42097439
tagged with: gradle
has comment: http://stackoverflow.com/comment/42097283
answer count: 1
linked to: http://stackoverflow.com/q/18911356
downvote count: 0
has title: BeanCreationException while running the server
has comment: http://stackoverflow.com/comment/42097299
has comment: http://stackoverflow.com/comment/42097289
has answer: http://stackoverflow.com/a/26764496
favorite count: 0
has body: I'm getting started with a small Spring MVC application, and when i run the server, i have this error, i don't know what i am doing wrong, and i'm trying to understand why the @Autowiring is not working: org.springframework.web.servlet.DispatcherServlet [main] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personDataAccesObject': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory org.munaycoop.taskmanager.daos.PersonDataAccesObject.session; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.SessionFactory] 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)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1204) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.jav…

http://stackoverflow.com/q/26690748
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/26690864
type: Question
has body: How to Increase Tomcat HeapSize (JVM Heap)? Getting below error on server console INFO: Destroying ProtocolHandler ["ajp-bio-8009"] Nov 01, 2014 8:41:34 PM org.apache.catalina.core.ContainerBase removeChild SEVERE: ContainerBase.removeChild: destroy: org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] in state [STARTING_PREP] at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:409) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:299) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041) at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1234) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041) at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1234) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:593) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:822) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.startup.Catalina.start(Catalina.java:695) 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.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456) Will any one help me to solve this issue?
tagged with: java
has title: How to increase heap size in Eclipse IDE to run JavaWebApplication?
tagged with: eclipse
score: 2
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26690864
tagged with: tomcat
favorite count: 0
tagged with: heap-memory

http://stackoverflow.com/comment/42031351
type: QuestionComment
comment on: http://stackoverflow.com/q/26720653
has text: if you just want to run the straight away you can delete the two folders and run the app.
score: 0
type: Comment

http://stackoverflow.com/a/26807607
has comment: http://stackoverflow.com/comment/42208429
downvote count: 0
answers question: http://stackoverflow.com/q/26804044
has body: How about this: for(Element img : doc.select(".rullo .rullo-item .lazy&gt;a img[src]")) { String imageMainUrl = img.attr("data-src"); URL imageurl = null; try { imageurl = new URL(imageMainUrl); } catch (MalformedURLException e) { e.printStackTrace(); } final long imageSize = imageurl.openConnection().getContentLength(); if(img.attr("src") == null || img.attr("src").equals("") || img.attr("src").isEmpty() || imageSize &gt; 0){ images.add(bmp); } else { byte[] decodedString = Base64.decode(imageMainUrl, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); images.add(bitmap); } } I noticed that the actual image url is under data-src and not src.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/42207150
type: QuestionComment
type: Comment
has text: OK, keep x, drop y, z, b and letters. Then you'll see some output. Then, think about creating the string from three characters, and how to look up the string in x.
score: 0
comment on: http://stackoverflow.com/q/26818478

http://stackoverflow.com/comment/42206059
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26817578
has text: Wouldn't it make much more sense to use `inputString.toCharArray()` instead of filling the array manually? Especially if you want to show "easier" stuff?
score: 0

treeview
tags question: http://stackoverflow.com/q/26821319
type: Tag
tags question: http://stackoverflow.com/q/26690247
tags question: http://stackoverflow.com/q/26753091
tag name: treeview
tags question: http://stackoverflow.com/q/26795514

http://stackoverflow.com/q/26797060
downvote count: 0
tagged with: jpql
favorite count: 0
has body: i have a problem with named query in my project. I have 2 entities with OneToOne relation. @Entity @Table(name = "SL_BRANCH_PARAMS") public class BranchParams implements Identifiable { @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO, generator = "SL_BRANCH_PARAM_SEQ_GEN") @SequenceGenerator(name = "SL_BRANCH_PARAM_SEQ_GEN", sequenceName = "SL_BRANCH_PARAM_SEQ") private Long id; @JoinColumn(name = "INTEREST_ACCOUNT_ID") @OneToOne(fetch = FetchType.EAGER) private AccountDef interestAccount; } and second class with named query @Entity @Table(name = "SL_ACCOUNT_DEF") @NamedQueries({ @NamedQuery(name = "AccountDef.getAvaibleInterestAccountsForBranch", query = "SELECT ad FROM AccountDef ad LEFT JOIN FETCH ad.branchParamsInterest WHERE ad.branchParamsInterest = NULL ORDER BY ad.id ASC"), }) public class AccountDef implements Identifiable { @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO, generator = "SL_ACCOUNT_DEF_SEQ_GEN") @SequenceGenerator(name = "SL_ACCOUNT_DEF_SEQ_GEN", sequenceName = "SL_ACCOUNT_DEF_SEQ") private Long id; @OneToOne(fetch = FetchType.EAGER, mappedBy = "interestAccount") private BranchParams branchParamsInterest; } When i execute the named query I get this query to database select accountdef0_.ID as ID1_10_0_, branchpara1_.ID as ID1_13_1_, branchpara1_.INTEREST_ACCOUNT_ID as INTERES16_13_1_ from SL_ACCOUNT_DEF accountdef0_ left outer join SL_BRANCH_PARAMS branchpara1_ on accountdef0_.ID=branchpara1_.INTEREST_ACCOUNT_ID where accountdef0_.ID is null //this is incorrect order by accountdef0_.ID ASC which is not correct because it gives me no rows as it checks if the ID in AccountDef is null instead in BranchParams. The correct query should look like this select accountdef0_.ID as ID1_10_0_, branchpara1_.ID as ID1_13_1_, branchpara1_.INTEREST_ACCOUNT_ID as INTERES16_13_1_ from SL_ACCOUNT_DEF accountdef0_ left outer join SL_BRANCH_PARAMS branchpara1_ on accountdef0_.ID=branchpara1_.INTEREST_ACCOUNT_ID where …
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26797209
accepted answer: http://stackoverflow.com/a/26797209
has title: NamedQuery miss places table in OnetoOne relation
tagged with: jpa
answer count: 1

http://stackoverflow.com/comment/41987256
has text: When I set the threshold to `>= 1` (e.g. no filtering) I get the expected 107 key-value pairs
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26695769
type: Comment

http://stackoverflow.com/q/26741290
type: Question
upvote count: 2
has title: Why deadlock is occuring intermittently in my code?
accepted answer: http://stackoverflow.com/a/26741416
answer count: 1
has body: Below code I have written for a deadlock, but for small "for loop" code is not falling in deadlock while when I keep "for loop" till 10 then deadlock is occurring. Can someone plz explain, why it is showing such behavior ? public class CustomerUpdateDeadloackThread { public static void main(String[] args) { Customer cstmr = new Customer("Peter"); Address adrs = new Address("B-232, Bangalore"); // For loop till 3 is not showing deadlock. for (int i=0; i&lt;10;i++){ new Thread(new TagObjectsToEachOther(cstmr, adrs)).start(); new Thread(new TagObjectsToEachOther(adrs, cstmr)).start(); } } } interface CustomerUpdater { public boolean update(Object obj); } class TagObjectsToEachOther implements Runnable { CustomerUpdater taskItem; Object objToUpdateWith; public TagObjectsToEachOther(CustomerUpdater cspdtr, Object obj2) { this.taskItem = cspdtr; this.objToUpdateWith = obj2; } @Override public void run() { taskItem.update(objToUpdateWith); System.out.println(" Task done :" + Thread.currentThread().getName()); } } class Address implements CustomerUpdater { String address; Customer customer; public Address(String addrs) { this.address = addrs; } @Override public boolean update(Object cstmr) { synchronized (this) { synchronized ((Customer) cstmr) { try { this.customer = (Customer) cstmr; Thread.sleep(2000); // or else do some other work here } catch (CustomerUpdateFailureException e) { e.getCause(); return false; } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } } } } class Customer implements CustomerUpdater { String name; Address address; public Customer(String nm) { this.name = nm; } @Override public boolean update(Object adrs) { synchronized (this) { synchronized ((Address) adrs) { try { this.address = (Address) adrs; Thread.sleep(2000); // or else do some other work here } catch (CustomerUpdateFailureException e) { e.getCause(); return false; } catch (InterruptedException e) { // TODO Auto-generated catch block e.…
has comment: http://stackoverflow.com/comment/42102332
favorite count: 0
has answer: http://stackoverflow.com/a/26741416
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42068500
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/42084567
comment on: http://stackoverflow.com/q/26748440
has text: In the future you should more thoroughly explain what your code is supposed to do. It seems like there's been some confusion about it. Basically you should have said at the beginning that a letter grade of `+` or `-` indicated that 0.3 should be added or subtracted from the numerical grade. Otherwise we are left to guess and misunderstand.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26786290
tagged with: mongodb
has comment: http://stackoverflow.com/comment/42178406
has comment: http://stackoverflow.com/comment/42178453
downvote count: 0
has comment: http://stackoverflow.com/comment/42162607
tagged with: mongodb-java
has comment: http://stackoverflow.com/comment/47538952
favorite count: 0
has title: MongoDB - Memory leak Issue in Java driver
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42150605
has body: I am running a java project and use mongodb as the back end DB. Here I am getting the following warning everytime I run the web application SEVERE: The web application [/Padua] appears to have started a thread named [MongoCleaner576026458] but has failed to stop it. This is very likely to create a memory leak. Aug 29, 2014 11:41:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads I got to know that this error is because of mongoclient not closed properly. But I am making sure I am closing the connection in every instance The following is my coding public class DBUtils { MongoClient mongoClient; DB db; DBCollection messages; DBCollection customerDetails; public MongoClient connectToDB(String dBName){ try { mongoClient = new MongoClient("XX.YYY.ZZZ.AAA" , 27017 ); db = mongoClient.getDB(dBName); db.createCollection("A", null); db.createCollection("B", null); db.createCollection("C", null); BasicDBObject msgindexobj = new BasicDBObject(); msgindexobj.put("processedword", 1); msgindexobj.put("mobileID", 1); db.getCollection("Messages").ensureIndex(new BasicDBObject("location", "2dsphere"), "geospatial"); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } return mongoClient; } public void disConnectFromDB(MongoClient mongoclient){ if (mongoclient!=null){ mongoclient.close(); mongoclient=null; } } } And I am calling this type of code to access DB DBUtils dbUtils=new DBUtils(); mongoclient= dbUtils.connectToDB("pingpong"); DB db = mongoclient.getDB("pingpong"); dbUtils.disConnectFromDB(mongoclient); Am I doing something wrong here....Please help me in resolving this issue. Thanks for your time.
tagged with: java
has comment: http://stackoverflow.com/comment/42234341
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/26811596
type: AnsweredQuestion
tagged with: matrix
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26811651
has comment: http://stackoverflow.com/comment/42195615
possible better answer: http://stackoverflow.com/a/26811776
has body: Is there an easy way to merge multiple, say char arrays to get a char matrix? I have 8 arrays below with 64 chars each and I want to merge to a matrix with 8 rows and 64 cols. package august26; import java.util.Scanner; public class XBits { public static void main(String[] args) { Scanner input = new Scanner(System.in); long n1 = input.nextInt(); long n2 = input.nextInt(); long n3 = input.nextInt(); long n4 = input.nextInt(); long n5 = input.nextInt(); long n6 = input.nextInt(); long n7 = input.nextInt(); long n8 = input.nextInt(); String s1 = String.format("%64s", Long.toBinaryString(n1)).replace(' ', '0'); String s2 = String.format("%64s", Long.toBinaryString(n2)).replace(' ', '0'); String s3 = String.format("%64s", Long.toBinaryString(n3)).replace(' ', '0'); String s4 = String.format("%64s", Long.toBinaryString(n4)).replace(' ', '0'); String s5 = String.format("%64s", Long.toBinaryString(n5)).replace(' ', '0'); String s6 = String.format("%64s", Long.toBinaryString(n6)).replace(' ', '0'); String s7 = String.format("%64s", Long.toBinaryString(n7)).replace(' ', '0'); String s8 = String.format("%64s", Long.toBinaryString(n8)).replace(' ', '0'); s1.toCharArray(); s2.toCharArray(); s3.toCharArray(); s4.toCharArray(); s5.toCharArray(); s6.toCharArray(); s7.toLowerCase(); s8.toCharArray(); input.close(); } }
has answer: http://stackoverflow.com/a/26811776
accepted answer: http://stackoverflow.com/a/26811651
score: 0
has comment: http://stackoverflow.com/comment/42195645
tagged with: java
has comment: http://stackoverflow.com/comment/42195614
tagged with: arrays
has comment: http://stackoverflow.com/comment/42195643
has title: How to Merge multiple arrays into a matrix in JAVA?

http://stackoverflow.com/comment/42217336
score: 0
type: Comment
has text: @dili - So why not an array?
comment on: http://stackoverflow.com/a/26824149
type: AnswerComment

http://stackoverflow.com/comment/42206154
type: QuestionComment
comment on: http://stackoverflow.com/q/26817914
has text: Your description of what is happening is not making much sense. What does your method "random()" do?
score: 0
type: Comment

http://stackoverflow.com/comment/42007706
has text: `I am having problems with my code, It keeps having issues with the:` - what are the issues?
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/26707606
type: Comment

http://stackoverflow.com/q/26795100
tagged with: for-loop
upvote count: 0
tagged with: parseint
accepted answer: http://stackoverflow.com/a/26795203
answer count: 1
tagged with: arrays
has body: I'm trying to calculate the money times the percent (i.e. $1000*.04 = $40) and print out the result (i.e. $40). I have a 2D String array holding the information. First off I want to print the percent for each row, depending on certain factors that are shown in the first for loop. Then I'd like to display the result of the money time the percent in the second for loop. I have the 1D Double array holding the percent shown as a decimal that will be multiplied to the money to produce the result. I keep getting this error --> java.lang.ArrayIndexOutOfBoundsException: 3 So I figure it's something wrong with the 1D Double array, but I don't know what. FileReader fr = new FileReader("input.txt"); BufferedReader br = new BufferedReader(fr); //2D array String[][] input = new String[15][4]; //1D array Doubt[] in = new Double[3]; for(int row=0; row&lt;input.length; row++){ int a = Integer.parseInt(input[row][1]); int b = Integer.parseInt(input[row][2]); double s = Double.parseDouble(input[row][3]); if(a&gt;=50 &amp;&amp; b==1){ System.out.println(input[row][0] + "\t\t2%"); in[row]=0.02; } if(a&gt;=25 &amp;&amp; b==1){ System.out.println(input[row][0] + "\t\t4%"); in[row]=0.04; } if((a&gt;=15 &amp;&amp; b==1){ System.out.println(input[row][0] + "\t\t6%"); in[row]=0.06; } } for(int row=0; row&lt;input.length; row++){ int a = Integer.parseInt(input[row][1]); int b = Integer.parseInt(input[row][2]); double s = Double.parseDouble(input[row][3]); System.out.println(input[row][0] + "\t\t" + s*in[row]); }
tagged with: multidimensional-array
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/42164696
has title: java Array trouble displaying multiplication result
has answer: http://stackoverflow.com/a/26795203
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/122897835
score: 2
has text: I like your approach, but I can't find com.pls.core.jpa package with `NativeQueryResultEntity`. I've searched in Maven repository. Whhich version of jpa is this and where I can find it?
type: AnswerComment
comment on: http://stackoverflow.com/a/67992969
type: Comment

http://stackoverflow.com/a/26723784
accepted answer of: http://stackoverflow.com/q/26723368
type: Answer
has comment: http://stackoverflow.com/comment/42037175
has body: You can use this regex to capture each line separately using MULTILINE flag: ^((?:-?\d+(?:\.\d+)?\s+){9}-?\d+(?:\.\d+)?)(?=\r?\n|\z) RegEx Demo Once lines separated out you can just use String#split by space to get individual cell values.
has comment: http://stackoverflow.com/comment/42037436
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42037587
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26723368
has comment: http://stackoverflow.com/comment/42037198

http://stackoverflow.com/comment/42074391
type: Comment
has text: How Accurate does it have to be? IMHO getting the bit length is really inaccurate. Also, how big do you think your numbers will be?
score: 0
comment on: http://stackoverflow.com/q/26744267
type: QuestionComment

http://stackoverflow.com/q/26682102
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26683199
type: Question
has comment: http://stackoverflow.com/comment/41963308
upvote count: 1
answer count: 1
favorite count: 0
has body: I have a mapping similar to the following: &lt;set name="tracks" table="tracks"&gt; &lt;key column="album_id" /&gt; &lt;composite-element class="Track"&gt; &lt;many-to-one name="song" column="song_id" class="Song" cascade="none" /&gt; &lt;property name="trackNumber" column="track_number" type="java.lang.Integer" not-null="false"/&gt; &lt;/composite-element&gt; &lt;/set&gt; Generally with mappings similar to this, I've noticed that when saving the parent entity, Hibernate likes to delete all the elements of the collection first, before adding back the new elements. I've already come to accept this as standard behaviour. However, with the mapping file I've given above, I run into an error that seems two fold. First, Hibernate appears to be trying to delete the elements of the collection by issuing a DELETE statement using every column on the track table. Secondly, this still fails whenever trackNumber is null, since the DELETE statement includes a DELETE FROM track WHERE album_id = ? AND song_id = ? AND track_number = ? Which doesn't delete the track at all. It should really be doing for null, a DELETE FROM track WHERE album_id = ? AND song_id = ? AND track_number is ? Either way, what I'd really like is something simple like DELETE FROM track WHERE album_id = ? This seems to work when I replace the many-to-one mapping with simply the song_id &lt;set name="tracks" table="tracks"&gt; &lt;key column="album_id" /&gt; &lt;composite-element class="Track"&gt; &lt;property name="songId" column="song_id" type="int" /&gt; &lt;property name="trackNumber" column="track_number" type="java.lang.Integer" not-null="false"/&gt; &lt;/composite-element&gt; &lt;/set&gt; But I need the track data too... any help? Edit: Maybe I should clarify my question. How do I make it so my deletes on this set do not rely on trackNumber?
has title: Hibernate: How to properly map Sets with Composite Element containing a Many-to-one?
has comment: http://stackoverflow.com/comment/41963127
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26770030
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42120756
has comment: http://stackoverflow.com/comment/42120738
has comment: http://stackoverflow.com/comment/42120848
tagged with: java
has comment: http://stackoverflow.com/comment/42120689
has comment: http://stackoverflow.com/comment/42120828
has comment: http://stackoverflow.com/comment/42120856
accepted answer: http://stackoverflow.com/a/26770169
has comment: http://stackoverflow.com/comment/42120833
has comment: http://stackoverflow.com/comment/42120865
has comment: http://stackoverflow.com/comment/42120605
type: Question
has body: I'm trying to make a program that will let you pick the number of images you want, it will then ask what the names of the files you want to use are. Then it will print them in the appropriate fashion on the screen in a grid. Now I know many parts of this code like the width and height, rows and columns, and other things are wrong, I intend to fix them after I figure this bit out. It's not letting me use paintComponent no matter how I change it. I want to keep this in my main class, is this still possible? Often times I put it in a separate graphics class, but bringing in my inputs to that class is irritating. import java.awt.Color; import java.awt.Container; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Image; import java.util.ArrayList; import java.util.Scanner; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; public class Core extends JPanel{ public static void main(String[] args){ Scanner r = new Scanner(System.in); System.out.println("How many selections will you have? 1, 2 or 4? "); if(r.next().contains("1") | r.next().contains("2") | r.next().contains("4")){ String selections = r.next(); int number = Integer.parseInt(selections); ArrayList&lt;String&gt; images = new ArrayList(); for(int j = 1; j &lt;= number; j++){ System.out.println("Your options are boo, bae, skinny, bro..."); System.out.println("Name of image " + j + "? "); if(r.next().contains("boo") | r.next().contains("bae") | r.next().contains("skinny") | r.next().contains("bro")) images.add(r.next()); else{ System.out.println("Im sorry that was an improper input..."); System.out.println("Next time, remember, you can only input boo, bae, skinny, or bro."); r.close(); } } JFrame theGUI = new JFrame(); theGUI.setTitle("Random Images"); theGUI.setSize(number * 100, number * 100);//ratio of 1:100 theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container pane = theGUI.getContentPane(); pane.setLayout(new GridLayout(number, number)); for(int j …
has comment: http://stackoverflow.com/comment/42120579
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42120550
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/42120882
has comment: http://stackoverflow.com/comment/42120729
has comment: http://stackoverflow.com/comment/42120816
favorite count: 0
has comment: http://stackoverflow.com/comment/42120969
has comment: http://stackoverflow.com/comment/42120727
has comment: http://stackoverflow.com/comment/42120784
has comment: http://stackoverflow.com/comment/42120887
has comment: http://stackoverflow.com/comment/42120615
has comment: http://stackoverflow.com/comment/42120795
has comment: http://stackoverflow.com/comment/42120902
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/42120844
has answer: http://stackoverflow.com/a/26770169
has comment: http://stackoverflow.com/comment/42120901
has title: Painting Some Images into a Pane
has comment: http://stackoverflow.com/comment/42120617
has comment: http://stackoverflow.com/comment/42120869
tagged with: graphics

http://stackoverflow.com/comment/42026315
has text: @james large: maybe you read more carefully. The question I linked is *exactly about WHY*. The question about the difference, which *others* have linked to, is another question.
type: QuestionComment
comment on: http://stackoverflow.com/q/26715689
type: Comment
score: 0

http://stackoverflow.com/q/26805115
tagged with: java
upvote count: 1
has body: I'm trying to install Maven in order to run selenium junit test and then integrate it in Jenkins When I run in CMD : mvn -version, I have this: Error: JAVA_HOME is set to an invalid directory. JAVA_HOME = "C:\Program Files\Java\jdk1.8.0_11\bin" Please set the JAVA_HOME variable in your environnement to match the location of your Java installation. When I run java -version, I have this: java version "1.8.0_20" Java(TM) SE Runtime Environment (Build 1.8.0_20-h26) Java HotSPot(TM) 64-Bit Server VM (build 25.20-h23, mixed mode) Why do I get this error? Here is my configuration for java and maven I have Windows 7 64bits I installed Maven here C:\Program Files\Apache Software Foundation\apache-maven-3.2.3 For java, I have installed these version: C:\Program Files\Java\jdk1.6.0_37 should i keep this version? C:\Program Files\Java\jdk1.7.0_60 should i keep this version? C:\Program Files\Java\jdk1.8.0_11 C:\Program Files\Java\jre1.8.0_20 C:\Program Files\Java\jre6 C:\Program Files\Java\jre7 In User variable, I have this: JAVA_HOME C:\Program Files\Java\jdk1.8.0_11\bin MAVEN_OPTS %M2% PATH C:\Program Files\Java\jdk1.8.0_11\bin; in System variable, I have this: JAVA_HOME C:\Program Files\Java\jdk1.8.0_11\bin JRE_HOME C:\Program Files\Java\jre6; M2 %MAVEN_HOME%\bin; MAVEN_HOME C:\Program Files\Apache Software Foundation\apache-maven-3.2.3; Path C:\Program Files\Apache Software Foundation\apache-maven-3.2.3\bin;C:\Program Files\Java\jdk1.8.0_11\bin;
type: Question
has answer: http://stackoverflow.com/a/26805654
accepted answer: http://stackoverflow.com/a/26868987
possible better answer: http://stackoverflow.com/a/26805258
has answer: http://stackoverflow.com/a/26805258
downvote count: 0
favorite count: 0
has title: Why I have the error Java is set to an invalid directory when i try to install Maven?
tagged with: maven
has answer: http://stackoverflow.com/a/26868987
answer count: 4
has comment: http://stackoverflow.com/comment/42183787
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26805202
score: 1

http://stackoverflow.com/comment/42116895
comment on: http://stackoverflow.com/q/26768027
score: 0
type: Comment
type: QuestionComment
has text: Can you explain in 3 sentences what your code does where each sentence is a couple of words? This will give you the starting point of your method break up

http://stackoverflow.com/a/49297863
score: 32
downvote count: 1
upvote count: 33
has body: map() and flatMap() map() Just takes a Function <T, R> a lambda param where T is element and R the return element built using T. At the end we'll have a Stream with objects of Type R. A simple example can be: Stream .of(1,2,3,4,5) .map(myInt -> "preFix_"+myInt) .forEach(System.out::println); It simply takes elements 1 to 5 of Type Integer, uses each element to build a new element from type String with value "prefix_"+integer_value and prints it out. flatMap() It is useful to know that flatMap() takes a function F<T, R> where T is a type from which a Stream can be built from/with. It can be a List (T.stream()), an array (Arrays.stream(someArray)), etc.. anything that from which a Stream can be with/or form. in the example below each dev has many languages, so dev. Languages is a List and will use a lambda parameter. R is the resulting Stream that will be built using T. Knowing that we have many instances of T, we will naturally have many Streams from R. All these Streams from Type R will now be combined into one single 'flat' Stream from Type R. Example The examples of Bachiri Taoufiq [see its answer here] 1 are simple and easy to understanding. Just for clarity, let just say we have a team of developers: dev_team = {dev_1,dev_2,dev_3} , with each developer knowing many languages: dev_1 = {lang_a,lang_b,lang_c}, dev_2 = {lang_d}, dev_3 = {lang_e,lang_f} Applying Stream.map() on dev_team to get the languages of each dev: dev_team.map(dev -> dev.getLanguages()) will give you this structure: { {lang_a,lang_b,lang_c}, {lang_d}, {lang_e,lang_f} } which is basically a List<List<Languages>> /Object[Languages[]]. Not so very pretty, nor Java8-like!! with Stream.flatMap() you can 'flatten' things out as it takes the above structure and turns it into {lang_a, lang_b, lang_c, lang_d, lang_e, lang_f}, which can basically used as List<Languages>/Language[]/etc... so in the end, your code would make more sense like this: dev_team .stream() /* {dev_1,dev_2,dev_3} */ .map(dev -> dev…
answers question: http://stackoverflow.com/q/26684562
type: Answer

http://stackoverflow.com/q/26698097
tagged with: jtable
type: Question
has answer: http://stackoverflow.com/a/26699012
tagged with: java
score: 0
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/41990482
has title: How to use listener in JTable?
type: UnansweredQuestion
has body: My task is to show a dialog using JOptionPane that shows the information of the selected product on the JTable. I used this listener but I'm not sure if it is the right one to use? table.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { //code for JOptionPane? } }); I'm done with everything except showing the dialog part. Here are my codes so far. Am I on the right track? Here are my codes. public class Table { public static void main(String[] args) { Runnable r = new Runnable() { public void run() { new Table().createUI(); } }; EventQueue.invokeLater(r); } private void createUI() { try { JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); JTable table = new JTable(); String readLine = null; TableModel tableModel = new TableModel(); File file = new File("Products.csv"); FileReader reader = new FileReader(file); BufferedReader bufReader = new BufferedReader(reader); List&lt;Products&gt; studentList = new ArrayList&lt;Products&gt;(); while((readLine = bufReader.readLine()) != null) { String[] splitData = readLine.split(","); Products products = new Products(); products.setName(splitData[0]); products.setNumber(splitData[1]); products.setPrice(splitData[2]); studentList.add(products); } tableModel.setList(studentList); table.setModel(tableModel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(table)); frame.setTitle("Lab 5"); frame.pack(); frame.setVisible(true); table.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { //code for JOptionPane? } }); } catch(IOException ex) {} } class Products { private String name; private String number; private String price; public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNumber() { return number; } public void setNu…

http://stackoverflow.com/q/26706400
type: Question
tagged with: enums
tagged with: arrays
tagged with: bigdecimal
score: 0
answer count: 1
has title: Two Dimensional Arrays with BigDecimal in Java
has comment: http://stackoverflow.com/comment/42005860
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26706427
tagged with: java
has comment: http://stackoverflow.com/comment/42005559
has body: I am getting compiler errors that seem to point at the semicolon at the end of two statements, and I have no idea how to fix the problem. The goal is to take in values from an Enum Class in Java and use them in financial calculations with a two dimensional arrays. public enum User { Mike("Mike", "User", 8000, 0.03, 15, 25), Jim("Jim", "User", 12000, 0.05, 12, 30), Jane("Jane", "User", 9000, 0.02, 18, 25), Mary("Mary", "User", 18000, 0.09, 5, 30); Bill("Bill", "User", 14000, 0.06, 8, 30); private final String firstName; private final String lastName; private final int annualDeposit; private final double annualIntRate; private final int yearsToDeposit; private final int yearsToCalcInt; User(String firstName, String lastName, int annualDeposit, double annualIntRate, int yearsToDeposit, int yearsToCalcInt) { this.firstName = firstName; this.lastName = lastName; this.annualDeposit = annualDeposit; this.annualIntRate = annualIntRate; this.yearsToDeposit = yearsToDeposit; this.yearsToCalcInt = yearsToCalcInt; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public int getAnnualDeposit() { return annualDeposit; } public double getAnnualIntRate() { return annualIntRate; } public int getYearsToDeposit() { return yearsToDeposit; } public int getYearsToCalcInt() { return yearsToCalcInt; } } import java.util.EnumSet; import java.math.BigDecimal; import java.text.NumberFormat; public class Work { public static void main(String[] args) { int[] annualDeposit = new int[5]; double[] intRate = new double[5]; int[] yearsToDeposit = new int[5]; int[] yearsToCalcInt = new int[5]; BigDecimal[][] accountBalance = new BigDecimal[5][30]; BigDecimal[][] principal = new BigDecimal[5][30]; int count = 0; int yearsDeposit = 0; for (User user: User.values()) { annualDeposit[count] = user.getAnnualDeposit(); intRate[count] = user.getAnnualIntRate(); yearsToDeposit[count] = user.getYearsToDeposit(); yearsToCalcInt[count] = user.getYearsToCalcInt(…

http://stackoverflow.com/q/26690319
has answer: http://stackoverflow.com/a/26690613
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26690541
tagged with: java
has comment: http://stackoverflow.com/comment/41977341
possible better answer: http://stackoverflow.com/a/26690353
has answer: http://stackoverflow.com/a/26690353
has title: How to use an embedded Java database?
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26690541
answer count: 3
has comment: http://stackoverflow.com/comment/41977603
score: 1
has comment: http://stackoverflow.com/comment/41977291
favorite count: 0
has body: I am new here... and I have a problem! I want to make an app where I need a database to store some data from a GUI. After I will finish my app, I want, for example, to share this. For the moment, I use MySQL database, but all my data are stored in separate files, not in my Java project and, if I share my app right now, you all you can't use this app because you don't have, probably, MySQL and because of other problems. Where I can find a good tutorial or if you can tell me what kind of database I can use to be embedded to my Java project and, after I will deploy my app, I want to run in any computer, without the needed to install a specific database. I hope you will understand what I want to get! Have a wonderful day!
has comment: http://stackoverflow.com/comment/41977396
has comment: http://stackoverflow.com/comment/41977386
has comment: http://stackoverflow.com/comment/41977641
linked to: http://stackoverflow.com/q/26312063
upvote count: 1

http://stackoverflow.com/a/26765196
score: 0
answers question: http://stackoverflow.com/q/26765094
type: Answer
has body: Random.nextInt(int n): Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. Your randomMove variable varies between 1 and 8. default case will only execute when randomMove &lt; 1 or randomMove &gt; 8 which is never. Suggestion to change your while conditional to, if I understand your code properly: while (knight != 64 &amp;&amp; switchBetweenMoves.hasValidMoves()) where hasValidMoves returns true if and only if valid moves exist, which are all moves in range of the knight which have not already been visited.

http://stackoverflow.com/a/26730387
accepted answer of: http://stackoverflow.com/q/26728893
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26728893
has body: This sort all the elements and put it back into matrix. I know you do not want it that way. but I posted it if any one need it. public static int[][] sort(int[][] x) { ArrayList&lt;Integer&gt; a = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 3; j++) { a.add(x[i][j]); } } Collections.sort(a); int k = 0; for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 3; j++) { x[i][j] = a.get(k); k++; } } return x; }

http://stackoverflow.com/a/26768472
score: 0
type: AcceptedAnswer
has body: If your ultimate goal is to remove the sequences that have duplicates, you should consider checking the array at the time you fill it: Instead of just doing something like this (you didn't provide the code so I'm just guessing): n = rand.nextInt(); diceArray[nextPosition++] = n; Do something like: n = rand.nextInt(); for ( int i = 0; i &lt; nextPosition; i++ ) { if ( diceArray[i] == n ) { return; // Or whatever will cause the array to be disqualified. } } This way you will save yourself rolling numbers that you won't use anyway. Suppose you rolled 2 2. You already know you have to disqualify this array, you don't need to continue rolling to get to 2 2 1 3 4 5 and then loop through the whole thing and disqualify it in the end. This is also true if you want to count the number of bad arrays you got before you got to a good array. Random rand = new Random(); int[] diceArray = new int[6]; int badArrays = 0; int nextPosition = 0; while ( nextPosition &lt; 6 ) { boolean goodMove = true; int n = rand.nextInt(6) + 1; for ( int i = 0; i &lt; nextPosition; i++ ) { if ( diceArray[i] == n ) { goodMove = false; break; } } if ( goodMove ) { diceArray[nextPosition++] = n; } else { nextPosition = 0; badArrays++; } } System.out.println( "Got the array: " + Arrays.toString(diceArray) + " after " + badArrays + " failures." );
type: Answer
accepted answer of: http://stackoverflow.com/q/26768046
has comment: http://stackoverflow.com/comment/42119035
has comment: http://stackoverflow.com/comment/42118181
answers question: http://stackoverflow.com/q/26768046
has comment: http://stackoverflow.com/comment/42117611

http://stackoverflow.com/comment/42157939
comment on: http://stackoverflow.com/q/26791074
type: Comment
type: QuestionComment
score: 1
has text: First you need to post your log4j properties

http://stackoverflow.com/comment/42115737
comment on: http://stackoverflow.com/q/26767216
has text: @SJuan76 it's not heavy
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26753414
score: 14
tagged with: netbeans
upvote count: 14
linked to: http://stackoverflow.com/q/23539275
tagged with: java
has answer: http://stackoverflow.com/a/31414217
has answer: http://stackoverflow.com/a/31346433
type: Question
has title: Customize entity generation from database in NetBeans 8
answer count: 2
downvote count: 0
tagged with: templates
has body: I already know how to "create entity classes from datatable" and how to use them etc., but the created entity classes does not completely fit my requirements. For example I need to have extra annotations for ID creation to my ID field. Fields of Type Number(19,0) should be of Type Long instead of BigDecimal or similar I wonder if there is a way to change those entity templates? In my NetBeans IDE I cannot find a way to do so, so "open in Editor" button is disabled, as you can see below. So, is it possibile to change the way those entity classes are created? If yes, where and how to do so?
favorite count: 0
type: UnansweredQuestion
tagged with: code-generation

http://stackoverflow.com/comment/42177656
comment on: http://stackoverflow.com/a/26802171
has text: So what then "..as well as its capability to fall back to 'auto-commit'." means? If we can achieve that with no effort anyway, what does the api docs says? Does spring do something about it to fall back or not?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26681867
has comment: http://stackoverflow.com/comment/41965480
has comment: http://stackoverflow.com/comment/41962659
has comment: http://stackoverflow.com/comment/41962664
has body: I am building a GUI that will read from a text file then generate and write alpha-numeric codes to a text document (.txt) based on user input. I have read a good deal on how to print text files from Java using declarations under the "public static void main(String args []){" section using, by way of example (I understand this may not work and is not my code): public static void main(String args[]) { FileInputSteam fis = new FileInputStream(filename); Doc txtDoc = new SimpleDoc(fis, null, null); DocPrintJob printJob = printService.creatPrintJob(); printJob.print(txtDoc, new HasPrintRequestAttributeSet()); fis.close();} I haven't read too much about how to call up a file from a specific location in a folder, the same file created by the user input, and print it upon user command through the interface, though. For instance, how do I make the above capable of working under a private void printAllBtnActionPerformed(java.awt.event.ActionEvent evt) { sub-declaration that appears above the 'public static void main...' declaration? Any assistance will be appreciated. Thanks!
has title: How to print text files from folder through Java interface
tagged with: file-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41964479
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/41963036
type: Question
tagged with: java

http://stackoverflow.com/q/26798182
tagged with: jpa
score: 0
tagged with: eclipselink
has title: Eclipselink merge does not insert a new row in many-to-many relationship
has comment: http://stackoverflow.com/comment/42223405
has body: I have a many-to-many relationship between user and role entities. when I try to merge a role by adding new user objects to that, after merging i expect a new row in the joined table (in sql server database) to be inserted but nothing happens. I guess the problem is the direction of the relationship which the owner is User entity now and should be switched to Role. But if I change it then my spring security wont work. Is there any other way to solve this? except changing many-to-many sides? Thanks in advance. User class @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable( name = "SEC_USER_ROLE", joinColumns = { @JoinColumn(name = "SEC_USER_ID", referencedColumnName = "SEC_USERS")}, inverseJoinColumns = { @JoinColumn(name = "SEC_ROLE_ID", referencedColumnName = "SEC_ROLES")}) private List&lt;Role&gt; roles; -- Role class @ManyToMany(mappedBy = "roles", fetch = FetchType.EAGER, cascade = CascadeType.ALL) private List&lt;User&gt; users; And here is my merge function @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public T merge(T o) { o = em.merge(o); em.flush(); return o; }
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42182760
has comment: http://stackoverflow.com/comment/42170930
tagged with: many-to-many
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42170354

http://stackoverflow.com/comment/42230478
has text: that's all they said in the test
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26831984
score: 1

http://stackoverflow.com/comment/42007442
type: QuestionComment
has text: instead of adding one block of size 10. It is adding other blocks in (size <10)...
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26707381

http://stackoverflow.com/q/26681902
has comment: http://stackoverflow.com/comment/41962539
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26681936
has body: I created an association list here: HashMap&lt;Integer, String&gt; PhoneNumber = new HashMap&lt;&gt;(); PhoneNumber.put(8559966, "Jill"); PhoneNumber.put(6669999, "James"); PhoneNumber(255666, "Dylan"); What I want to do is call this list in a method but I want to only look at the String half, Jill, James and Dylan. I'm lost on how to do this. I know how to call an ArrayList into a method but not how to call a HashMap and how only look at the Strings. What I want to do is something likes this: public String getJill(ArrayList&lt;Integer&gt; PhoneNumber){ String h; for(int i = 0; i&lt;PhoneNumber.size();; i++){ if(PhoneNumber.values(i) == "Jill"){ h = "Jill"; } return h; } }
score: 1
tagged with: java
upvote count: 1
tagged with: methods
type: Question
tagged with: hashmap
has title: Association list, Arraylist Java
tagged with: arraylist

http://stackoverflow.com/q/26826116
has answer: http://stackoverflow.com/a/26826197
score: 0
has body: I have initialized an arraylist like the following: private ArrayList&lt;Automobile&gt; car = new ArrayList(); Then in the constructor i have the following: public vehicles() { car = new ArrayList(); } Could someone tell me is the second part in the constructor vehicles (car = new ArrayList();) really needed? What does it do?
has answer: http://stackoverflow.com/a/26826129
has title: Java - Arraylist implementation doubtt
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26826185
has answer: http://stackoverflow.com/a/26826265
has answer: http://stackoverflow.com/a/26826162
type: Question
has answer: http://stackoverflow.com/a/26826125
tagged with: java
answer count: 6

http://stackoverflow.com/comment/42030790
type: Comment
comment on: http://stackoverflow.com/a/26720144
score: 0
type: AnswerComment
has text: @anurag1018: Now would be a good time to learn to use a debugger, to understand what your code is doing.

http://stackoverflow.com/q/26724663
has comment: http://stackoverflow.com/comment/42038752
tagged with: text-files
tagged with: text
tagged with: character
has comment: http://stackoverflow.com/comment/42062893
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42038820
has body: I am writing a program using Java that will scan a text file, then delete the "\n" character that eliminates the line separations in the text file.... I have already written the program that reads the file and prints in into another... Here it is: import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.BufferedWriter; public class test { public static void main( String args[] ) { try { BufferedReader br = new BufferedReader(new FileReader( "HumanProtein" )); BufferedWriter bw = new BufferedWriter(new FileWriter( "BIOIhonorsproject" )); String line; while ((line = br.readLine()) != null) { bw.write( line + "\n" ); } br.close(); bw.close(); }
tagged with: java
has title: Create program that deletes a specific character in file
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/26725025
has answer: http://stackoverflow.com/a/26724850
has comment: http://stackoverflow.com/comment/42038764
has comment: http://stackoverflow.com/comment/42062863

http://stackoverflow.com/comment/42176974
has text: [Related](http://stackoverflow.com/questions/2018553/swt-no-more-handles).
score: 1
comment on: http://stackoverflow.com/q/26801704
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42171705
has text: @AbimaranKugathasan *Indent* :)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26798896
type: Comment

http://stackoverflow.com/comment/105216515
comment on: http://stackoverflow.com/a/26716272
type: Comment
score: 0
has text: I've having the same issue as @mohamnag, the bridge works for the first page load but not subsequent ones.
type: AnswerComment

http://stackoverflow.com/comment/42198768
has text: @AvinashRaj `hhaiha` will give `iha`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26813420
score: 0

http://stackoverflow.com/a/26805339
has comment: http://stackoverflow.com/comment/42184174
score: 0
has body: MinGW has not an API by itself if what you are thinking about is a library. The only viable approach is to launch the compiler as a process. The links you have referred explain how to, just follow them.
has comment: http://stackoverflow.com/comment/42183682
answers question: http://stackoverflow.com/q/26805057
type: Answer
has comment: http://stackoverflow.com/comment/42183872

http://stackoverflow.com/a/26751865
type: Answer
answers question: http://stackoverflow.com/q/26751705
score: 2
upvote count: 2
has body: Try this... int number; do{ System.out.println("Please enter a number"); number = scan.nextInt(); if(number == 1) { System.out.println("Number is 1") ; } else if(number == 2) { System.out.println("Number is 2") ; } else { System.out.println("Invalid selection") ; } }while(number!=1 &amp;&amp; number!=2);
downvote count: 0

http://stackoverflow.com/q/26816982
has title: Ajax not working in jsf view
has answer: http://stackoverflow.com/a/26818291
tagged with: jsf
tagged with: primefaces
score: 0
tagged with: java
tagged with: primefaces-extensions
has body: In a JSF Primefaces / PrimefacesExtension app, i have some ajax misbehaviour. There is a section of the view, only shown when a condition is true: &lt;h:form id="membership" rendered="#{empty registerVisitBean.partner.activeMembership.payDate}"&gt; Inside, there are 2 grids: first one with red text and a button to make action (pay a membership), this first grid will dissapear when action done, and a second one will be shown: &lt;p:panelGrid id="not_paid" layout="grid" columns="2" rendered="#{!registerVisitBean.paid}"&gt; &lt;h:outputText value="No pagada" styleClass="data-text red" /&gt; &lt;p:commandButton value="Pagar" actionListener="#{registerVisitBean.payMembership}" update="paid,not_paid" /&gt; &lt;/p:panelGrid&gt; &lt;p:panelGrid id="paid" layout="grid" columns="1" rendered="#{registerVisitBean.paid}"&gt; &lt;h:outputText value="#{registerVisitBean.partner.activeMembership.payDate}" styleClass="data-text" /&gt; &lt;/p:panelGrid&gt; The view is quite long, but other parts have independent forms and are not important here... The &lt;form&gt; tag is NOT nested inside other &lt;form&gt; but it is in other &lt;p:panelGrid&gt;, but not a problem i think, this is happening in same view to change the color of an element after making action and works perfect: &lt;h:form id="notes"&gt; &lt;p:panelGrid id="partner_notes" layout="grid" columns="1" &gt; &lt;p:inputTextarea value="#{registerVisitBean.partnerNotes}" id="notes" rows="2" autoResize="false" styleClass="#{registerVisitBean.saved ? 'full-width unresizable success' : 'full-width unresizable'}" style="padding: 0"&gt;&lt;/p:inputTextarea&gt; &lt;p:commandButton value="Guardar Notes" actionListener="#{registerVisitBean.updateNotes}" styleClass="full-width" update=":notes:partner_notes"/&gt; &lt;/p:panelGrid&gt; &lt;/h:form&gt; I think problem is in the update part of the &lt;p:commandButton&gt; but i've tried several ways without succeed. NOTE: bean code is being executed: private boolean paid; // ( getter / setter)…
type: UnansweredQuestion
type: Question
answer count: 1

http://stackoverflow.com/comment/42161509
has text: @JohnnyCoder you can't edit size of a array while runing .that's why i told you use arraylist .but if you are not llowed to use arraylist you can set SIZE_YOU_DESIRE to 5 .but then if user input less then 5 data you are wasting memory .
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26792582

http://stackoverflow.com/a/26810925
type: Answer
score: 4
has body: You can easily write your own Collector public class AllOrNothing&lt;T&gt; implements Collector&lt;T, Set&lt;T&gt;, Optional&lt;T&gt;&gt;{ @Override public Supplier&lt;Set&lt;T&gt;&gt; supplier() { return () -&gt; new HashSet&lt;&gt;(); } @Override public BinaryOperator&lt;Set&lt;T&gt;&gt; combiner() { return (set1, set2)-&gt; { set1.addAll(set2); return set1; }; } @Override public Function&lt;Set&lt;T&gt;, Optional&lt;T&gt;&gt; finisher() { return (set) -&gt; { if(set.size() ==1){ return Optional.of(set.iterator().next()); } return Optional.empty(); }; } @Override public Set&lt;java.util.stream.Collector.Characteristics&gt; characteristics() { return Collections.emptySet(); } @Override public BiConsumer&lt;Set&lt;T&gt;, T&gt; accumulator() { return Set::add; } } Which you can use like this: Optional&lt;T&gt; result = myStream.collect( new AllOrNothing&lt;&gt;()); Here's your example test data public static void main(String[] args) { System.out.println(run()); System.out.println(run(1)); System.out.println(run(1,1)); System.out.println(run(2,2)); System.out.println(run(1,2)); } private static Optional&lt;Integer&gt; run(Integer...ints){ List&lt;Integer&gt; asList = Arrays.asList(ints); System.out.println(asList); return asList .stream() .collect(new AllOrNothing&lt;&gt;()); } which when run will print out [] Optional.empty [1] Optional[1] [1, 1] Optional[1] [2, 2] Optional[2]
has comment: http://stackoverflow.com/comment/42194528
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26810375
has comment: http://stackoverflow.com/comment/42194465

web-services
tags question: http://stackoverflow.com/q/26700393
type: Tag
tags question: http://stackoverflow.com/q/26675967
tags question: http://stackoverflow.com/q/26675905
tags question: http://stackoverflow.com/q/26822505
tags question: http://stackoverflow.com/q/26796179
tags question: http://stackoverflow.com/q/26804823
tags question: http://stackoverflow.com/q/26806528
tags question: http://stackoverflow.com/q/26793446
tags question: http://stackoverflow.com/q/26811919
tags question: http://stackoverflow.com/q/26732973
tags question: http://stackoverflow.com/q/26728736
tags question: http://stackoverflow.com/q/26731357
tags question: http://stackoverflow.com/q/26713743
tags question: http://stackoverflow.com/q/26826668
tags question: http://stackoverflow.com/q/26794176
tags question: http://stackoverflow.com/q/26770863
tags question: http://stackoverflow.com/q/26814001
tags question: http://stackoverflow.com/q/26784038
tags question: http://stackoverflow.com/q/26767801
tags question: http://stackoverflow.com/q/26788608
tags question: http://stackoverflow.com/q/26829456
tags question: http://stackoverflow.com/q/26780917
tags question: http://stackoverflow.com/q/26822963
tags question: http://stackoverflow.com/q/26781613
tags question: http://stackoverflow.com/q/26782670
tags question: http://stackoverflow.com/q/26804640
tags question: http://stackoverflow.com/q/26726191
tags question: http://stackoverflow.com/q/26712587
tags question: http://stackoverflow.com/q/26802658
tags question: http://stackoverflow.com/q/26735941
tags question: http://stackoverflow.com/q/26814293
tags question: http://stackoverflow.com/q/26717514
tag name: web-services
tags question: http://stackoverflow.com/q/26702300
tags question: http://stackoverflow.com/q/26802004
tags question: http://stackoverflow.com/q/26732875
tags question: http://stackoverflow.com/q/26750394
tags question: http://stackoverflow.com/q/26766366
tags question: http://stackoverflow.com/q/26715533
tags question: http://stackoverflow.com/q/26808987
tags question: http://stackoverflow.com/q/26741633
tags question: http://stackoverflow.com/q/26736521
tags question: http://stackoverflow.com/q/26766240

http://stackoverflow.com/q/26748616
has answer: http://stackoverflow.com/a/26749562
accepted answer: http://stackoverflow.com/a/26749562
type: AnsweredQuestion
has body: I made a Oracle Package like below. And I will pass parameter String like '2014-11-05'. --SEARCH 2014 11 04 FUNCTION SEARCHMYPAGE(v_created_after IN DATE, v_created_before IN DATE) return CURSORTYPE is rtn_cursor CURSORTYPE; BEGIN OPEN rtn_cursor FOR select news_id from ( select news_id, news_title, news_desc, created, news_cd from news ) where 1=1 AND (created BETWEEN decode(v_created_after, '', to_date('2000-01-01', 'YYYY-MM-DD'), to_date(v_created_after, 'YYYY-MM-DD')) AND (decode(v_created_before, '', sysdate, to_date(v_created_before, 'YYYY-MM-DD')) + 0.999999)); return rtn_cursor ; END SEARCHMYPAGE; I confirmed my parameter in Eclipse console Message, since I am working on Eclipse IDE. I got contents, which are made in 2014-10-29 ~ 2014-10-31. when I pass '2014-11-01' as created_after, It returns 0 records.(But I expected all contents, since every contents are made between 10-29 and 10-31) Would you find anything wrong with my Function? Thanks :D
has title: Comparing Date type in Oracle PACKAGE does not work
tagged with: java
type: Question
tagged with: date
score: 0
tagged with: sql
answer count: 1
tagged with: oracle-database
tagged with: package

http://stackoverflow.com/q/26824570
favorite count: 0
tagged with: time
type: UnansweredQuestion
upvote count: 1
tagged with: performance
score: 1
tagged with: java
type: Question
has body: This is a leetcode question. "Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum." But my code can't pass test case because of time exceeded limit. But the solution code(https://oj.leetcode.com/discuss/15169/14-line-solution-in-java-using-recursion) can pass the test case. I don't figure out is there any big difference with two version codes? My code: public class Solution { List&lt;List&lt;Integer&gt;&gt; res = new ArrayList&lt;List&lt;Integer&gt;&gt;(); public List&lt;List&lt;Integer&gt;&gt; pathSum(TreeNode root, int sum) { if (root == null) return res; List&lt;Integer&gt; t = new ArrayList&lt;Integer&gt;(); has(root, sum, t); return res; } public void has(TreeNode root, int sum, List&lt;Integer&gt; t) { if (root == null) return; if (root.left == null &amp;&amp; root.right == null &amp;&amp; sum == root.val) { t.add(root.val); res.add(t); return; } t.add(root.val); has(root.right, sum - root.val, t); has(root.left, sum - root.val, t); return; } } Solution: public class Solution { public static List&lt;List&lt;Integer&gt;&gt; pathSum(TreeNode root, int sum) { List&lt;List&lt;Integer&gt;&gt; list = new ArrayList&lt;List&lt;Integer&gt;&gt;(); if(root==null) return list; if (root.val==sum &amp;&amp; root.left==null &amp;&amp; root.right==null) { list.add(new ArrayList&lt;Integer&gt;()); list.get(list.size()-1).add(root.val); return list; } list.addAll(pathSum(root.left, sum-root.val)); list.addAll(pathSum(root.right, sum-root.val)); for(List&lt;Integer&gt; l:list) l.add(0, root.val); return list; } }
has answer: http://stackoverflow.com/a/26824913
has title: Time efficiency of binary tree traversal
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/42070614
type: Comment
score: 0
has text: @user1629055 - Leave `price` as `double` (especially, if you use it for calculations).
type: AnswerComment
comment on: http://stackoverflow.com/a/26742353

http://stackoverflow.com/q/26763689
type: UnansweredQuestion
has title: Apache Commons CLI allow argument option or no argument option
tagged with: java
has answer: http://stackoverflow.com/a/26764106
tagged with: apache-commons-cli
type: Question
has comment: http://stackoverflow.com/comment/42108788
has body: Simply, I am wondering if it is possible to have an argument accept an option or accept no option. This is useful for listing. Example: -a will list possible options while -a stuff will use that stuff to do things. Here is my current code: options.addOption("f", "look-and-feel", false, "This sets the look and feel."); //Some stuff happens here if (cmd.hasOption('f')) { String laf = cmd.getOptionValue('f'); System.out.println(laf); if (laf == null) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { System.out.println(info.getClassName()); } return; } else { setLookAndFeel(laf); } } else { setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } Typing -f lists the look and feels correctly, while specifying it -f com.laf.LookAndFeel still lists it. Any ideas?
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/26822697
upvote count: 1
has answer: http://stackoverflow.com/a/26823762
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: interface
tagged with: android
has answer: http://stackoverflow.com/a/26822850
has body: I have an inner AsyncTask which i have call from a fragment outside the fragment which contains this AsyncTask. I have read and saw some examples where they use an interface. I can't figure it out on how to implement it in my project. This is my inner AsyncTask: public class LoadQueueTask extends AsyncTask&lt;Void, Void, Queue&gt; { @Override protected Queue doInBackground(Void... arg0) { Model model = Model.getInstance(); return model.getQueue(); } @Override protected void onPostExecute(Queue result) { super.onPostExecute(result); queue = result; if(result == null) { listview.setEmptyView(empty); progress.setVisibility(View.GONE); listview.setVisibility(View.VISIBLE); emptyText.setText("Empty Queue"); emptyImage.setImageResource(R.drawable.ic_action_warning); } else { if(result.getSlots().size() != 0) { Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { @Override public void run() { callAsynchronousTask(); } }, 5000); } else { listview.setEmptyView(empty); progress.setVisibility(View.GONE); listview.setVisibility(View.VISIBLE); emptyText.setText("No items found"); } } } } Here is my fragment where i want to execute this task: public class Fragment extends SherlockFragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment, container, false); } ViewPager mViewPager = (ViewPager) rootView.findViewById(R.id.viewPager); kbps = (TextView) rootView.findViewById(R.id.speed); refresh = (ImageView) rootView.findViewById(R.id.refresh); refresh.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //CALL ASYNCTASK HERE } }); return rootView; }
tagged with: android-fragments
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26822852
answer count: 3
has title: Call inner AsyncTask from outside fragment

http://stackoverflow.com/q/26758072
has comment: http://stackoverflow.com/comment/42097729
has comment: http://stackoverflow.com/comment/42097977
has comment: http://stackoverflow.com/comment/42097909
score: 3
possible better answer: http://stackoverflow.com/a/26759210
accepted answer: http://stackoverflow.com/a/26759814
upvote count: 3
tagged with: swing
tagged with: logging
type: AnsweredQuestion
has body: Are there any smart ways to reduce logging of "equals" exceptions? For example: java.lang.IllegalArgumentException: Wrong parameter, should be a float from 0 to 100 at com.test.Foo.setAmount(Foo.java:93) at com.test.Bar.setAmounts(Bar.java:39) at com.test.Bar2.init(Bar2.java:152) at java.awt.event.InvocationEvent.dispatch(Unknown Source) [na:1.7.0_65] at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [na:1.7.0_65] at java.awt.EventQueue.access$200(Unknown Source) [na:1.7.0_65] at java.awt.EventQueue$3.run(Unknown Source) [na:1.7.0_65] at java.awt.EventQueue$3.run(Unknown Source) [na:1.7.0_65] at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_65] at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [na:1.7.0_65] at java.awt.EventQueue.dispatchEvent(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [na:1.7.0_65] at java.awt.EventDispatchThread.run(Unknown Source) [na:1.7.0_65] such exception can be thrown 90 times per second under specific circumstances. We use AWT handler to log exceptions, and it can "freeze" all Swing's application. The first workaround which came to mind was to log exceptions in a different thread, but such approch may be a real hell in later debug. The second thought was to put exceptions in a WeakHashMap and log exception only for first occurance. Im not sure how to perform equals for exception and whether it will be fast enough at all.
has title: Reduce logging of the same exceptioins
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26759814
downvote count: 0
has answer: http://stackoverflow.com/a/26759210
favorite count: 0

http://stackoverflow.com/q/26766119
favorite count: 0
tagged with: textfield
linked to: http://stackoverflow.com/q/10136794
accepted answer: http://stackoverflow.com/a/26766185
has body: It appears in java there is no way to limit the length. I looked at other examples, and people have created separate classes etc. I am curious if we can do this using the action event without using other classes. Here is what I have so far. txtTest.addKeyListener(new KeyAdapter() public void keyPressed(KeyEvent e) { int MAX_LEN = 5; char c = e.getKeyChar(); int len = txtTest.getText().length(); if(len &lt; MAX_LEN) { return; }else { Logging.info("TOOO LONG"); } } }); So i got to the point where if I type in text longer then 5 char. Is there any event that I could trigger off so if they type in the 6 char, it will just be deleted? E.g mimic the backspace or delete key?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
has title: Java Textfield set char length
has answer: http://stackoverflow.com/a/26766185
type: Question
possible better answer: http://stackoverflow.com/a/26766605
duplicate of: http://stackoverflow.com/q/10136794
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26766605

http://stackoverflow.com/comment/130596370
type: Comment
has text: Why? As httpcore-nio dependency should already come via 'httpasyncclient' dependency.
comment on: http://stackoverflow.com/a/33288232
score: 0
type: AnswerComment

http://stackoverflow.com/q/26789819
upvote count: 0
has answer: http://stackoverflow.com/a/26789927
score: -4
tagged with: printf
has comment: http://stackoverflow.com/comment/42155842
has comment: http://stackoverflow.com/comment/42155895
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42155964
accepted answer: http://stackoverflow.com/a/26790047
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42156117
has title: Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '_'
has comment: http://stackoverflow.com/comment/42155874
tagged with: java
has body: The problem is Conversion = "_". The source code is here. I tried to read a txt and its ok! Then the code "tokenize" the words and its ok too. But when I try to save in another txt I get this error. But if I DELETE "__" it save successfully but I don't want to delete "_"! This is a program used for tokenize some words. I just want to know what I should do in that line. Or what I can do to run my project without this exception. Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '_' at cugru.test.main(test.java:81) At line 81!! Here is the code: package cugru; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Locale; import org.cogroo.analyzer.Analyzer; import org.cogroo.analyzer.ComponentFactory; import org.cogroo.text.Document; import org.cogroo.text.impl.DocumentImpl; public class test { public static void main(String[] args) throws IOException { FileReader reader = new FileReader(new File("D:/Felipe/Downloads/eclipse/workspace/java worskpace luna/Excel java/sumarios/gold sem tokens.txt")); BufferedReader leitor = new BufferedReader(reader); String linha = null; int contadorTokens = 0; FileWriter arq = new FileWriter("d:\\tabuada.txt"); PrintWriter gravarArq = new PrintWriter(arq); //Cria procedimentos padrao do CoGrOO ComponentFactory factory = ComponentFactory.create(new Locale("pt", "BR")); Analyzer cogroo = factory.createPipe(); int qtde = 0; while((linha = leitor.readLine()) != null) { qtde++; if(qtde &gt;10) break; //linha = linha.toLowerCase(); //deixa em minusculo //System.out.println(linha); linha = expandirAcronimos(linha); //System.out.println(linha); //System.out.println("======================================"); /** for (int i = 0; i &lt; sentenca.length; i++) { sentenca = linha.split(" ");// separa a "linha" emdentro das aspas) e joga para o array sentenca // System.out.println(sentenca[i]);i…
has answer: http://stackoverflow.com/a/26790047
possible better answer: http://stackoverflow.com/a/26789927

http://stackoverflow.com/comment/42209857
type: Comment
type: QuestionComment
has text: Generics, primitive types, and arrays don't play well. Use a `Collection` type.
score: 0
comment on: http://stackoverflow.com/q/26820094

http://stackoverflow.com/q/26751307
favorite count: 0
has answer: http://stackoverflow.com/a/26751392
possible better answer: http://stackoverflow.com/a/26751347
has body: I've made a login script in JSP. It's working fine but the problem as i use <%=session.getAttribute("first_name")%> it shows Null. Can you please tell me what's wrong here? Main.jsp: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% if ((session.getAttribute("user_email") == null) || (session.getAttribute("user_email") == "")) { response.sendRedirect("login.jsp"); %> <%} else %> Welcome to the job seeker forum. Welcome <%=session.getAttribute("first_name")%>, to Job seeker forum, there are many openings that you can get through here. logout Want to post on going walking, Post your job description here. Job title: Your Question: Here is login_process.jsp <%@ page import="java.sql.*" %> <% String user_email=request.getParameter("user_email"); String user_password=request.getParameter("user_password"); Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:8888/login", "root", "1234"); Statement st=con.createStatement(); ResultSet rs; rs=st.executeQuery("select * from members where email='"+user_email+"' and password='"+user_password+"'"); if(rs.next()){ session.setAttribute("user_email", user_email); response.sendRedirect("main.jsp"); }else{ out.println("Invalid Password... Try again.. login"); } %> Here is my created database table: create table `members`( `id` int(10) unsigned NOT NULL auto_increment, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `first_name` varchar(50) NOT NULL, `last_name` varchar(50) NOT NULL, PRIMARY KEY(`id`) )ENGINE= InnoDB default charset=latin1; This is what i'm getting error... SCREENSHOT: https://i.sstatic.net/AuF5M.png
has comment: http://stackoverflow.com/comment/42086391
has comment: http://stackoverflow.com/comment/42086301
answer count: 4
has comment: http://stackoverflow.com/comment/42086256
type: AnsweredQuestion
has title: User name is not showing in web page from database?
has comment: http://stackoverflow.com/comment/42086290
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26751412
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/26751634
type: Question
accepted answer: http://stackoverflow.com/a/26751392
tagged with: database
tagged with: jsp
tagged with: servlets
downvote count: 0
has answer: http://stackoverflow.com/a/26751347

http://stackoverflow.com/comment/42075404
type: Comment
comment on: http://stackoverflow.com/a/26740288
has text: Thanks! I was even reading this chapter but totally overlooked this part. Just tried it out. Thats probably all I need.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/68352646
score: 0
comment on: http://stackoverflow.com/a/26794863
type: AnswerComment
type: Comment
has text: `AbstractFormatter` is serializable, so the `DateLabelFormatter` needs to either `@SuppressWarnings("serial")` or include `private static final long serialVersionUID`.

http://stackoverflow.com/a/26774136
score: 4
has comment: http://stackoverflow.com/comment/42127591
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42127387
type: Answer
accepted answer of: http://stackoverflow.com/q/26774019
answers question: http://stackoverflow.com/q/26774019
has comment: http://stackoverflow.com/comment/42130203
has comment: http://stackoverflow.com/comment/42128143
has body: URLs are "write-once" objects by you (who are just using URL objects). You can't modify them. URLs have to be created and initialized internally, sometime, so someone has to modify them. Optimally this would have to be done in its constructor, but that would lose flexibility. URLs can point to a variaty of objects and the implementation to access and handle them is not restricted to the standard library, you can write implementations to handle custom protocols. Btw, in Java 8 they are not protected, but package private which is even more restrictive (but not that it really matters since URL class is declared final anyway so you cannot subclass it). Edit: Example The URL class has many constructors: some allows you to specify different parts of the URL like protocol, host, port etc., and there are some which allows you to specify the URL as one String: spec. In the latter case (if URL is specified as one String), the different parts of the URL (protocol, host, port etc.) has to be parsed from the String. This parsing is done by a URLStreamHandler which when done parsing the String in the implementation of the URLStreamHandler.parseURL() method have to use the URL.set() method to set the different parts "back" to the URL class because the fields holding these parts are private and there are no setter methods for them. Since the parsing is done in another class (URLStreamHandler), URL provides a non-public method to receive the parsing result. This provides flexibility as you can replace/extend the URLStreamHandler but still allows URL to be declared final and be "write-once".

java-memory-model
tags question: http://stackoverflow.com/q/26788260
type: Tag
tag name: java-memory-model
tags question: http://stackoverflow.com/q/26724443
tags question: http://stackoverflow.com/q/26811382

http://stackoverflow.com/q/26719127
has title: Trouble importing android.support.v7.widget.CardView into Eclipse
answer count: 6
upvote count: 14
has answer: http://stackoverflow.com/a/35733335
has comment: http://stackoverflow.com/comment/42028714
tagged with: android
has comment: http://stackoverflow.com/comment/42028532
has comment: http://stackoverflow.com/comment/42028478
has body: I use Eclipse and I'm trying to create an application using the new support-library-v7:21.+ from Lollipop. Created my new project imported in eclipse the support-library-v7 changed in project-properties of support library the line: target=android-21 with 21 target changed the target of my application in 21 imported the library in my project clean all After all i still got the invalid R declaration. I restarted Eclipse and then, after re-importing the library, seem went! I created a Tolbar and a NavigationDrawer as well without problem - it works. Now, i would like to put a CardView in my ListView items: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:card_view="http://schemas.android.com/apk/res-auto" &gt; &lt;!-- A CardView that contains a TextView --&gt; &lt;android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_gravity="center" android:layout_width="200dp" android:layout_height="200dp" card_view:cardCornerRadius="4dp"&gt; &lt;TextView android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/codename" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/versione" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/link" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/timestamp" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;/android.support.v7.widget.CardView&gt; &lt;/LinearLayout&gt; well, first error: No resource identifier found for attribute 'cardCornerRadius'. I tried to delete the attribute, restart the application but I get a the following crash: java.lang.RuntimeException: …
favorite count: 0
tagged with: android-support-library
possible better answer: http://stackoverflow.com/a/26812171
has answer: http://stackoverflow.com/a/29387164
has answer: http://stackoverflow.com/a/26812171
score: 14
has answer: http://stackoverflow.com/a/26719469
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26719469
downvote count: 0
tagged with: java
tagged with: material-design
has answer: http://stackoverflow.com/a/29386816
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/26700970
has answer: http://stackoverflow.com/a/29198768

http://stackoverflow.com/a/26812352
has body: There should be no semi-colon after the if statements. The if statement should be as follows: if(GradeAverage &gt; 60 &amp;&amp; GradeAverage &lt;= 100)
answers question: http://stackoverflow.com/q/26812323
type: Answer
downvote count: 1
upvote count: 5
score: 4

http://stackoverflow.com/comment/41968986
type: Comment
comment on: http://stackoverflow.com/a/26685341
type: AnswerComment
has text: The code I provided is nearly identical minus the adding data part, which in this case isn't necessary. Any other ideas?
score: 0

http://stackoverflow.com/q/26793670
tagged with: return
has comment: http://stackoverflow.com/comment/42162308
has title: Return last name Java method
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26793884
has body: I'm pretty new at java and came upon this challenge: I have a method which reads a full name (doesn't have limit of number of names a person can have) and saves it in an array. This is what I have until now: public static int readNames (String[] args) { int i=0, cont=0; String name[] = new String[99]; Scanner in = new Scanner(System.in); for (i = 0; i &lt; name.length; i++) { name[99] = in.nextLine(); while(name[99].equalsIgnoreCase("END")) { name[99] = in.nextLine(); cont++; } } return cont; Now I need to create another method that receives by parameter a name saved in the array name[i] and returns the last name of the full name of it (sorry if I sound confusing!) Something like: public static (?) lastName (String[] name) { } Thanks for the help!
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42162443
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/42162414
has comment: http://stackoverflow.com/comment/42162501
has answer: http://stackoverflow.com/a/26793717
has comment: http://stackoverflow.com/comment/42162625

http://stackoverflow.com/q/26810548
has comment: http://stackoverflow.com/comment/42194128
upvote count: 1
tagged with: arrays
has body: I'm trying to create a custom function for adding/removing elements in arrays in Java. So I made something like this. public class Arrays { static final int MAX_ELEMENTS = 10; int element; int[] add_Element(int array[], int index, int new_element) { int new_array[] = new int[array.length+1]; int amount_of_elements = array.length; if(index &gt; amount_of_elements) { System.out.printf("Choose new index\n"); } else if(amount_of_elements == MAX_ELEMENTS) { System.out.println(amount_of_elements); System.out.printf("The array is full\n"); } else { for(int i = 0; i &lt; index; i++) { new_array[i] = array[i]; } for(int i = amount_of_elements - 1; i &gt;= index; i--) { new_array[i + 1] = array[i]; } new_array[index] = new_element; System.out.printf("The element is added.\n"); } return new_array; } int[] remove_Element(int array[], int element) { int[] new_array = new int[array.length - 1]; int amount_of_elements = array.length; boolean found = false; for(int i = 0; i &lt; amount_of_elements; i++) { if(array[i] == element) { for(int j = i; j &lt; amount_of_elements -1; j++) { new_array[j] = array[j + 1]; } for(int j = 0; j &lt; i; j++) { new_array[j] = array[j]; } found = true; } } if(found == true) { System.out.printf("The element is removed.\n"); } return new_array; } } This works fine, but I'm wondering, is there any 'easier' way to do this? Without all these checks, and loops? Preferably without using any external libraries or anything like that. Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/42193597
has title: Create custom function to add/remove elements in array in Java
has comment: http://stackoverflow.com/comment/42193892
downvote count: 0
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42193649
score: 1
tagged with: java

http://stackoverflow.com/q/26786550
accepted answer: http://stackoverflow.com/a/26786591
has answer: http://stackoverflow.com/a/26786603
has comment: http://stackoverflow.com/comment/42150024
has comment: http://stackoverflow.com/comment/42150098
possible better answer: http://stackoverflow.com/a/26786722
score: 0
has answer: http://stackoverflow.com/a/26786722
answer count: 3
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/42150141
has title: EventHandler implemented as an anonymous inner class
has comment: http://stackoverflow.com/comment/42150621
has answer: http://stackoverflow.com/a/26786591
has body: I wan't to use keyword this in refer to my main class in the EventHandler block, say: public class Extra { private SuperObject object; public Extra() { Button.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent ae) { object = new SuperObject(this); } }); } } // where... public class SuperObject { public SuperObject(Extra e) { // something } } But in this case I've got an warning about that I haven't declare a constructor for the SuperObject class with ActionEvent parameter in it. What can I do in such situation?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42150271
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/q/26807020
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
tagged with: caching
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26818538
favorite count: 0
tagged with: immutability
has body: I was wondering what would happen, if I change a property of a DOM object retrieved from Hibernates second level cache. I found this quote: 2nd level cache stores a map of entities' IDs to other properties (it doesn't actually store objects, but the data itself) in this answer: https://stackoverflow.com/a/7059822/2468620. This should mean that when I retrieve an entity from second level cache, it is "freshly" created from the stored raw data. Therefore if I change properties of this entity, it shouldn't affect the data stored in second level cache. That meaning when I retrieve the entity again in another session, its properties should not be affected by the described change. For examle: user = userDao.find(1); // get user stored in second level cache System.out.println(user.getName()); // returns "originalName" user.setName("modifiedName"); // === this is done in a different session === user = userDao.find(1); System.out.println(user.getName()); // should return "originalName" I tried the above example with eh-cahce and it really works but my question is: Is this behavior guaranteed? I mean if I can depend on it even when I change the cache provider, or when the implementation of my used cache provider changes? I looked in the JPA specification and didn't find information on this.
linked to: http://stackoverflow.com/q/7058843
upvote count: 1
has title: Are objects stored in Hibernates 2nd level cache guaranteed to be "immutable"?
has answer: http://stackoverflow.com/a/26818538

http://stackoverflow.com/a/26800339
type: Answer
answers question: http://stackoverflow.com/q/26800258
upvote count: 1
has body: It will get wrapped into a SynchronizedMap, from java.util.Collections: public static &lt;K,V&gt; Map&lt;K,V&gt; synchronizedMap(Map&lt;K,V&gt; m) { return new SynchronizedMap&lt;&gt;(m); } The synchronizedMap() method does not distinguish between the types of Maps passed into it.
downvote count: 0
score: 1

http://stackoverflow.com/q/26759954
favorite count: 0
has body: lets say i have the following code: for (AnyObject anyObject : anyObjectList) { System.out.println(anyObject.doSomething()); } My question is: I read that its possible to add null to at least some kind of list types. If im right: shouldn't be there always a null check before you access the method of the iterated class? Im just asking because i have never seen so far a enhanced for loop with a null check like this for example: for (AnyObject anyObject : anyObjectList) { if (anyObject != null) { System.out.println(anyObject.doSomething()); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/42101174
has answer: http://stackoverflow.com/a/26760083
has comment: http://stackoverflow.com/comment/42101278
tagged with: foreach
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26760083
tagged with: java
has title: Enhanced for loop and null check of objects
has comment: http://stackoverflow.com/comment/42101273
has answer: http://stackoverflow.com/a/26760037
type: Question
tagged with: for-loop
downvote count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26760037
has answer: http://stackoverflow.com/a/28213215

http://stackoverflow.com/a/26691998
type: Answer
has comment: http://stackoverflow.com/comment/41981425
has comment: http://stackoverflow.com/comment/41981298
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26691940
downvote count: 0
has body: Use a Comparator Arrays.sort(items, new Comparator&lt;Product&gt;() { @Override public int compare(final Product p1, Product p2) { // TODO check for null object return p1.getName().compareTo(p2.getName()); } });

http://stackoverflow.com/comment/41970249
score: 1
comment on: http://stackoverflow.com/a/26686178
type: Comment
type: AnswerComment
has text: There is a space between the dots. *And* it is synonym for source.

http://stackoverflow.com/q/26734751
has answer: http://stackoverflow.com/a/26735399
answer count: 1
tagged with: json-rpc
has body: I'm trying to connect to the transmission rpc interface via C#/Java to get some informations back. https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt Unfortunatly I have problems to get the correct HTTP-Post to access the interface. For example if I try this in C#: using (var client = new WebClient()) { var values = new NameValueCollection(); values["torrent-get"] = "id"; var response = client.UploadValues("http://ip:9091/transmission/rpc", values); var responseString = Encoding.Default.GetString(response); Console.WriteLine("" + responseString); } Or if i use: using (var webClient = new WebClient()) { String json = "{\"arguments\": {\"fields\": [ \"id\", \"name\", \"totalSize\" ],\"ids\": [ 7, 10 ]},\"method\": \"torrent-get\",\"tag\": 39693}"; var response = webClient.UploadString("http://192.168.240.171:9091/transmission/rpc", "POST", json); Console.WriteLine(""+response); } I get the following error: An unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The Remoteserver returned an exception: (409) conflict.
tagged with: rpc
has title: Connect to json-rpc interface
score: 0
type: UnansweredQuestion
type: Question
tagged with: c#
tagged with: java
tagged with: transmission

http://stackoverflow.com/comment/81659863
score: 0
type: QuestionComment
type: Comment
has text: If it has to be synchronized, then you are calling some method of an object or static method of a class. So you can simply use a lock on that object or class like assylias suggested in [the accepted answer](https://stackoverflow.com/a/26744823/2237467).
comment on: http://stackoverflow.com/q/26744360

http://stackoverflow.com/comment/42227579
has text: @shayanpourvatan, thanks for noticing it. Updated question. This happens only for some users. I have following permissions <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />.
score: 0
comment on: http://stackoverflow.com/q/26830182
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42035531
type: AnswerComment
comment on: http://stackoverflow.com/a/26722435
score: 0
type: Comment
has text: Yes, this is the programatic way to protect the code (the opposite way is to define procedural roles). This only solves the first goal, but not both of them at the same time. I'm looking for a solution which solves both of them.

http://stackoverflow.com/q/26676614
has title: Individual array elements to string in Java
has comment: http://stackoverflow.com/comment/41952428
tagged with: arrays
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26676862
has answer: http://stackoverflow.com/a/26676817
answer count: 3
has comment: http://stackoverflow.com/comment/41952376
has comment: http://stackoverflow.com/comment/41952429
duplicate of: http://stackoverflow.com/q/7655127
has answer: http://stackoverflow.com/a/26676729
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: I have an array of type char which has some characters stored in it. I want to take each individual character and store it in a string. How do i do that?
linked to: http://stackoverflow.com/q/8172420
tagged with: java
score: -1
type: Question

path
tags question: http://stackoverflow.com/q/26733103
tags question: http://stackoverflow.com/q/26761583
tags question: http://stackoverflow.com/q/26814218
tags question: http://stackoverflow.com/q/26723341
tags question: http://stackoverflow.com/q/26760951
type: Tag
tags question: http://stackoverflow.com/q/26674037
tags question: http://stackoverflow.com/q/26688108
tags question: http://stackoverflow.com/q/26686084
tags question: http://stackoverflow.com/q/26806450
tag name: path

http://stackoverflow.com/a/26697667
answers question: http://stackoverflow.com/q/26691724
type: AcceptedAnswer
downvote count: 0
has body: As Thorbjørn pointed out the issue was due to the server's capacity. The 1st servers ram limit was 512 mb and no swap space (the hoster doesn't provide swap initially). Increasing the swap space lead to the same results. Therefore I picked another server with 1 gb ram and no swap. In that case I was confronted with a "maven failed with status 137", that told me (through google) to use swap. And that did it: At least 1 gb ram and some swap (in my case 4 gb). The compilation of vaadin widgetsets seems quite heavy.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/106795635
accepted answer of: http://stackoverflow.com/q/26691724

http://stackoverflow.com/q/26798477
accepted answer: http://stackoverflow.com/a/26968948
answer count: 1
tagged with: postgresql
tagged with: timezone
tagged with: playframework-2.2
type: AnsweredQuestion
has title: Joda : UTC to User's locale with daylight saving offset
tagged with: java
has comment: http://stackoverflow.com/comment/42171088
type: Question
has comment: http://stackoverflow.com/comment/42191122
has body: I have a java.util.Date stored as 2014-11-08 13:45:00 in my PostgreSQL field. (it is UTC) I want to display it : at least with "Europe/Paris" timezone, with should bet 14:45 I tried DateTimeFormat.fullDateTime().withZone(DateTimeZone.forID("Europe/Paris")).print(new DateTime(myJavaDate)); And some other combinations like this without success. Better, if it could work with dynamical Locale instead of hardcoded TimeZone it would be perfect. Thanks EDIT : To write it in DB, I use Ebean : SimpleDateFormat parserSDF=new SimpleDateFormat("MMM dd, yyyy hh:mm:ss aaa", Locale.ENGLISH); Date myJavaDate = parserSDF.parse(strDate); ... bean.date = myJavaDate; bean.save(); In my table, it's a timestamp without time zone column (Ebean autogenerated)
tagged with: jodatime
score: 0
has comment: http://stackoverflow.com/comment/42172352
has answer: http://stackoverflow.com/a/26968948

http://stackoverflow.com/comment/42119055
has text: khelwood :- I understand the method should return a value which I completely understand. My point is that inside the if then statement I am returning the count1. Then why do I need to return something? That is where I feel I have some conceptual understanding missing. Do I really need two return types? cant I just use one return type to handle the situation. I feel two return types are redundant.
comment on: http://stackoverflow.com/q/26769099
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26792152
type: Question
has body: Can someone please explain how do I start a program called main.java using Nailgun. It's been a complete nightmare for me and I cannot find any sort of tutorial on the web which explains it clearly. Do I need to include anything extra in my program to run them? I'm trying to follow the instructions given on the Nailgun website where it says: Launch the Nailgun server with "java com.martiansoftware.nailgun.NGServer" But the output I get is: Error: Could not find or load main class com.martiansoftware.nailgun.NGServer Also, when I try to run my compiled java program, the output is: java.lang.ClassNotFoundException: main at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at com.martiansoftware.nailgun.NGSession.run(NGSession.java:261)
downvote count: 0
answer count: 1
tagged with: jvm
favorite count: 0
has title: Running a java program via nailgun
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27966001
score: 1
tagged with: java
tagged with: nailgun
upvote count: 1

http://stackoverflow.com/a/26797775
answers question: http://stackoverflow.com/q/26797717
downvote count: 0
type: Answer
has body: Class.forName("com.mysql.jdbc.Driver") would get the class object for the named class via reflection. If that class exists there's no difference between having that line in the code or not, you're not doing anything with the return value. However, if it doesn't exist on the classpath you'd get an exception from that call and thus you'd know that the driver is missing instead of the connection just failing. Assume the MySQL driver is not present on the classpath. Without that statement, you might an error like "could not open connection" and it might be up to you to parse the logs and look for the reason why. If the statement is called, you'd get a ClassNotFoundException and thus you'd know the reason for the problems: the driver classes are not found by the classloader. Edit: reading @Mureinik's answer, that's probably the better reason for that statement. :)
upvote count: 5
score: 5

http://stackoverflow.com/comment/42084176
has text: @Thilo what is a stacktrace
score: 0
comment on: http://stackoverflow.com/q/26750042
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42168145
comment on: http://stackoverflow.com/a/26796967
score: 0
type: AnswerComment
type: Comment
has text: edited to correct the placement of newline print (doh)

http://stackoverflow.com/q/26781232
upvote count: 2
type: UnansweredQuestion
has title: Watch a folder structure for changes and process files accordingly
score: 2
has body: I am facing the following situation ... somewhere in my filesystem () i am accepting files from a third party application. For example in folder c:\temp These files contain specific metadata and i will have to do the following actions: a) rellocate according to metadata (so first i will parse them) in a 2-level structure such as: C:\temp\idXXX\idYYYY\fileZZZ each idYYYY folder can contain multiple files each idXXX folder can contain multiple folders (e.g. idYYYY, idYYYYE etc.) in the root folder there could be multiple idXXXX type of folders b) after reallocating these files i should monitor each 1st level directory (idXXXX) for changes for a time interval c) if no changes found (no additional folders/files created) then i should zip it and send it somewhere! d) implement such a service to run continiously in the background ... just polling this root dir I am trying to find a library in java that could manage this whole business scenario! any ideas?
tagged with: java
tagged with: file
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26781506
has answer: http://stackoverflow.com/a/26781322
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42205134
score: 0
type: AnswerComment
has text: i know how to use this(), but as you know this() must be the first statement. and i am initializing values after that.
type: Comment
comment on: http://stackoverflow.com/a/26817392

http://stackoverflow.com/q/26705526
downvote count: 0
linked to: http://stackoverflow.com/q/26705798
accepted answer: http://stackoverflow.com/a/26705613
answer count: 1
has title: Moving a JTextArea around a JPanel
favorite count: 0
has body: I am trying to move a JTextArea by clicking and dragging. I have the basic concept down but for some reason, when I drag it, it is showing up along the path I drag. It is easiest to explain by showing you: I'm not sure what is wrong because I'm not creating a new JTextArea on a Mouse Drag, I am using: component.setLocation(x, y); Why is this happening? import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Point; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.event.MouseInputAdapter; public class Editor { public static void main(String[] args) { JFrame frame = new Window(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(30, 30, 1000, 700); frame.getContentPane().setBackground(Color.white); frame.setVisible(true); frame.setLocationRelativeTo(null); frame.setVisible(true); } } class Window extends JFrame { MyPanel myPanel = new MyPanel(); private static final long serialVersionUID = 1L; public Window() { addMenus(); } public void addMenus() { getContentPane().add(myPanel); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); } } class MyPanel extends JPanel { private static final long serialVersionUID = 1L; public MyPanel() { JTextArea textArea = new JTextArea("Some text\nSome other text"); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); add(textArea); DragListener drag = new DragListener(); textArea.addMouseListener(drag); textArea.addMouseMotionListener(drag); } @Override protected void paintComponent(Graphics g) { } public class DragListener extends MouseInputAdapter { Point location; MouseEvent pressed; public void mousePressed(MouseEvent me) { pressed = me; } public void mouseDragged(MouseEvent me) { Component component = me.getComponent(); location = component.getLocation(location); int x = location.x - pressed.getX() + me.getX(); int y = location.y - pressed.getY() …
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26705613
score: 1
tagged with: java
type: Question
tagged with: jtextarea

jsf
tags question: http://stackoverflow.com/q/26769980
tags question: http://stackoverflow.com/q/26738759
tags question: http://stackoverflow.com/q/26740262
type: Tag
tags question: http://stackoverflow.com/q/26688756
tags question: http://stackoverflow.com/q/26779998
tags question: http://stackoverflow.com/q/26800080
tags question: http://stackoverflow.com/q/26767064
tags question: http://stackoverflow.com/q/26712388
tags question: http://stackoverflow.com/q/26764607
tags question: http://stackoverflow.com/q/26728209
tags question: http://stackoverflow.com/q/26775346
tags question: http://stackoverflow.com/q/26681640
tags question: http://stackoverflow.com/q/26827114
tags question: http://stackoverflow.com/q/26816982
tags question: http://stackoverflow.com/q/26807786
tags question: http://stackoverflow.com/q/26815951
tags question: http://stackoverflow.com/q/26729885
tags question: http://stackoverflow.com/q/26674166
tags question: http://stackoverflow.com/q/26695022
tags question: http://stackoverflow.com/q/26781289
tags question: http://stackoverflow.com/q/26814001
tags question: http://stackoverflow.com/q/26797673
tags question: http://stackoverflow.com/q/26785352
tag name: jsf
tags question: http://stackoverflow.com/q/26726336
tags question: http://stackoverflow.com/q/26757813
tags question: http://stackoverflow.com/q/26736503
tags question: http://stackoverflow.com/q/26672990
tags question: http://stackoverflow.com/q/26755460
tags question: http://stackoverflow.com/q/26741563
tags question: http://stackoverflow.com/q/26773629
tags question: http://stackoverflow.com/q/26823485
tags question: http://stackoverflow.com/q/26827821
tags question: http://stackoverflow.com/q/26795915
tags question: http://stackoverflow.com/q/26766128
tags question: http://stackoverflow.com/q/26674146

http://stackoverflow.com/comment/42159597
has text: Some OSs (looking at you Windows) may also "truncate" the image instead.
comment on: http://stackoverflow.com/a/26784352
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42017580
score: 0
has text: so why not @PavelHoral ?. I think the OP wants to make a servlet call on click.
comment on: http://stackoverflow.com/q/26713270
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26710658
favorite count: 0
upvote count: 9
has body: I have a question about The Filepattern for RollingFile Appender in log4j 2. The RollingFile needs an FileName and FilePattern but i dont know what the FilePattern does.I think it is just ignored. This a part of my log4j2.xml %-5p [%d{dd.MM.yyyy - HH:mm:ss}] : %m%n %ex C:/logs/MainLogger.log C:/logs/$${date:yyyy-MM}/app-%d{MM- dd-yyyy}-%i.log.gz <ThresholdFilter level="ALL" onMatch="ACCEPT" onMismatch="DENY" /> <PatternLayout pattern="${pattern}" /> <SizeBasedTriggeringPolicy size="10 MB" /> <DefaultRolloverStrategy max="10" />
type: AnsweredQuestion
has title: What is a Filepattern in Log4j 2 for?
downvote count: 0
tagged with: log4j2
tagged with: logging
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26710740
accepted answer: http://stackoverflow.com/a/26710740
score: 9
tagged with: apache
answer count: 1

http://stackoverflow.com/q/26676331
tagged with: log4j
has comment: http://stackoverflow.com/comment/42132118
favorite count: 0
has answer: http://stackoverflow.com/a/26713016
upvote count: 2
has comment: http://stackoverflow.com/comment/42006625
has answer: http://stackoverflow.com/a/26816060
tagged with: logging
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26816060
tagged with: java
has body: We're using log4j 1.2.17 via slf4j-log4j12 1.7.7 with Java 8. I'm running the application from within Eclipse 4.4.1 on Windows 7 Professional 64-bit. Our root log4j.properties file looks like this: # Root logger option log4j.rootLogger=INFO, 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}) [%d] - %l: %m%n In the application we set up a rolling file appender based upon the configuration: EnhancedPatternLayout patternLayout = new EnhancedPatternLayout("%-5p (%c{1}) [%d] - %l: %m%n"); RollingFileAppender rollingFileAppender = new RollingFileAppender(patternLayout, logPath, true); rollingFileAppender.setMaxBackupIndex(5); rollingFileAppender.setMaxFileSize(5MB); Logger.getRootLogger().addAppender(rollingFileAppender); That works nicely... when the application is finally closed! While the application is running the log file sits at zero bytes, which isn't very helpful. (In this version of our application we switched from using straight log4j to using slf4j->log4j. I don't remember offhand if the behavior was different before we switched.) Update: I've traced through the creation of the actual writer. log4j creates a FileOutputStream, then wraps that in an OutputStreamWriter, which it then wraps in a CountingQuietWriter which is called by the appender. The bufferedIO flag is turned off. I have also traced through writing a log message, and it seems to be written normally to the CountingQuietWriter->OutputStreamWriter->FileOutputStream. Yet nothing appears in the log file until I close the application. Why isn't the application writing to the log immediately, or at least every so often after the buffer gets full?
has comment: http://stackoverflow.com/comment/42016515
type: Question
answer count: 2
downvote count: 0
has title: log4j RollingFileAppender not writing to log until application close
tagged with: slf4j
has comment: http://stackoverflow.com/comment/42140463
possible better answer: http://stackoverflow.com/a/26713016

http://stackoverflow.com/q/26791204
has title: Why does the JVM allow us to name a function starting with a digit in bytecode?
has body: Identifiers are well defined by The Java Language Specification, Java SE 7 Edition (§3.8) An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. As far as I know, since a method name is an identifier, It should be impossible to name a method starting with a digit in java, and javac respects this rule. So, why does the Java Virtual Machine seem to not respect this rule by allowing us to name a function starting with numbers, in Bytecode? This simple snippet will actually print the f99() method name and the value of its parameter. public class Test { public static void main(String[] args) { Test t = new Test(); System.out.println(t.f99(100)); } public int f99(int i){ System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName()); return i; } } Compilation and execution: $ javac Test.java $ java Test Output: f99 100 It is possible to disassemble the code once compiled, and rename all f99 occurences by 99 (with the help of a tool like reJ). $ java Test Output: 99 100 So, is the name of the method actually "99"?
has comment: http://stackoverflow.com/comment/42158745
upvote count: 6
tagged with: identifier
linked to: http://stackoverflow.com/q/342152
score: 6
accepted answer: http://stackoverflow.com/a/26791466
has comment: http://stackoverflow.com/comment/42159367
has comment: http://stackoverflow.com/comment/42158370
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42160256
tagged with: java
possible better answer: http://stackoverflow.com/a/29451466
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42172903
has answer: http://stackoverflow.com/a/29451466
tagged with: bytecode
downvote count: 0
has comment: http://stackoverflow.com/comment/42168250
tagged with: jvm
has answer: http://stackoverflow.com/a/26791466
favorite count: 0
has comment: http://stackoverflow.com/comment/42158598
has comment: http://stackoverflow.com/comment/42182949

http://stackoverflow.com/q/26766013
favorite count: 0
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/42113094
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4945178
has comment: http://stackoverflow.com/comment/42113050
has comment: http://stackoverflow.com/comment/42209668
downvote count: 1
has comment: http://stackoverflow.com/comment/42159213
type: Question
has comment: http://stackoverflow.com/comment/42152166
tagged with: java
has comment: http://stackoverflow.com/comment/42263144
has body: I'm studying a MOOC on Android programming and I've downloaded three zips (the ADT that includes Eclipse, a Java Developers Kit and a game framework that is used in the course). I'm getting exit code 13 when i try to run eclipse. I'd post an image of the error message but I don't have enough reputation. :o/ The course tutor suggested that my Eclipse INI is corrupt. It looks okay from what I can see except it doesn't seem to have any line breaks like the examples I've seen elsewhere. Of course I don't really know what I'm looking at so if there was an odd character missing I wouldn't know. The tutors are swamped with people on the course and I don't think they are looking for messages from people two weeks behind so I don't expect much help there. Other research has suggested that I had multiple installations of Eclipse (or possibly other parts of the course materials). I have gone back and started the download steps now about five times in the last two weeks and I did keep the old downloads in renamed folders but I've now deleted them in case they were creating an issue. The other possibility (as suggested in another thread) is that the paths in the INI file are broken. Unfortunately I don't know anything about the syntax to be able correct a broken path to another folder. After reading the other thread I tried deleting everything related to the course and unpacked everything anew and left it excatly where it unpacked. Can anyone shed any light on this because the MOOC tutors and mentors aren't any help, I'm two weeks behind eveyone else and the I've run out of ideas? I've seen solutions to this that suggest relinking but you may have to tell me the fundementals of links or tell me where to go to read this up. I'm running Windows 7 Pro, 64bit, SP1. (I asked this question on the end of anotrher thread earlier but it looks as though it was deleted, sorry to get things wrong but I 'm trying to figure out how this forum works and I didn't want to start another thread un…
tagged with: eclipse
upvote count: 3
has answer: http://stackoverflow.com/a/26850413
has comment: http://stackoverflow.com/comment/42114343
answer count: 1
has title: Cant get Eclipse to run, exit code 13

http://stackoverflow.com/q/26823677
has body: Have been doing a mathematic example in java which would find all numbers between number1 and number2(including number1 and number2) that divide numbers 2 ,3 or 5. I don't need all those numbers, just how many numbers there are. So for example if inputing 10 and 100 it will return 67. Done with for statement and one if with or signs in it. This is done great for smaller numbers, but I need to use type "long"(variables must be this type!) and numbers up to 18 digits. So when having numbers: 123456789123456789 and 989898989898989898 the for statement isn't good because it takes to much time. Is there some better solution for this, a quicker one?
upvote count: 0
tagged with: long-integer
answer count: 1
tagged with: operation
has title: Java operating long numbers
score: -2
has comment: http://stackoverflow.com/comment/42216487
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26823958
tagged with: numbers
tagged with: java
has comment: http://stackoverflow.com/comment/42216419
type: Question

http://stackoverflow.com/q/26802793
has title: How to get facebook friends with using graph api v 2.2
score: -2
has answer: http://stackoverflow.com/a/26802913
has comment: http://stackoverflow.com/comment/42178893
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/43669774
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42178984
has body: I am not able to get facebook friends using facebook graph api v 2.2.So anyone please tell me how to get facebook friend using graph api v 2.2. I want to get friends list using facebook id.
answer count: 1
tagged with: facebook-graph-api
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26699286
upvote count: 1
has body: I'm using Spring with the config <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <mvc:annotation-driven /> <mvc:resources mapping="/static/**" location="/static/" /> <constructor-arg index="0" value="/home/bodia/server/jetty/webapps/ROOT/WEB-INF/python/"/> .......... <mvc:default-servlet-handler /> </beans> and there is method generateBuckets() in PythonBucketsGenerationService return value of which can be cached. So I declare: @Service public class PythonBucketsGenerationService { private String pythonDir; public PythonBucketsGenerationService(String pythonDir) { this.pythonDir = pythonDir; } @Cacheable(value = "buckets") public List<Bucket> generateBuckets(List<TournamentPlayer> players) { ..... } } The problem is that the method is executed on each invocation even when the hashCode of List<TournamentPlayer> players has same value (I checked). TournamentPlayer has equals() and hashCode() correctly overridden. What is wrong here?
tagged with: caching
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41992961
has answer: http://stackoverflow.com/a/26699822
accepted answer: http://stackoverflow.com/a/26699822
answer count: 1
favorite count: 0
has title: Spring Cacheable does not work
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41993327

http://stackoverflow.com/comment/42042116
score: 0
comment on: http://stackoverflow.com/q/26706878
type: Comment
type: QuestionComment
has text: Yes the server runtime i am using is version 7 and the Server version tried to connect is version 6. I thought there must be backward compatibility. Lets check . Thanks

http://stackoverflow.com/q/26830233
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/42270590
tagged with: client-server
has comment: http://stackoverflow.com/comment/42340672
has title: Send multiple data type over socket
has comment: http://stackoverflow.com/comment/42234037
tagged with: sockets
has body: I want to send multiple data type over socket. I have that code: when I create client, it generates public and private keys and sends the public to serve and the serve stores it. when client wants to send message to another client, it gets his public key from the server to encrypt the message. But when I run this code it freeze at client in dest_public_key=(PublicKey) oin.readObject() Why it stop at here? Why it doesn't read the PublicKey's object that the handler writes to it? Is there any problems in streams? public class Server { private static final int PORT = 9001; ServerSocket listener; private Handler h[] = new Handler[5]; public PublicKey[] keys = new PublicKey[5]; private int clientCount = 0; public Server() throws Exception{ System.out.println("The server is running."); listener = new ServerSocket(PORT); run(); } public void run() throws Exception{ System.out.println("Waiting for a client ..."); while (true) { addClient(listener.accept());} } private void addClient(Socket socket) throws Exception{ h[clientCount] = new ServerHandler(this, socket,clientCount); h[clientCount].open(clientCount); h[clientCount].start(); clientCount++; } public void store(int id,PublicKey key){ keys[id]=key;} public PublicKey getPublicKey(int id){ return keys[id]; } public static void main(String[] args) throws Exception { Server s = new Server();} } handle class public class Handler extends Thread { private Server server; private Socket socket; private int ID = -1; private DataInputStream streamIn = null; private DataOutputStream streamOut = null; private ObjectInputStream obIn = null; private ObjectOutputStream obOut = null; public Handler(Server _server, Socket _socket, int i){ super(); server = _server; socket = _socket; ID = i; } public void run() { while (true) { try { int dest=streamIn.readInt(); PublicKey dest_public_key=server.getPublicKey(dest); obOut.writeObject(dest_public_key); obOut.flush();}} } public void open(int i) { PublicKey publick = null; try { streamOut = …
has comment: http://stackoverflow.com/comment/42234294
tagged with: objectoutputstream
has comment: http://stackoverflow.com/comment/42229500
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42239995

http://stackoverflow.com/q/26820118
has answer: http://stackoverflow.com/a/26820312
has title: Text File processing - using java
has comment: http://stackoverflow.com/comment/42210014
favorite count: 0
possible better answer: http://stackoverflow.com/a/26820312
downvote count: 1
tagged with: text
tagged with: lookup
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26820252
has comment: http://stackoverflow.com/comment/42210055
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42209853
has body: Need a help. I have a big text file which has location data (represented numerically) and needs to be replaced with its corresponding location. These two files are separate text files. Could you help with the java utility on how to replace the numeric values in one file using location values for the other. Below is an example of the contents of file 1 and file 2. File 1 has numeric data and text. The numeric data in the first column needs to be replaced with the corresponding entry from file2. Thus, the file 1 needs to be looped for each entry in file 2. Text File1: 19922973 @Uniquehope was good Test File2: 19922973 Chicago, IL Need to replace 19922973 with Chciago, IL. Please provide your inputs. Thanks Saurabh
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/26820252

http://stackoverflow.com/a/26806189
type: Answer
accepted answer of: http://stackoverflow.com/q/26806120
answers question: http://stackoverflow.com/q/26806120
score: 4
has body: First of all its a servlet not simple java class... You should give its mapping into the web.xml and then u can access it directly give this type of mapping for your servlet entryPointClass EntryPointClass //servlet name here examples.EntryPointClass // packagename.servletclassname EntryPointClass // servletname /entryPointClass // url parttern by which you will access your servlet To access this from server use projectname/urlpattern
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42060544
has text: The [javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html) itself says `StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.`.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26737034

http://stackoverflow.com/q/26675483
type: Question
has comment: http://stackoverflow.com/comment/41952110
tagged with: reflection
has comment: http://stackoverflow.com/comment/41950906
tagged with: java
has title: How to detect JPA mapped fields with Java Reflection
tagged with: jpa
has comment: http://stackoverflow.com/comment/41951865
score: 0
has comment: http://stackoverflow.com/comment/41950302
has comment: http://stackoverflow.com/comment/41950668
answer count: 0
has body: I need to iterate over my class and figure out what are the fields that are JPA mapped and are not transient. I don't want to check for every annotation over the fields, is any shortcut to do that? Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42029010

http://stackoverflow.com/q/26823044
has comment: http://stackoverflow.com/comment/42224583
score: 0
has comment: http://stackoverflow.com/comment/42224961
tagged with: deployment
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42215317
has body: I created a Java application in NetBeans. That Java application contains a GUI and some external Jars. In the dist folder I can see a Jar file and a folder called lib where are the jars I use in the project. If I execute the Jar file the application works as expected. If I change the name of the lib folder the application does not work (meaning that the Jar is using the correct files). But when I copy the dist folder to a different machine (with the same Java version) the application does not work as expected. The user interface is shown but the functionalities does not work (the functionalities are in the external Jars i mentioned in the beginning). Can anyone help? EDIT: I checked the class-path in the MANIFEST file and everything is ok.
answer count: 0
has comment: http://stackoverflow.com/comment/42223953
tagged with: java
type: Question
has title: Distributable java files only work in dev machine
tagged with: jar

http://stackoverflow.com/q/26679860
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26679939
has answer: http://stackoverflow.com/a/38442737
tagged with: java
has answer: http://stackoverflow.com/a/30710289
has body: Have a program where the user inputs 10 int values into the array. Lastly I need to pull out the distinct values and display them. Added my second for loop which would determine if the the value is distinct (i.e. meaning if the number appears multiple times it is only displayed once). For instance, let say I pass in the numbers: 1, 2, 3, 2, 1, 6, 3, 4, 5, 2 the distinct array should only contain numbers {1, 2, 3, 6, 4, 5} import java.util.Scanner; import java.io.*; public class ArrayDistinct { public static void main(String[] args) throws IOException { Scanner input = new Scanner(System.in); // Create arrays &amp; variables int arrayLength = 10; int[] numbers = new int[arrayLength]; int[] distinctArray = new int[arrayLength]; int count = 0; System.out.println("Program starting..."); System.out.print("Please enter in " + numbers.length + " numbers: "); for (int i = 0; i &lt; numbers.length; i++) { numbers[i] = input.nextInt(); } for (int i = 0; i &lt; numbers.length; i++) { int temp = numbers[i]; int tempTwo = numbers[i + 1]; if (tempTwo == temp) { count++; distinctArray[i] = temp; } } // Print out results } // end main } // end class
type: Question
has comment: http://stackoverflow.com/comment/41958534
answer count: 8
has answer: http://stackoverflow.com/a/26679990
linked to: http://stackoverflow.com/q/17967114
has comment: http://stackoverflow.com/comment/41958532
downvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/26680030
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/26680018
has answer: http://stackoverflow.com/a/77576109
has answer: http://stackoverflow.com/a/26679985
has comment: http://stackoverflow.com/comment/41958568
tagged with: unique
score: 2
has title: Pulling distinct values from a array in java

http://stackoverflow.com/comment/42097151
type: Comment
has text: @noone What the JLS says makes sense if you think about the fact that the only public interface enums have is the one declared by the enum class itself, which means that the compiler has no way of knowing about "special" methods you declare in only one/some of your constants in client code. In other situations where you're working with "normal" classes, you'd get around this by downcasting, but since enums implemented in that particular style are anonymous classes, you can't perform such a cast (without reflection (and I'm not even sure if that could work)).
type: AnswerComment
comment on: http://stackoverflow.com/a/26756111
score: 0

http://stackoverflow.com/q/26677202
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: java-native-interface
linked to: http://stackoverflow.com/q/12420463
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/35901557
has comment: http://stackoverflow.com/comment/41958363
upvote count: 1
linked to: http://stackoverflow.com/q/12900695
answer count: 1
has title: JVM crashing on attachCurrentThread JNI callback invocation
has body: Hope you are doing well. I have a JNI implementation in C wherein a C function attach to current JVM thread and callback a Java method, which is actually crashing the JVM upon attachCurrentThread() function call. My implementation is based on the answer given in the link Keeping a global reference to the JNIEnv environment Thread creation part which will listen for a socket connection to accept an event and inject the GetEvent function. // create thread for reading from socket. pthread_attr_init(&amp;plafParams-&gt;readThreadAttr); pthread_attr_setdetachstate(&amp;plafParams-&gt;readThreadAttr, PTHREAD_CREATE_JOINABLE); pthread_attr_setstacksize(&amp;plafParams-&gt;readThreadAttr, 16384); plafParams-&gt;eventThreadFlag = 2; if(pthread_create(&amp;plafParams-&gt;hReadThread_p, &amp;plafParams-&gt;readThreadAttr, ( void * ) plafIncomingPortReadThread, ( void * ) dlmsInstance)) { plafFree(plafParams); return FAILURE; } //create thread to read from platform (to monitor wrapperRecv() process) pthread_attr_init(&amp;plafParams-&gt;EventthreadAttr); pthread_attr_setdetachstate(&amp;plafParams-&gt;EventthreadAttr, PTHREAD_CREATE_JOINABLE); pthread_attr_setstacksize(&amp;plafParams-&gt;EventthreadAttr, 16384); if( pthread_create(&amp;plafParams-&gt;EventThreadHandle_p, &amp;plafParams-&gt;EventthreadAttr, ( void * ) IncomingPortEventReadHandling, ( void * ) dlmsInstance)) { pthread_attr_destroy(&amp;plafParams-&gt;readThreadAttr); plafParams-&gt;eventThreadFlag = 0; return FAILURE; } static JavaVM *jvm; // Caching the JVM on JVM OnLoad jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* jenv; version = (*vm)-&gt;GetEnv(vm, (void **) &amp;jenv, JNI_VERSION_1_6); jvm = vm; printf("\n jvm = %d \n",rs); if(rs == JNI_OK) { printf("\n JNI_OK \n"); } } Callback function void GetEvent(unsigned char *msg) { printf("\n Processing event data \n"); JNIEnv *env; printf("\n Before attaching JVM thread \n"); jint rs = (*jvm)-&gt;AttachCurrentThread(jvm, &amp;env, NULL); // JVM crashes he…
tagged with: callback
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41973016

http://stackoverflow.com/q/26724391
accepted answer: http://stackoverflow.com/a/26724622
has body: I am using a weakly consistent iterator provided by a Concurrent map. I have a question whether it can throw NoSuchElementException for next() method call after responding to hasNext() method as true value.
upvote count: 1
answer count: 1
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Can a weakly consistent iterator throw NoSuchElementException after it has responded true to hasNext method?
has answer: http://stackoverflow.com/a/26724622
favorite count: 0
type: Question

http://stackoverflow.com/q/26675140
score: 0
tagged with: java
tagged with: character-encoding
tagged with: post
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26675939
has answer: http://stackoverflow.com/a/26675347
type: Question
accepted answer: http://stackoverflow.com/a/26675939
possible better answer: http://stackoverflow.com/a/26675347
has body: I post some data from Java to PHP: try { URL obj = new URL("http://myphpurl/insert.php"); HttpURLConnection conn = (HttpURLConnection) obj.openConnection(); conn.setReadTimeout(10000); conn.setConnectTimeout(15000); conn.setRequestMethod(POST_METHOD); conn.setDoInput(true); conn.setDoOutput(true); Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("title", "العربية"); OutputStream os = conn.getOutputStream(); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); writer.write(getQuery(params)); writer.flush(); writer.close(); os.close(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); String inputLine; while ((inputLine = in.readLine()) != null) { response.append(inputLine); } LOG.debug("response {}", response); in.close(); response = null; inputLine = null; conn.disconnect(); conn = null; obj = null; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } private String getQuery(Map&lt;String, String&gt; params) throws UnsupportedEncodingException { StringBuilder result = new StringBuilder(); boolean first = true; Iterator&lt;Map.Entry&lt;String, String&gt;&gt; it = params.entrySet().iterator(); while (it.hasNext()) { if (first) first = false; else result.append("&amp;"); Map.Entry&lt;String, String&gt; pairs = it.next(); result.append(URLEncoder.encode(pairs.getKey(), "UTF-8")); result.append("="); result.append(URLEncoder.encode(pairs.getValue(), "UTF-8")); it.remove(); // avoids a ConcurrentModificationException } return result.toString(); } The insert.php file looks like this: &lt;?php $posttitle = $_POST["title"]; echo "$posttitle"; echo urldecode($posttitle); ?&gt; The echo show some gibbrish Ù…Ù„ÙŠÙˆÙ† instead of the actual title العربية . This gibbrish is then inserted in a mysql database. Additionnal info: The DATABASE is utf8_general_ci and does support arabic (when I manually update the post using phpM…
answer count: 2
tagged with: php
has title: POST non latin data from Java to PHP

http://stackoverflow.com/comment/42140112
type: QuestionComment
has text: My bad! I forgot to add the ` try catch `block. Thanks for spotting.
comment on: http://stackoverflow.com/q/26781045
score: 0
type: Comment

http://stackoverflow.com/a/26769930
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26769828
has body: You have automated tools for both sides. create the classes from a legacy database: you should use this if you have a runnig database already.netbeans have one of these. create the tables and relations from entity and embedded clasess: this way you have to use anotations or a xml file to describe the relations betwen clases and other relational stuff and set table generation strategy to create in the persistence unit the tables will be created automatically usigng the names of the classes for the table and the names of the fields for the columns. If you already have the database use the tool to generate entity classes
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/42229901
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26831393
has text: i just solved my question with the snippet of, "setFocusable(true); requestFocus(); addKeyListener(this); " why couldnt you just help me with focusing instead of forcing key bindings on me??

http://stackoverflow.com/comment/42022453
type: QuestionComment
comment on: http://stackoverflow.com/q/26716110
score: 0
has text: What do you mean by 'doesn't work' exactly?
type: Comment

http://stackoverflow.com/q/26823759
tagged with: java
has comment: http://stackoverflow.com/comment/42216677
has comment: http://stackoverflow.com/comment/42216612
has answer: http://stackoverflow.com/a/26823863
tagged with: nodes
answer count: 1
tagged with: data-structures
has body: [3, 5, 4, 2, 1] where I need the delete the nodes close to the tail which is it should be like [1, 2, 3, 5, 4] any suggestions? public void delete() { for(Node&lt;T&gt; current = getHead(); current != null; current = current.getNext()){ System.out.println(temp.getValue()); removeValue(temp.getValue()); } } } }
score: 0
has comment: http://stackoverflow.com/comment/42216632
tagged with: linked-list
type: UnansweredQuestion
type: Question
has title: duplicate the singly linked list

http://stackoverflow.com/a/26715029
has comment: http://stackoverflow.com/comment/42021100
accepted answer of: http://stackoverflow.com/q/26714110
has body: You've imported the wrong library. You're writing code for the org.json library, not json-simple. The link above will take you to the Maven repo, from which you can import into your project if you're using Maven, or just download the jar if not.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42020996
has comment: http://stackoverflow.com/comment/42021355
answers question: http://stackoverflow.com/q/26714110
type: Answer

http://stackoverflow.com/comment/42027325
score: 1
type: Comment
type: QuestionComment
has text: YOU ended the loop at the semi colon following the for loop. Just remove it as suggested.
comment on: http://stackoverflow.com/q/26718580

http://stackoverflow.com/comment/42174794
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26800584
has text: But the VisualBasic code is expecting a string with 128 chars and windows-1252 encoding. And that Base 64 returns a 172 chars length.
type: Comment

ssl
tags question: http://stackoverflow.com/q/26675788
tags question: http://stackoverflow.com/q/26737144
tags question: http://stackoverflow.com/q/26790716
tags question: http://stackoverflow.com/q/26809772
tags question: http://stackoverflow.com/q/26805601
type: Tag
tags question: http://stackoverflow.com/q/26744578
tags question: http://stackoverflow.com/q/26738458
tags question: http://stackoverflow.com/q/26769855
tags question: http://stackoverflow.com/q/26732875
tags question: http://stackoverflow.com/q/26764815
tags question: http://stackoverflow.com/q/26765891
tags question: http://stackoverflow.com/q/26761966
tag name: ssl
tags question: http://stackoverflow.com/q/26746332
tags question: http://stackoverflow.com/q/26806018
tags question: http://stackoverflow.com/q/26780387

http://stackoverflow.com/comment/42000639
has text: No they go out of the frame
comment on: http://stackoverflow.com/a/26702687
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26740670
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42068874
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42067433
has comment: http://stackoverflow.com/comment/42068903
has comment: http://stackoverflow.com/comment/42069294
has comment: http://stackoverflow.com/comment/42068561
has body: that's because if combobox isn't selected you will get null not false.to avoid this you can check null or not first DefaultTableModel model = (DefaultTableModel) jTable2.getModel(); for (int i=0;i&lt;model.getRowCount();i++) { Boolean checked=(Boolean)model.getValueAt(i,7); if (checked!=null &amp;&amp; checked) { model.removeRow(i); i--; } }
has comment: http://stackoverflow.com/comment/42068583
type: Answer
has comment: http://stackoverflow.com/comment/42068416
has comment: http://stackoverflow.com/comment/42068685
accepted answer of: http://stackoverflow.com/q/26740362
upvote count: 1
answers question: http://stackoverflow.com/q/26740362
has comment: http://stackoverflow.com/comment/42068712
has comment: http://stackoverflow.com/comment/42067662

http://stackoverflow.com/a/26908738
has body: Basically, the LayoutManager is being disposed of before your recycler has finished with it. From the Android source : @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mItemAnimator != null) { mItemAnimator.endAnimations(); } mFirstLayoutComplete = false; stopScroll(); mIsAttached = false; if (mLayout != null) { mLayout.onDetachedFromWindow(this, mRecycler); } removeCallbacks(mItemAnimatorRunner); } The problem stems from when the stopScroll and it tries to call mLayout.stopSmoothScroller(); without checking if mLayout is null. I threw togeather a very hacky hot fix for an app I've been working on, but I wouldn't suggest using this for a long term solution as it's very much a bodge. If like me you have a tight deadline it's best to just catch the null pointer exception and ignore it. My hot fix was just to create a custom View extending the RecyclerView : import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; public class HotFixRecyclerView extends RecyclerView { public HotFixRecyclerView( Context context ) { super( context ); } public HotFixRecyclerView( Context context, AttributeSet attrs ) { super( context, attrs ); } public HotFixRecyclerView( Context context, AttributeSet attrs, int defStyle ) { super( context, attrs, defStyle ); } @Override public void stopScroll() { try { super.stopScroll(); } catch( NullPointerException exception ) { /** * The mLayout has been disposed of before the * RecyclerView and this stops the application * from crashing. */ } } } Then change all references from the RecyclerView to HotFixRecyclerView. If you do use it please remove it once Android have patched this issue as it's a bit of a hack. If you use recylerview inn XML don't forget to change your XML files accordingly to use com.your.package.HotFixRecyclerView instead of android.support.v7.widget.RecyclerView
has comment: http://stackoverflow.com/comment/81826543
has comment: http://stackoverflow.com/comment/45643241
answers question: http://stackoverflow.com/q/26702633
upvote count: 20
accepted answer of: http://stackoverflow.com/q/26702633
score: 20
has comment: http://stackoverflow.com/comment/44174361
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44180532
has comment: http://stackoverflow.com/comment/45708745
has comment: http://stackoverflow.com/comment/47795974
has comment: http://stackoverflow.com/comment/42384256
type: Answer
has comment: http://stackoverflow.com/comment/45642599
has comment: http://stackoverflow.com/comment/45730333

http://stackoverflow.com/a/26817151
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/42329957
downvote count: 0
answers question: http://stackoverflow.com/q/26691561
upvote count: 3
has body: So long as you're not attempting to have more than one thread write to the same file at a given time, there's no problem with doing file I/O from different threads. Using NIO, the FileSystem implementation is way better than you could ever hope to be at managing disk writes and resources. Disk writes are buffered and asynchronous by default in Java, so there's no need to do something as convoluted as making a single thread do all your I/O and writing into memory buffers - this is almost exactly what OutputStreams writing to disk do already, but the native JVM will do it more efficiently than you could. In fact, file I/O operations can benefit substantially from multithreading. Different threads can be processing read information while other threads are reading, and it can even sometimes be faster to read or write a few files in parallel than sequentially.

http://stackoverflow.com/a/26758561
has comment: http://stackoverflow.com/comment/42100770
answers question: http://stackoverflow.com/q/26758425
has body: You can do all these yourself, and the java SE arsenal alone might supply what you require, but I strongly recommend an easier and more scalable methodology as doing all this work yourself would be re-inventing the wheel. Try one of these in memory data grids : Ehcache Hazelcast For instance in ehcache you can achieve what you want by a configuration similar to : &lt;cache name="myCache" maxElementsInMemory="10000" eternal="true" overflowToDisk="false" /&gt;
has comment: http://stackoverflow.com/comment/42102169
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42102715
has comment: http://stackoverflow.com/comment/42102706
downvote count: 3
has comment: http://stackoverflow.com/comment/42101666
upvote count: 4

http://stackoverflow.com/comment/42042848
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26727032
has text: Also, the same bug appears in the else leg of enqueue.
score: 0

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

http://stackoverflow.com/comment/87453833
type: Comment
comment on: http://stackoverflow.com/a/26766845
type: AnswerComment
score: 0
has text: It was a good link in 2014, don't know what happened since then. I should not have been down voted for something I have no control over.

http://stackoverflow.com/comment/41995735
type: Comment
type: QuestionComment
has text: What does the method return if `mapSize` is <= 0?
score: 1
comment on: http://stackoverflow.com/q/26701056

http://stackoverflow.com/q/26713576
tagged with: eclipse
tagged with: jpa
answer count: 1
has title: Developing Java EE in Eclipse; Entity Manager Exception
tagged with: entitymanager
score: 0
type: UnansweredQuestion
has body: I am trying to create an Java Enterprise Application using Eclipse IDE with JBoss 7.0 Server. I already had experience developing such applications but using NetBeans IDE. The main problem for me are the differences between these two IDEs. Currently, Eclipse's giving me headaches about configuring basic functionalities. The project structure looks like above. I've built Java EE application with 3 separated containers - one for EJB, JPA and WEB: EAR: -EJB -> contains SessionBeans and all the business logic -JPA -> contains database entities (MySQL) and DAO layer -WAR -> contains JSF (.xhtml) pages and JSF Managed Beans I've configured those 3 containers to work together like Java EE environment and all works great. I can run my project on the server without any problems. Logic DAO layer is reading/inserting some data from JPA container; it manipulates the database entries I am using the DAO layer's methods in EJB container; Stateless Session Beans are using those methods to sent the results to WAR container JSF Managed beans in the WAR container receive the results from EJB Session Beans Received results are then displayed on JSF page using JSF Managed Bean's object Problem I ran into a problem when I try to implement some basic functionality like reading from database. I am assuming that the problem I am facing with is the problem with EntityManager. Concrete problem I have my DAO layer that contains UserDAOImpl class that implements IUserDAO interface like down bellow. IUserDAO interface: public interface IUserDAO { public List<User> getAllUsers(); } UserDAOImpl class: public class UserDAOImpl implements IUserDAO { // @PersistenceContext(unitName="eLearningJJ-jpa") // protected EntityManager entityManager; private EntityManagerFactory emf = Persistence.createEntityManagerFactory("eLearningJJ-jpa"); private EntityManager manager = emf.createEntityManager(); private List<User> users = new ArrayList<User>(); @Override public List<User> getAllUsers() { users = manager.…
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26714206
tagged with: java

http://stackoverflow.com/comment/42095185
comment on: http://stackoverflow.com/q/26748162
score: 0
type: Comment
type: QuestionComment
has text: what are sizes of the matrices ?

http://stackoverflow.com/a/26683086
has comment: http://stackoverflow.com/comment/41965163
has body: A simple, slightly hacky way you could do this without defining your own types would be to store these in a HashMap, with a string combining the Q_ID and the Type_Question as a single concatenated string, like so: HashMap&lt;String, ArrayList&lt;String&gt;&gt; yourHashMap = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; handPumpWell = new ArrayList&lt;String&gt;(); handPumpWell.add("handpump"); handPumpWell.add("well"); yourHashMap.put("0,1", handPumpWell); ArrayList&lt;String&gt; randomAnswer = new ArrayList&lt;String&gt;(); randomAnswer.add("random"); randomAnswer.add("answer"); yourHashMap.put("1,1", randomAnswer); And then you could reference the list of options for any given ID/Type combination like so: yourHashMap[Q_ID + "," + Type_Question] Which for Q_ID = 0 and Type_Question = 1 would return an ArrayList containing "handpump" and "well". You'd have to make the sure Q_ID always preceded the Type_Question, though, because rearranging them wouldn't return the correct results.
score: 1
accepted answer of: http://stackoverflow.com/q/26683052
upvote count: 1
answers question: http://stackoverflow.com/q/26683052
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41965343
downvote count: 0
has comment: http://stackoverflow.com/comment/41965416

http://stackoverflow.com/q/26787117
tagged with: swing
downvote count: 1
tagged with: actionlistener
tagged with: java
score: -1
type: Question
linked to: http://stackoverflow.com/q/26784502
has comment: http://stackoverflow.com/comment/42151075
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42150752
linked to: http://stackoverflow.com/q/26326496
favorite count: 0
has comment: http://stackoverflow.com/comment/42151047
has title: WindowBuilder Eclipse doesnt respond to actionlistener
has answer: http://stackoverflow.com/a/26787460
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42150812
has body: I have a question. Im using WindowBuilder in Eclipse and when i type in the code,my action listener doesnt work. I tried everything. Also,another question,when using WindowBuilder,what is the name of my frame object? I see there thtat it is made in my class,but it doesnt have name. public OrdinacijaGui() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setBounds(600 , 300 , 450 , 300); setTitle("Dr Idrizovic"); getContentPane().setLayout(null); JButton regUslugaButt = new JButton("Registar usluga"); regUslugaButt.setBounds(10, 11, 150, 30); getContentPane().add(regUslugaButt); JButton regMaterijalaButt = new JButton("Registar materijala"); regMaterijalaButt.setBounds(10, 71, 150, 30); getContentPane().add(regMaterijalaButt); JButton regIntervencijaButt = new JButton("Registar intervencija"); regIntervencijaButt.setBounds(10, 131, 150, 30); getContentPane().add(regIntervencijaButt); JButton regDijagnozaButt = new JButton("Registar dijagnoza"); regDijagnozaButt.setBounds(10, 191, 150, 30); getContentPane().add(regDijagnozaButt); JButton exitButt = new JButton("Zavrsetak rada"); exitButt.setBounds(143, 232, 150, 30); getContentPane().add(exitButt); JButton evidencijaPacButt = new JButton("Evidencija pacijenata"); evidencijaPacButt.setBounds(230, 11, 200, 30); getContentPane().add(evidencijaPacButt); JButton zakazivanjePacButt = new JButton("Zakazivanje pacijenata"); zakazivanjePacButt.setBounds(230, 71, 200, 30); getContentPane().add(zakazivanjePacButt); JButton evidencijaStomatologaButt = new JButton("Evidencija stomatologa"); evidencijaStomatologaButt.setBounds(230, 131, 200, 30); getContentPane().add(evidencijaStomatologaButt); JButton izvrseneUslugeButt = new JButton("Izvrsene usluge"); izvrseneUslugeButt.setBounds(230, 191, 200, 30); getContentPane().add(izvrseneUslugeButt); thehandler handler = new thehandler(); regUslugaButt.addActionListener(handler); regMaterijalaButt.addActionListener(handler); regIntervencijaButt.addActionListener(handler)…

http://stackoverflow.com/q/26686975
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26686998
favorite count: 0
score: 0
has title: Method Calling Issues Java
accepted answer: http://stackoverflow.com/a/26686998
has body: So i'm trying to call a method displayBoard in java that displays the boardgame once the user enters in a number initially in the main method. I'm unable to call this method. Does anyone see where i'm going wrong or how do i fix this? Thanks. public static void displayBoard(int [] board, boolean showItem) { System.out.println(); System.out.print("_"); for (int val : board){ switch(codes){ case 2: System.out.print("x"); break; case 3: System.out.print(" "); break; case 4: System.out.print(showItem ? "Y" : " "); break; } System.out.print("_"); } //for System.out.println(); System.out.println(); }//display public static void main (String [] args) { int guess = 0; int userInput = promptForInt("Length Of board"); int [] numbers = new int[userInput]; int randomlocs = new Random().nextInt(userInput); int val; int display = displayBoard(board [], boolean showItem) // doesnt work? boolean showItem = false; while(! showItem) { val = promptForInt("Try Again!"); if(guess == randomlocation) { System.out.println("Found it!"); showItem = true; } else if(guess != randomlocs) System.out.print(val); } }
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26716327
score: 0
tagged with: jstl
answer count: 1
has answer: http://stackoverflow.com/a/26717200
accepted answer: http://stackoverflow.com/a/26717200
tagged with: jsp
tagged with: jquery
tagged with: spring
has body: I have one User class, //UserDAO private String name; private String[] certifications; //getters and setters here.... Controller.java List<UserDAO> usersList= new ArrayList<UserDAO>(); UserDAO userOne = new UserDAO(); userOne.setName("user1"); userOne.setCertifications({"cert1"}); UserDAO userTwo = new UserDAO(); userTwo.setName("user1"); userTwo.setCertifications({"cert1","cert2"}); usersList.add(userOne); usersList.add(userTwo); model.addAttribute("usersList", usersList); JSP <c:forEach var="list" items="${usersList}"> "${list.name}"/> <c:forEach var="rowSelect" items="${list.certifications}"> ${rowItemSelect} </c:forEach> </c:forEach> Above code populates data correctly. Please tell how to send the selected dropdown value for certification in JSP and how to access these values in controller.
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to get element of dropdown list from JSP

http://stackoverflow.com/q/26796894
tagged with: java
has comment: http://stackoverflow.com/comment/42167978
has comment: http://stackoverflow.com/comment/42172538
tagged with: nio
has title: Java NIO Selectors- multiple Selectors
duplicate of: http://stackoverflow.com/q/1200621
has comment: http://stackoverflow.com/comment/42171009
score: 0
has comment: http://stackoverflow.com/comment/42167814
has body: The question is not about creating normal arrays. Kindly provide me with an example of how to create array of selectors in java nio. The following code throws nullpointerexception Selector [] selectors; selectors[0] = Selector.open();
has comment: http://stackoverflow.com/comment/42172936
answer count: 0
linked to: http://stackoverflow.com/q/1200621
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42168366

http://stackoverflow.com/comment/42025544
comment on: http://stackoverflow.com/q/26717662
score: 0
has text: Why dont you define listener via web.xml and that way let container handle it?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26739655
has body: I'm using google guava multimap and would like to know if it's possible to allow concurrent writes to different parts of the map or do I have to synchronize all access? When I say different parts, I mean different key-value pairs in the multimap. Is the following sample code correct? class Key {} class Value {} private Multimap&lt;Key, Value&gt; multimap = HashMultimap.create(); private final Striped&lt;Key&gt; locks = Striped.readWriteLock(100); public void write(final Key key, final Collection&lt;Value&gt; values) { Lock writeLock = locks.get(key).writeLock(); writeLock.lock(); try { for (Value value : values) { multimap.put(key, value); } } finally { writeLock.unlock(); } } public Collection&lt;Value&gt; read(final Key key) { Lock readLock = locks.get(key).readLock(); readLock.lock(); try { // Collect values } finally { readLock.unlock(); } }
tagged with: guava
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42072206
type: Question
has answer: http://stackoverflow.com/a/47703734
tagged with: locking
has title: How can I allow concurrent writes on different parts (with different keys) of a guava multimap
answer count: 1
downvote count: 0
score: 1
tagged with: synchronization
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42139211
has text: So If I modify set.add(i); to set.add(i+1); will get compiler error.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26780804
type: Comment

http://stackoverflow.com/comment/42003223
has text: If you want to see if you are on the 7th line just check your iterator against 7. If you want to see if you are on a multiple of 7, then test for modula (%) 7 == 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26705104
score: 0

http://stackoverflow.com/q/26745971
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/26746084
has answer: http://stackoverflow.com/a/26746047
answer count: 4
score: 1
linked to: http://stackoverflow.com/q/21033216
tagged with: java
upvote count: 1
has title: How to resolve ORA-01795 in Java code
type: Question
has answer: http://stackoverflow.com/a/26746147
has body: I am getting ORA-01795 error in my Java code while executing more than 1000 records in IN clause. I am thinking to break it in the batch of 1000 entries using multiple IN clause separated by OR clause like below: select * from table_name where column_name in (V1,V2,V3,...V1000) or column_name in (V1001,V1002,V1003,...V2000) I have a string id's like -18435,16690,1719,1082,1026,100759... which gets generated dynamically based on user selection. How to write a logic for condition like 1-1000 records ,1001 to 2000 records etc in Java. Can anyone help me here?
has comment: http://stackoverflow.com/comment/42077344
has answer: http://stackoverflow.com/a/26746950
downvote count: 0
linked to: http://stackoverflow.com/q/16185277

http://stackoverflow.com/comment/42020186
comment on: http://stackoverflow.com/q/26713148
type: Comment
type: QuestionComment
score: 0
has text: Are you running on windows or any other platform?

http://stackoverflow.com/a/46115837
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26816685
has body: use this it keep only header row. if (table.getRootView() != null) { int i = 1; while (table.getChildCount() != 1) { table.removeViewAt(i); } }

http://stackoverflow.com/q/26772929
has comment: http://stackoverflow.com/comment/42125504
has comment: http://stackoverflow.com/comment/42125448
has comment: http://stackoverflow.com/comment/42125354
downvote count: 4
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42125479
possible better answer: http://stackoverflow.com/a/26773156
tagged with: java
has comment: http://stackoverflow.com/comment/42125397
score: -4
has answer: http://stackoverflow.com/a/26773156
has comment: http://stackoverflow.com/comment/42125487
has title: What does this expression evaluate to?
has comment: http://stackoverflow.com/comment/42125377
has body: Class Wrapper{ psvm(){ Integer i=new Integer(5); Float f=new Float(5); } } if (i==f &amp;&amp; i.equals(f))// 1st expression evaluates to ???? and second expression evaluates to ??? System.out.println("i == f returns " + (i == f) + " and equals returns " + i.equals(f));
type: Question
has comment: http://stackoverflow.com/comment/42125351
has comment: http://stackoverflow.com/comment/42125433
answer count: 2
has answer: http://stackoverflow.com/a/26773026
accepted answer: http://stackoverflow.com/a/26773026
has comment: http://stackoverflow.com/comment/42125501
tagged with: operators
favorite count: 0
has comment: http://stackoverflow.com/comment/42125473

http://stackoverflow.com/q/26785138
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42147057
has answer: http://stackoverflow.com/a/26785321
accepted answer: http://stackoverflow.com/a/26785191
has title: Access a class in a different folder
upvote count: 1
type: AnsweredQuestion
has body: In my main package I have two classes and a folder with more classes in it. One of the outer classes is a singleton class that I need access to from a bunch of the other classes (which are inside of the subfolder). I can access the singleton from classes on the same level as it no problem but when in one of the subclasses it will not let me access it as the others can. How do I resolve this issue? Just incase here is a layout: com.blah [Connect] Ftp.java //I want to be able to say AppConfig.getInstance().blah() in this class App.java //I can say AppConfig.getInstance().blah() in here just fine AppConfig.java EDIT This is the top of the AppConfig Singleton class: class AppConfig { private static AppConfig config = new AppConfig(); private AppConfig(){} public static AppConfig getInstance(){ return config; } static Properties prop = new Properties(); ... EDIT Realized that i needed public infront of AppConfig class declaration. Thanks for the tips guys.
has answer: http://stackoverflow.com/a/26785191
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26785321
type: Question

http://stackoverflow.com/q/26727372
linked to: http://stackoverflow.com/q/1568091
type: Question
tagged with: oop
tagged with: java
duplicate of: http://stackoverflow.com/q/1568091
has answer: http://stackoverflow.com/a/26727651
has comment: http://stackoverflow.com/comment/42043446
has comment: http://stackoverflow.com/comment/42043415
has answer: http://stackoverflow.com/a/26727425
has body: I had been asked the following question in an interview and i am curious to know the answer. There are two classes as following, public class EmployeeA{ public int empId; } public class EmployeeB{ private int empId; public void setEmpId(int empId){this.empId = empId;} public int getEmpId(){return empId;} } There are two classes where one class has a public instance field and other have a private field with getters and setters. In this case, which is better implementation and why? [I have learned that making instance variable private is the better idea. But in both cases i can modify the value of empId attribute. ]
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26727738
answer count: 3
has title: Why instance variable in Java should be private if the Class has only getters and setters
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26730051
tagged with: apache
tagged with: ant
has comment: http://stackoverflow.com/comment/42049715
has comment: http://stackoverflow.com/comment/42047931
answer count: 3
has answer: http://stackoverflow.com/a/28959886
has title: How to install Apache Ant on Windows 7
has comment: http://stackoverflow.com/comment/42047993
favorite count: 0
possible better answer: http://stackoverflow.com/a/27856903
has comment: http://stackoverflow.com/comment/42049572
has comment: http://stackoverflow.com/comment/42048959
linked to: http://stackoverflow.com/q/5607664
has comment: http://stackoverflow.com/comment/42048170
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42049223
has comment: http://stackoverflow.com/comment/42048228
downvote count: 0
has answer: http://stackoverflow.com/a/26731119
tagged with: java
accepted answer: http://stackoverflow.com/a/26731119
has answer: http://stackoverflow.com/a/27856903
has body: I want to install Apache ant on windows. Here is some information below: http://ant.apache.org/manual/install.html Error installing Ant: ANT_HOME is set incorrectly I followed its descriptions and step by step but it still cannot work. I think the entire environment variables I set are correct. May please someone helps me? And some copies from cmd. C:\&gt;echo %ANT_HOME% C:\Program Files\apache-ant-1.9.4 C:\&gt;echo %JAVA_HOME% C:\Program Files\Java\jdk1.6.0_34 C:\&gt;java -version java version "1.6.0_34" Java(TM) SE Runtime Environment (build 1.6.0_34-b04) Java HotSpot(TM) Client VM (build 20.9-b04, mixed mode, sharing) C:\&gt;ant is not recognized as an internal or external command,operable program or batch file. My Ant version is 1.9.4
type: Question
upvote count: 2

http://stackoverflow.com/a/26720431
score: 0
has body: Same Problem i have faced for uploading JSON The Mistake Might be you using a normal method of writing a file as output to your place : is by making an x.xml file at a location and placing the contents directly. As you are sending a file a with extension .xml from your multipart request so it should be get and written in that way. Steps you should do for getting your files items (Either they are file or input parameters) Check Weather its a multipart request. proceed to next if yes get file extension (Not necessary but good if you check) then read its content using parseRequest method and then Write its content to file. boolean isMultipartContent = ServletFileUpload.isMultipartContent(request); if (!isMultipartContent) { out.println("You are not trying to upload&lt;br/&gt;"); return; out.println("You are trying to upload&lt;br/&gt;"); For reference You can view this but its only for a normal file, not for xml. also uploading xml may help you.
answers question: http://stackoverflow.com/q/26719838
type: Answer

http://stackoverflow.com/q/26821649
has title: Java Graphics 2D and KeyListener
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26821754
type: Question
tagged with: graphics
tagged with: actionlistener
tagged with: 2d
tagged with: java
tagged with: keylistener
has body: I am teaching myself 2D graphics in Java right now. I am trying to create a block-stacking game. So far, I am able to get the first row moving and stopping, but my aim is to generate a new row below the first while the first row stays in place. I feel like the fix for this is a simple concept I haven't learned yet. However, any advice will be appreciated. If you want to point me in the right direction to where I can teach myself 2D Graphics in general, I will appreciate that also. My code for the JFrame is as follows: public class BlockStacker extends JFrame { public class AL extends KeyAdapter { stack2 s2 = new stack2(); public void keyPressed(KeyEvent e){ int keyCode = e.getKeyCode(); } } public static void main(String[] args){ stack2 s = new stack2(); JFrame f = new JFrame(); f.add(s); f.setVisible(true); f.setSize(1920, 1080); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setTitle("Block Stacker"); } } The code with the graphics and the keylistener is this: public class stack2 extends JPanel implements ActionListener, KeyListener{ Timer t = new Timer(250, this); double x, y, velX = 253; public stack2() { t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; setBackground(Color.BLACK); Color blue = new Color(0,0,255); g2.setColor(blue); Rectangle2D.Double rectangle = new Rectangle.Double(x + 210, y, 200, 100); g2.fill(rectangle); Rectangle2D.Double rectangle2 = new Rectangle.Double(x, y, 200, 100); g2.fill(rectangle2); Rectangle2D.Double rectangle3 = new Rectangle.Double(x + 420, y, 200, 100); g2.fill(rectangle3); } public void actionPerformed(ActionEvent e) { if (x &lt; 0) { velX = -velX; } x += velX; repaint(); if (x &lt; 10 || x &gt; 1200) { velX = -velX; repaint(); } } public void space() { velX = 0; repaint(); } public void space2() { } public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEven…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42212845
has answer: http://stackoverflow.com/a/26821754

http://stackoverflow.com/comment/42020768
comment on: http://stackoverflow.com/a/26682255
type: AnswerComment
score: 0
type: Comment
has text: @John Bollinger: `synchronized` provides mutual exclusion of access which includes the possibility that threads have to be added to a waiting queue and excluded from task scheduling. That’s all *additional* to the memory semantics which are that a `synchronized` block includes *both* a barrier like a `volatile` read (at the beginning) *and* a write (at the end). What’s so hard to understand that this can’t be cheaper than *one* single `volatile` access being *either* read or write?

http://stackoverflow.com/comment/42054966
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26731829
score: 1
has text: This question belongs on another site in the Stack Exchange network: Code Review (http://codereview.stackexchange.com/)

http://stackoverflow.com/a/26699570
has comment: http://stackoverflow.com/comment/41993117
has comment: http://stackoverflow.com/comment/41993165
answers question: http://stackoverflow.com/q/26699525
type: Answer
has body: Do you see any logcat error? Do you have related font in your assets directory? try to change your font name in asset folder and your code to Heart_Breaking_Bad.ttf you must moved it to main/assets instead of res/assets. and see my answer here , maybe help you.
score: 0

http://stackoverflow.com/comment/41977703
type: AnswerComment
comment on: http://stackoverflow.com/a/26690331
type: Comment
has text: Thanks a lot. Works like a charm. One thing, do I need to include anything in the `pom.xml` of the child projects, eg, <parent> <\parent>?
score: 0

http://stackoverflow.com/q/26679399
has body: My class DoFindMiddleService extends the abstract class DoFindMiddle. Here is the DoFindMiddle class: public abstract class DoFindMiddle<T extends Comparable<T>> { public abstract ListItem<T> findMiddle(ListItem<T> paramListItem); public static <D extends Comparable<D>> DoFindMiddle<D> newInstance() { return (DoFindMiddle)ServiceLoader.load(DoFindMiddle.class).iterator().next(); } } Here is the first part of DoFindMiddleService class: package com.nng.interview.homework.applicant.kovacskalman; import com.nng.interview.homework.exercise.DoFindMiddle; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; public class DoFindMiddleService<T extends Comparable<T>> extends DoFindMiddle<T> { public static DoFindMiddle service; public volatile ServiceLoader<DoFindMiddleService> loader; public DoFindMiddleService() { loader = ServiceLoader.load(DoFindMiddleService.class); } public static synchronized DoFindMiddle getInstance() { if (service == null) { service = new DoFindMiddleService(); } return service; } public String getDefinition(String word) { String definition = null; try { Iterator<DoFindMiddleService> dictionaries = loader.iterator(); while (definition == null && dictionaries.hasNext()) { DoFindMiddleService d = dictionaries.next(); definition = d.getDefinition(word); } } catch (ServiceConfigurationError serviceError) { definition = null; serviceError.printStackTrace(); } return definition; } ..... } If I try the following in the Unit test: final DoFindMiddle<Integer> instance = new DoFindMiddleService(); Then it is working. But when I try in the Unit test: final DoFindMiddle<Integer> instance = DoFindMiddle.newInstance(); Then it results NoSuchElementException error. What can be my fault? My pom.xml is the following: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.nng.interview.homework.applicant Kovács Kálmán kovacskalman 1.0 jar org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 true com.nng.interview.hom…
upvote count: 3
tagged with: java
tagged with: classpath
accepted answer: http://stackoverflow.com/a/26690605
type: Question
score: 3
tagged with: serviceloader
has title: Using Java ServiceLoader results NoSuchElementException error
answer count: 2
possible better answer: http://stackoverflow.com/a/26679563
downvote count: 0
has answer: http://stackoverflow.com/a/26679563
tagged with: maven-3
favorite count: 0
has answer: http://stackoverflow.com/a/26690605
type: AnsweredQuestion

http://stackoverflow.com/q/26711679
downvote count: 0
type: UnansweredQuestion
score: 1
type: Question
has comment: http://stackoverflow.com/comment/42016265
has title: long converter JSON.parse form MongoDB
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42014589
tagged with: mongodb
upvote count: 1
tagged with: long-integer
favorite count: 0
has comment: http://stackoverflow.com/comment/42014692
has body: could you help me with conver long values from MondoDB, here is piece of code: DBObject workCircleDbObject = (DBObject) JSON.parse(source.get("workcircle").toString()); source.get("workcircle") returns: java.lang.Long value; but after, JSON.parse(source.get("workcircle").toString()); returns java.lang.Integer; so workCircleDbObject contains integer values, not long. How can I save long values not integer in java? Thank you
answer count: 0

http://stackoverflow.com/comment/42185995
comment on: http://stackoverflow.com/q/26806450
type: Comment
type: QuestionComment
has text: Your first path says "C: **Program** \Program Files\Java\jdk1.7.0_71\bin". Is the "Program" part intentional? It shouldn't be there.
score: 0

http://stackoverflow.com/q/26736562
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I am rececing the following error: The method getSupportFragmentManager() is undefined for the type new AdapterView.OnItemClickListener(){} for the following line: FragmentManager fragmentManager = getSupportFragmentManager(); Below is the entire activity code: import android.app.ActionBar; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.view.MenuItem; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.Toast; public class MainActivity extends Activity { private String[] mOptionMenu; private DrawerLayout mDrawerLayout; private RelativeLayout mDrawerRelativeLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mTitleSection; private CharSequence mTitleApp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mOptionMenu = new String[] { "Opción 1", "Opción 2", "Opción 3" }; mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerRelativeLayout = (RelativeLayout) findViewById(R.id.left_drawer); mDrawerList = (ListView) findViewById(R.id.list_view_drawer); mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(getActionBar() .getThemedContext(), android.R.layout.simple_list_item_1, mOptionMenu)); mDrawerList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Fragment fra…
favorite count: 0
accepted answer: http://stackoverflow.com/a/26736648
type: Question
tagged with: android
tagged with: android-activity
upvote count: 1
answer count: 1
tagged with: android-layout
has answer: http://stackoverflow.com/a/26736648
has title: The method getSupportFragmentManager() is undefined for the type new AdapterView.OnItemClickListener(){}

list
tags question: http://stackoverflow.com/q/26689075
tags question: http://stackoverflow.com/q/26778969
type: Tag
tags question: http://stackoverflow.com/q/26740782
tags question: http://stackoverflow.com/q/26705531
tags question: http://stackoverflow.com/q/26812215
tags question: http://stackoverflow.com/q/26719154
tags question: http://stackoverflow.com/q/26771364
tags question: http://stackoverflow.com/q/26697448
tags question: http://stackoverflow.com/q/26811079
tags question: http://stackoverflow.com/q/26815838
tags question: http://stackoverflow.com/q/26793454
tag name: list
tags question: http://stackoverflow.com/q/26722078
tags question: http://stackoverflow.com/q/26813616
tags question: http://stackoverflow.com/q/26739579
tags question: http://stackoverflow.com/q/26789237
tags question: http://stackoverflow.com/q/26737018
tags question: http://stackoverflow.com/q/26752720
tags question: http://stackoverflow.com/q/26811861
tags question: http://stackoverflow.com/q/26825342
tags question: http://stackoverflow.com/q/26692423
tags question: http://stackoverflow.com/q/26700136
tags question: http://stackoverflow.com/q/26676283
tags question: http://stackoverflow.com/q/26822651
tags question: http://stackoverflow.com/q/26729105
tags question: http://stackoverflow.com/q/26695850
tags question: http://stackoverflow.com/q/26819015
tags question: http://stackoverflow.com/q/26792134
tags question: http://stackoverflow.com/q/26783000

http://stackoverflow.com/a/26706730
upvote count: 2
type: Answer
score: 2
has body: I did not find any solution. Therefore, I use this snippet: someproject -p out javac src/com/example/*.java -d out/ cd out/ &amp;&amp; jar cfe someproject.jar com.example.Main com/example/*.class &amp;&amp; mv someproject.jar ../ &amp;&amp; cd .. echo "#!/bin/bash" &gt; someproject echo 'java -jar $${BASH_SOURCE[0]}.jar' &gt;&gt; someproject chmod a+x someproject
accepted answer of: http://stackoverflow.com/q/26705559
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26705559

http://stackoverflow.com/comment/42213118
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26821804
has text: Java offers you collection framework. Choose any type of collection that suits your need and add Car object to it. You can make Set of cars, Map of cars, List of cars etc. Google for more details.

http://stackoverflow.com/comment/65704962
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26800234
type: Comment
has text: Use history.pushState() can clear the "forward" history.

http://stackoverflow.com/comment/42125351
type: Comment
comment on: http://stackoverflow.com/q/26772929
has text: What are you asking exactly?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/41948116
comment on: http://stackoverflow.com/q/26673783
type: Comment
type: QuestionComment
has text: Is your `params` field supposed to be `List<C>` instead of `List`?
score: 1

http://stackoverflow.com/a/26762436
score: 0
accepted answer of: http://stackoverflow.com/q/26747979
type: Answer
answers question: http://stackoverflow.com/q/26747979
type: AcceptedAnswer
has body: What probably happens is that, during the test, AccessController.doPrivileged(...) gets called from somewhere else, perhaps from NetBeans or more likely from the JRE itself. JMockit 1.x does not restrict the mocking of the AccessController class to just the foo(boolean,boolean) method; instead, it registers all invocations to its methods, regardless of where they come from. The test would have to implement a more restrictive verification, perhaps checking the exact PrivilegedAction instance passed to the mocked method, or even by checking the call stack to see where it comes from. For JMockit 2, an API change is planned so that mocking gets scoped to @Tested classes only, avoiding situations like this.

http://stackoverflow.com/comment/42267066
type: Comment
has text: My mistake. I didn't realise that fireXXX actually gets automatically called through an update to the DefaultTableModel.
comment on: http://stackoverflow.com/a/26810213
score: 0
type: AnswerComment

groovy
tags question: http://stackoverflow.com/q/26741856
tags question: http://stackoverflow.com/q/26790116
tags question: http://stackoverflow.com/q/26759688
tags question: http://stackoverflow.com/q/26830295
tags question: http://stackoverflow.com/q/26716603
tags question: http://stackoverflow.com/q/26719015
type: Tag
tags question: http://stackoverflow.com/q/26690157
tags question: http://stackoverflow.com/q/26813980
tags question: http://stackoverflow.com/q/26699386
tags question: http://stackoverflow.com/q/26735846
tags question: http://stackoverflow.com/q/26707853
tags question: http://stackoverflow.com/q/26733704
tags question: http://stackoverflow.com/q/26716677
tags question: http://stackoverflow.com/q/26684990
tags question: http://stackoverflow.com/q/26678285
tags question: http://stackoverflow.com/q/26781025
tags question: http://stackoverflow.com/q/26715148
tags question: http://stackoverflow.com/q/26696653
tags question: http://stackoverflow.com/q/26707648
tags question: http://stackoverflow.com/q/26811861
tags question: http://stackoverflow.com/q/26824761
tags question: http://stackoverflow.com/q/26830500
tags question: http://stackoverflow.com/q/26678756
tag name: groovy

http://stackoverflow.com/comment/42094989
score: 0
type: AnswerComment
has text: How do you open a 'system.in input' stream if someone used a '.close' in previous code.Seems like one should never close the scanner so that if someone is updating the program, can make another scanner without this happening.
type: Comment
comment on: http://stackoverflow.com/a/26722929

http://stackoverflow.com/a/26776029
answers question: http://stackoverflow.com/q/26775649
has body: Use JarSplice to create OS X app bundle. Compile all your jars and resources into one jar file and export as mac .app file. Deploying Java Applications can be a pain if your application has multiple jars and native libraries. There are the options of using Java Web Start or Java Applets however these are not always suitable. Executable Jars are an option, however if your project has multiple jars or native files then it can be tricky to use this option. JarSplice attempts to solve this issue by allowing you to merge all your jars and native files into one, easy to use executable jar file. Features: Creates a single executable fat jar via an easy to use GUI. Automatically extracts only the native files needed for the OS the jar is running on. Automatically cleans up any extracted native files after the application quits. Add VM arguments on jar creation which removes the need to enter them via the command line. Optionally create a Shell Script (.sh) launcher for Linux with embedded fat jar. Optionally create an OS X App Bundle (.app) for running your application. Optionally create a Windows Application (*.exe) for running your application. This is the best cross-platform installer creator i have found yet. You can get the java executable from here
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/69342602
downvote count: 0

http://stackoverflow.com/comment/42054569
has text: Maybe you could word the question as a question. What do you want to know?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26733909
score: 0

http://stackoverflow.com/comment/42183395
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26804940
has text: a) Do you want the same source number to produce the same random number each time? b) Given the random number, do you want it to be easy to discover the original number given a pass key? b) Given the random number, do you want it to be easy to discover the original number?
type: Comment

http://stackoverflow.com/q/26782441
has answer: http://stackoverflow.com/a/26782549
has answer: http://stackoverflow.com/a/26782578
has comment: http://stackoverflow.com/comment/42142070
upvote count: 2
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/26782463
type: Question
score: 1
tagged with: java
has title: Strange way of concatenating values in Java
has comment: http://stackoverflow.com/comment/42142015
has body: System.out.println("" + 1+1); System.out.println(1+1 + ""); Why is the first line printing 11 and the second line printing 2?
favorite count: 0
answer count: 3

http://stackoverflow.com/a/26739451
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26738984
has body: Class variables should be declared inside the class. What you're doing is you're setting the same (global) variables each time you add a new TreeDot. P.S. your getters are not the problem as some of the answers are mentioning.

http://stackoverflow.com/q/26733439
linked to: http://stackoverflow.com/q/14529901
upvote count: 1
has comment: http://stackoverflow.com/comment/42057661
has answer: http://stackoverflow.com/a/28138677
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42053694
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26733490
tagged with: inheritance
has title: Undestanding Java Inheritance: strange behaviour
has comment: http://stackoverflow.com/comment/42054210
has body: I don't understand a strange behavior of class inheritance. This is my parent class: public class Cubetti implements Token{ ... private int id=1; ... public Cubetti(int n) { numero = n; } ... public int getId() { return id; } public void setId( int idx) { id = idx; } ... } and this is the subclass: public class RGC extends Cubetti{ private int id=0; ... public RGC (int idx) { super(0); id = idx; // STRANGE BEHAVIOUR ! } ... } This is the test mainclass: public static void main(String[] args) { RGC uno = new RGC(1); RGC due = new RGC(2); System.out.println(" uno Id is " + uno.getId() + " due Id is" + due.getId()); } The output is Uno Id is 1 and due Id is 1 but if I use in the tagged line on the RGC subclass: .... // id = idx; setId(idx); .... The output is Uno Id is 1 and due Id is 2 Why?
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26711424
has body: Not possible. The array size can be a maximum of Integer.MAX_VALUE (minus something usually 5 or 8, depending on the JVM capabilities). Why?. The index for an Array should be an integer thats a limitation.
answers question: http://stackoverflow.com/q/26711407
downvote count: 0
has comment: http://stackoverflow.com/comment/42014340
type: Answer
has comment: http://stackoverflow.com/comment/42014387
upvote count: 1
score: 1

http://stackoverflow.com/q/26733700
has answer: http://stackoverflow.com/a/26733758
downvote count: 0
answer count: 1
tagged with: textview
score: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26733758
type: AnsweredQuestion
tagged with: onclick
has body: I have dialog contain TextView. Inside the TextView I have number so i want to set onClick method for the TextView and I want to use call method to call the number inside the TextView Inside the dialog xml file i set the textview as below &lt;TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#2d76ba" android:layout_toRightOf="@+id/image" android:onClick="no1" android:clickable="true"/&gt; and here is my dialog final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.pop); // pop is my dialog xml dialog.setTitle("Phone Call"); TextView text = (TextView) dialog.findViewById(R.id.text1); text.setText(values[0]); /// I'm calling the number from array public void no1(View v) { Intent dial = new Intent(); dial.setAction("android.intent.action.DIAL"); dial.setData(Uri.parse("tel:"+values[0])); startActivity(dial); } but the onClick method (no1) is wrong it says "void is an invalid type for the variable no1" how can i correct the method to work inside the dialog ? I tried to make it outside the dialog but when i click the textview the logcat says 11-04 13:39:48.666: E/AndroidRuntime(26249): java.lang.IllegalStateException: Could not find a method no1(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.TextView with id 'text1' so it looks like the function is not available
tagged with: java
tagged with: android-dialog
upvote count: 1
duplicate of: http://stackoverflow.com/q/13739962
type: Question
has comment: http://stackoverflow.com/comment/42054152
has title: how to set on click method for text inside dialog
has comment: http://stackoverflow.com/comment/42054248

http://stackoverflow.com/a/33752941
answers question: http://stackoverflow.com/q/26765531
score: 0
has body: I had had this problem before. The array adapter is not null as I can access its count, but I can't clear it or add elements to it. This is because the way I have initialised my array adapter in onCreateView() method. I passed it the last argument as "Arrays.asList(my_array_of_strings)" String[] data = { "Mon 6/23 - Sunny - 31/17", "Tue 6/24 - Foggy - 21/8", "Wed 6/25 - Cloudy - 22/17", "Thurs 6/26 - Rainy - 18/11", "Fri 6/27 - Foggy - 21/10", "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18", "Sun 6/29 - Sunny - 20/7" }; arrayAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.list_item_forecast, R.id.list_item_forecast_textview, Arrays.asList(data)); while the last argument should be "new ArrayList(Arrays.asList(my_array_of_strings))" String[] data = { "Mon 6/23 - Sunny - 31/17", "Tue 6/24 - Foggy - 21/8", "Wed 6/25 - Cloudy - 22/17", "Thurs 6/26 - Rainy - 18/11", "Fri 6/27 - Foggy - 21/10", "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18", "Sun 6/29 - Sunny - 20/7" }; List&lt;String&gt; weekForecast = new ArrayList&lt;String&gt;(Arrays.asList(data)); arrayAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.list_item_forecast, R.id.list_item_forecast_textview, weekForecast); this is because the difference between Arrays.asList(array) and new ArrayList(Arrays.asList(array)) as stated here .
type: Answer

http://stackoverflow.com/q/26748026
upvote count: 2
tagged with: loops
has title: Check if integer has repeating digits. No string methods or arrays
has comment: http://stackoverflow.com/comment/42080712
tagged with: java
answer count: 4
score: 2
has answer: http://stackoverflow.com/a/26748946
possible better answer: http://stackoverflow.com/a/26748120
has answer: http://stackoverflow.com/a/41849644
downvote count: 0
has answer: http://stackoverflow.com/a/26748120
tagged with: int
has comment: http://stackoverflow.com/comment/42080678
type: Question
tagged with: while-loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41734518
favorite count: 0
accepted answer: http://stackoverflow.com/a/26748946
has body: I'm trying to see if an int has multiples of the same digit. Trying to do it without string methods or arrays. The main method I'm having trouble with is hasDistinctDigits(). It works when the repeating digits are at the end, but not when they come at the beginning or middle. public static void main(String[] args) { System.out.println(hasDistinctDigits(12234)); } public static boolean hasDistinctDigits(int number) { boolean returner = true; int count = 1; int newNum = number; int digit = 0; while (count &lt; numDigits(number)) { while (count &lt; numDigits(newNum)) { digit = newNum % 10; newNum/=10; if (digit == getDigit(newNum, count)) { returner = false; } count++; } count++; } return returner; } public static int numDigits(int number) { int count = 0; while (number != 0) { number /= 10; count++; } return count; } public static int getDigit(int number, int i) { int digit = 0; int count = 0; int originalNum = number; while (count &lt;= i) { if (count == i) { digit = number % 10; } number /= 10; count++; } if (i &gt; numDigits(originalNum)) { return -1; } else { return digit; } } } If this is run, you will see '2' repeats itself, but the method still evaluates to true when it should be false.

http://stackoverflow.com/comment/41975297
comment on: http://stackoverflow.com/a/26682990
type: Comment
has text: @Manuelarte, I've edited my answer, hope it reflects your requirements.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42063336
score: 0
comment on: http://stackoverflow.com/a/26737594
has text: In addition what was written by CL., this will actually skip the first row.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42194091
has text: This was a quiz question and i was just confused because it was multidimensional. I know that the last index of the row is 10 and 16 for the column i just wasn't sure if you put it like 10 and 16 or if i was supposed to combine them or something.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26809876

http://stackoverflow.com/q/26727527
type: Question
has answer: http://stackoverflow.com/a/26728470
answer count: 2
downvote count: 0
tagged with: jsp
tagged with: javascript
has title: Showing error message on JSP using BindingResult
has body: I am new to Spring. I am trying to show error messages on jsp for the wrong user and password by using BindingResult. But the error messages are not showing. Please suggest me what I is wrong in the below code. JSP <form:form action="login.test" id="loginForm" commandName="loginForm" method="POST"> User Name: <form:input id="userNameID" path="userName" class="textInput" /> <form:errors path="userName" class="error"/> Password: <form:password id="passwordID" path="password" class="textInput" /> <form:errors path="password" class="error"/> Login </form:form> Controller @RequestMapping(value = "login.test", method = RequestMethod.POST) public String processForm( LoginForm loginForm, BindingResult result, ModelMap model, HttpSession session) throws SQLException { String resultedPage; model.addAttribute("l_nodes", reportService.getAllLiveNodes()); model.addAttribute("s_nodes", reportService.getAllStaticReportNodes()); User user = userService.getUserByName( loginForm.getUserName() ); if( user != null ){ session.setAttribute("userID", user.getUserID()); if( loginForm.getPassword().equals( user.getPassword() ) ){ resultedPage = "home/userHome"; }else{ result.rejectValue( "password", "login.passwordNotValid"); resultedPage = "redirect:login.test"; } }else{ result.rejectValue( "userName", "login.userNotValid"); resultedPage = "redirect:login.test"; } return resultedPage; } Thanks
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/44229132
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12025888

http://stackoverflow.com/a/26871343
score: 0
has body: You can use a controlling rendering quality read this: https://docs.oracle.com/javase/tutorial/2d/advanced/quality.html example for your code: Graphics2D graphics = (Graphics2D)image.getGraphics(); RenderingHints rh = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh); graphics.setColor(Color.WHITE); graphics.fill(new Rectangle.Float(0, 0, (float)imageWidth, (float)imageHeight));
type: Answer
has comment: http://stackoverflow.com/comment/63113515
answers question: http://stackoverflow.com/q/26734001

http://stackoverflow.com/comment/42113465
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26766333
type: Comment
has text: Thanks, so that fixed that error, but It still has more.

http://stackoverflow.com/q/26702105
tagged with: android
has comment: http://stackoverflow.com/comment/42002307
linked to: http://stackoverflow.com/q/26457096
favorite count: 0
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/32021070
tagged with: resolve
type: AnsweredQuestion
has title: Cannot resolve symbol 'android:TextApperance.Material' Android Studio
tagged with: java
type: Question
upvote count: 2
answer count: 1
has body: I have created a Google Maps Activity and I have a weird error: 'Cannot resolve symbol android:TextAppearance.Material' and also 100,000 more errors that start with'Cannot resolve symbol android:TextAppearance.Material' and the ThemeOverlay. I need some help because I am a total noob at this... (Yes, I tried the tools->android->sync project with gradle files and build->clean and rebuild project.) Thanks! Edit: I also have the 'Cannot resolve symbol R' error, but I think that is because of this.
accepted answer: http://stackoverflow.com/a/32021070
tagged with: symbols

http://stackoverflow.com/q/26745525
type: UnansweredQuestion
tagged with: servlet-filters
has answer: http://stackoverflow.com/a/26764874
tagged with: java
tagged with: servlets
type: Question
tagged with: jsf-2
tagged with: httpsession
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/513832
has body: I use jsf 2.2 and i want to redirect jsf pages to login page without session i didn't use http session here.iam trying to use session scoped variable and check whelther variable is null or not and redirect it to login page because session scoped is enough instead of http session right?? my filter class is package com.invoice; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletResponse; /** * Servlet Filter implementation class sessionfilter */ public class sessionfilter implements Filter { /** * Default constructor. */ public sessionfilter() { // TODO Auto-generated constructor stub } /** * @see Filter#destroy() */ public void destroy() { // TODO Auto-generated method stub } /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub // place your code here // pass the request along the filter chain HttpServletResponse httpResponse = (HttpServletResponse) response; login b=new login(); if(b.username=="") { httpResponse.sendRedirect("Login.xhtml"); } else{ chain.doFilter(request, response); } } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { // TODO Auto-generated method stub } } my bean class is here package com.invoice; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; public class login { String username,userpassword,errormess,navipg; public String getNavipg() { return navipg; } public void setNavipg(String navipg) { this.navip…
has title: Jsf 2.2 with servlet filter

http://stackoverflow.com/q/26724913
tagged with: java
tagged with: background
has answer: http://stackoverflow.com/a/26728814
has body: I'd like to color elements in a JTree. However, simply adding a background color only to the label looks kind of strange. Particularly if more than one node is selected, the resulting shape looks ragged and distracting. Is there a way to make the background extend the whole width of the tree element, so that the whole row gets colored? Either starting at the left border or starting at the beginning of the label, but definitely extending till the right border of the component? Here is a small self-contained demo, based on this question. import java.awt.*; import javax.swing.*; import javax.swing.tree.*; public class SO26724913 { public static void main(String[] args) { DefaultMutableTreeNode a = new DefaultMutableTreeNode("a"); DefaultMutableTreeNode b = new DefaultMutableTreeNode("b"); DefaultMutableTreeNode c = new DefaultMutableTreeNode("c"); a.add(b); a.add(c); final JTree tree = new JTree(a); tree.setCellRenderer(new DefaultTreeCellRenderer() { @Override public Component getTreeCellRendererComponent (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean focus) { JComponent c = (JComponent) super.getTreeCellRendererComponent (tree, value, selected, expanded, leaf, row, focus); DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; String data = (String)node.getUserObject(); if ("b".equals(data)) { c.setBackground(Color.RED); c.setOpaque(true); } else { c.setBackground(null); c.setOpaque(false); } return c; } }); JFrame frm = new JFrame(); frm.getContentPane().add(tree); frm.setSize(200, 200); frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frm.setVisible(true); } } This is what the code currently generates. I'd prefer either this or this.
score: 9
type: Question
tagged with: jtree
upvote count: 9
downvote count: 0
tagged with: background-color
has comment: http://stackoverflow.com/comment/42046207
has comment: http://stackoverflow.com/comment/42047467
accepted answer: http://stackoverflow.com/a/26728814
answer count: 1
linked to: http://stackoverflow.com/q/16500414
favorite count: 0
has title: Color row in JTree
has comment: http://stackoverflow.com/comment/42048156
tagged with: swing
has comment: http://stackoverflow.com/comment/42046906
type: AnsweredQuestion

http://stackoverflow.com/q/26808528
possible better answer: http://stackoverflow.com/a/26808892
score: 0
answer count: 2
tagged with: thread-sleep
tagged with: applet
has comment: http://stackoverflow.com/comment/42190234
has body: Whenever I drag to change the window size in my applet, the paint method appears to run again. What is really happening? Is the paint method just re-running itself? Is there a way I can make it do this automatically (without changing the window size)? The for loop does not seem to be working. I had a thread.sleep method in the code but it still didn't help. I will include the code for the paint method below. // ----------------------------------------------------------------- // Paints the stick figures on the applet. // ----------------------------------------------------------------- public void paint(Graphics page) { // for (int f = 0; f &lt; 6; f++) { resize(400, 150); for (int u = 0; u &lt; stickdudes.length; u++) stickdudes[u].draw(page); // Delay.sleep(3000); // } }
has comment: http://stackoverflow.com/comment/42190130
has answer: http://stackoverflow.com/a/26808892
accepted answer: http://stackoverflow.com/a/26809020
has title: What is really happening when the applet window size is changed by the user?
has comment: http://stackoverflow.com/comment/42190403
has comment: http://stackoverflow.com/comment/42190573
type: AnsweredQuestion
tagged with: paint
tagged with: java
has comment: http://stackoverflow.com/comment/42190022
has answer: http://stackoverflow.com/a/26809020
type: Question
tagged with: awt

http://stackoverflow.com/comment/42125387
comment on: http://stackoverflow.com/q/26772522
has text: how ever its not compete example code so its wont be possible to assue something that is what i am trying to say @JasonC
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26676230
has comment: http://stackoverflow.com/comment/41952349
has comment: http://stackoverflow.com/comment/41952880
has comment: http://stackoverflow.com/comment/41966219
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41956551
answers question: http://stackoverflow.com/q/26675725
has comment: http://stackoverflow.com/comment/41958473
type: Answer
accepted answer of: http://stackoverflow.com/q/26675725
has comment: http://stackoverflow.com/comment/41963086
has body: I would go back and learn about modular arithmetic. Assuming c = 9, c%5 = 4. How is that suppose to be interpreted as a boolean? In your code you could have an expression like "if(c%2 || c%3 || c%5)" which, assuming c=9, translates to if(1 || 0 || 4). In Java, conditionals need to be written as boolean expressions. You need to write them so your answers can explicitly be true or false. The right way would be: if((c % 2 == 0) || (c % 3 == 0) || (c % 5 == 0)) As for counting the number of numbers, use a separate variable and increment if the conditional is true.
has comment: http://stackoverflow.com/comment/41952372
has comment: http://stackoverflow.com/comment/41960965
has comment: http://stackoverflow.com/comment/41961254
has comment: http://stackoverflow.com/comment/41952388
has comment: http://stackoverflow.com/comment/41959536
has comment: http://stackoverflow.com/comment/41952040
has comment: http://stackoverflow.com/comment/41952566
has comment: http://stackoverflow.com/comment/41957928
has comment: http://stackoverflow.com/comment/41952338
has comment: http://stackoverflow.com/comment/41951729
has comment: http://stackoverflow.com/comment/41959422
has comment: http://stackoverflow.com/comment/41958085
has comment: http://stackoverflow.com/comment/41952288
score: 0

http://stackoverflow.com/comment/46024964
has text: That makes sense. In my case things were more complicated, because we inherited our pom from another pom which has a lot of magic inside. One of the tweaks it contains is setting the java compliance. Fortunately we were able to find that problem and correct the parent pom.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27197776
type: AnswerComment

http://stackoverflow.com/comment/41965494
comment on: http://stackoverflow.com/q/26683427
type: Comment
type: QuestionComment
has text: One side note, in Java you check string equality with `String.equals`.
score: 1

http://stackoverflow.com/a/26825876
has body: An approach, maybe this could help you: Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); int flag; int m=0; String _mul235=""; String _mulOf2="Multiples 2: "; String _mulOf3="Multiples 3: "; String _mulOf5="Multiples 5: "; for (long i=a;i&lt;b;i++){ flag=0; if(i%2==0) { flag+=1; _mulOf2 += i + " "; } if(i%3==0) { flag+=1;; _mulOf3 += i + " "; } if(i%5==0) { flag+=1;; _mulOf5 += i + " "; } if (flag==3){ m+=1; _mul235+= i + " "; } } System.out.println("Range: From " + a + " to "+b); System.out.println("Integer multiples of (2, 3 y 5): "+ m + "\n[ "+_mul235+"]"); System.out.println("Checking:"); System.out.println(_mulOf2); System.out.println(_mulOf3); System.out.println(_mulOf5);
type: Answer
answers question: http://stackoverflow.com/q/26825239
score: 0

http://stackoverflow.com/q/26799879
type: Question
has comment: http://stackoverflow.com/comment/42174332
tagged with: java
upvote count: 2
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/42174435
answer count: 1
has title: Dynamic class loading in OSGi
favorite count: 0
tagged with: osgi
tagged with: dynamic-class-loaders
tagged with: spi
has answer: http://stackoverflow.com/a/26800427
accepted answer: http://stackoverflow.com/a/26800427
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I have a whole bunch of framework modules that work fine on OSGi, all the services and components are finding one another and running just fine. There is however one framework that does some dynamic stuff regarding classes. Basically at some point you give it a class name and it performs Class.forName() and then reflection magic happens. This works great when running in a standard jvm and using SPI to wire together the frameworks but it fails in OSGi because of course that random class "test.MyTest" that you are trying to approach via the framework is not visible to said framework. It will throw a "java.lang.ClassNotFoundException: test.MyTest not found by framework" So my question: how can I solve this lack of visibility for the framework that needs to see all? Import-Package: *? UPDATE Assuming OSGi hasn't changed much since 2010 on this front, the article http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html is very interesting. I have currently added support for both actively registering classes and a domain factory to be injected via OSGi. Apart from that the default resolving uses context classloader anyway so if all else fails that will be used to try and load the class. UPDATE I have added support for the suggested DynamicImport-Package as well which is easier for small projects.
has comment: http://stackoverflow.com/comment/42174341

http://stackoverflow.com/a/26709339
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42011392
has comment: http://stackoverflow.com/comment/42010620
has comment: http://stackoverflow.com/comment/42010969
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/26709314
has body: Mark the Field as @Transient. Transient Fields are not saved or read from the database.

http://stackoverflow.com/comment/42196883
comment on: http://stackoverflow.com/a/26812320
type: Comment
has text: The function is run in a loop, so each time the sum variable is reset
score: 0
type: AnswerComment

http://stackoverflow.com/a/26762108
type: Answer
has body: You didn't close() the BW so the end of the text was left in the buffer. Add to the end of this code BW.close();
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26762034
answers question: http://stackoverflow.com/q/26762034
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42105995

http://stackoverflow.com/a/26717849
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42048991
has body: I believe you are looking for this: String searchString = "{\"jql\": \"project\",\"startAt\": 0,\"maxResults\":1 ,\"fields\": [\"id\",\"key\",\"summary = UI Test nn nn OAADI: Dispatching of activities to field technicians\"]}"; In Java, string requires double quotes ", char requires single quotes '. To embed quotes in a string like you want, you have to escape them by adding a \ in front. You can find all the juicy details about escaping here.
upvote count: 4
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/26717743
answers question: http://stackoverflow.com/q/26717743

http://stackoverflow.com/comment/42066376
score: 0
comment on: http://stackoverflow.com/a/26737594
has text: oh well, @CL, that could simply be the problem
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26778958
has title: Convert Base64 to Binary String in Java
has body: I have the following 3 byte encoded Base64 string. String base64_str = "MDQw"; System.out.println("base64:" + base64_str); String hex = DatatypeConverter.printHexBinary(DatatypeConverter.parseBase64Binary(base64_str)); for (int i = 0; i &lt; hex.length(); i+=6) { String bytes = hex.substring(i, i+6); System.out.println("hex: " + bytes); StringBuilder binary = new StringBuilder(); int byte3_int = Integer.parseInt(bytes.substring(4, 6), 16); String byte3_str = Integer.toBinaryString(byte3_int); byte3_int = Integer.valueOf(byte3_str); binary.append(String.format("%08d", byte3_int)); int byte2_int = Integer.parseInt(bytes.substring(2, 4), 16); String byte2_str = Integer.toBinaryString(byte2_int); byte2_int = Integer.valueOf(byte2_str); binary.append(String.format("%08d", byte2_int)); int byte1_int = Integer.parseInt(bytes.substring(0, 2), 16); String byte1_str = Integer.toBinaryString(byte1_int); byte1_int = Integer.valueOf(byte1_str); binary.append(String.format("%08d", byte1_int)); System.out.println("binary: " + binary); } } My Output is: base64:MDQw hex: 303430 binary: 001100000011010000110000 The above output is correct, but is there a more efficient way on converting a base64 string to binary string? Thanks in advance.
type: AnsweredQuestion
tagged with: java
tagged with: base64
type: Question
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/26781736
score: 0
has answer: http://stackoverflow.com/a/42709418
possible better answer: http://stackoverflow.com/a/26781736
accepted answer: http://stackoverflow.com/a/42709418
tagged with: hex
tagged with: binary

teradata
type: Tag
tag name: teradata
tags question: http://stackoverflow.com/q/26684648

http://stackoverflow.com/q/26681930
has comment: http://stackoverflow.com/comment/41962698
has title: Migration from Tomcat 7 to Tomcat 8
tagged with: tomcat
score: 0
upvote count: 1
has body: Hi I was having a maven ee project with eclipse Juno and Tomcat 7. Everything was working fine and then I moved towards up-gradation of tomcat server to tomcat 8. Now I had to download eclipse luna so i did that and configured tomcat 8 with my project in eclipse luna. But I am getting four messages in marker. Cannot change version of project facet Dynamic Web Module to 3.0. JavaServer Faces 2.2 can not be installed : One or more constraints have not been satisfied. JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer. One or more constraints have not been satisfied. My web.xml file is: ... My Pom.xml file is: 4.0.0 xyz xyz war 0.0.1-SNAPSHOT svc Maven Webapp http://maven.apache.org com.github.ptgoetz storm-signals 0.2.0 org.apache.storm storm-core 0.9.1-incubating junit junit 4.8.2 test commons-configuration commons-configuration 1.6 org.apache.hadoop hadoop-client 2.2.0 org.apache.hbase hbase-client 0.98.4-hadoop2 org.apache.zookeeper zookeeper 3.4.6 javax.servlet javax.servlet-api 3.0.1 mysql mysql-connector-java 5.1.32 com.googlecode.json-simple json-simple 1.1.1 log4j log4j 1.2.16 org.json json 20090211 com.sun.jersey jersey-server 1.8 com.sun.jersey jersey-client 1.8 com.sun.jersey.contribs jersey-multipart 1.8 com.google.code.gson gson 2.2.4 redis.clients jedis 2.0.0 javax javaee-api 7.0 provided javax.json javax.json-api 1.0 org.glassfish javax.json 1.0 runtime <finalName>xyz/finalName> Plus: I searched a lot and messed up my web.xml and pom.xml and ./settings files as well and now I dont even remember which changes I have made but one thing i remember is that I was using servlet 2.5 in juno. Any help in right direction would be very appreciative. UPDATE 1: Changed servlet to 3.0.1. But still getting same error This facet.core.xml file of ./settings folder. <?xml version="1.0" encoding="UTF-8"?> <fixed facet="wst.jsdt.web"/> <installed facet="java" version="1.5"/> <installed facet="jst.web" version="2.3"/> <installed facet="wst.jsdt.web" version="1.0…
downvote count: 1
tagged with: tomcat8
has answer: http://stackoverflow.com/a/26682139
favorite count: 0
type: UnansweredQuestion
tagged with: eclipse-luna
tagged with: java
has comment: http://stackoverflow.com/comment/41962932
has comment: http://stackoverflow.com/comment/41962699
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41962949
has answer: http://stackoverflow.com/a/26682738
type: Question
answer count: 2

java-8
tags question: http://stackoverflow.com/q/26691278
tags question: http://stackoverflow.com/q/26675751
tags question: http://stackoverflow.com/q/26721890
tags question: http://stackoverflow.com/q/26702904
tags question: http://stackoverflow.com/q/26723994
tags question: http://stackoverflow.com/q/26690996
tags question: http://stackoverflow.com/q/26799874
tags question: http://stackoverflow.com/q/26727812
tags question: http://stackoverflow.com/q/26771090
tags question: http://stackoverflow.com/q/26737447
tags question: http://stackoverflow.com/q/26679628
tags question: http://stackoverflow.com/q/26816650
tags question: http://stackoverflow.com/q/26700824
tags question: http://stackoverflow.com/q/26702675
tags question: http://stackoverflow.com/q/26775676
tags question: http://stackoverflow.com/q/26747982
tags question: http://stackoverflow.com/q/26794964
tags question: http://stackoverflow.com/q/26828708
tags question: http://stackoverflow.com/q/26809271
tags question: http://stackoverflow.com/q/26752919
tags question: http://stackoverflow.com/q/26783788
tags question: http://stackoverflow.com/q/26832267
tags question: http://stackoverflow.com/q/26821638
tags question: http://stackoverflow.com/q/26818307
tags question: http://stackoverflow.com/q/26700929
tags question: http://stackoverflow.com/q/26771953
tags question: http://stackoverflow.com/q/26684562
tags question: http://stackoverflow.com/q/26798154
tags question: http://stackoverflow.com/q/26810375
tags question: http://stackoverflow.com/q/26779676
tag name: java-8
tags question: http://stackoverflow.com/q/26828246
tags question: http://stackoverflow.com/q/26812096
tags question: http://stackoverflow.com/q/26804941
tags question: http://stackoverflow.com/q/26768523
tags question: http://stackoverflow.com/q/26687937
tags question: http://stackoverflow.com/q/26762905
type: Tag
tags question: http://stackoverflow.com/q/26775395
tags question: http://stackoverflow.com/q/26764560
tags question: http://stackoverflow.com/q/26826579
tags question: http://stackoverflow.com/q/26826543

http://stackoverflow.com/a/32536589
score: 0
type: Answer
has body: linux is case sensitive. windows is not. try to an "ls" and note the case. use the same case in your program.
answers question: http://stackoverflow.com/q/26731249

http://stackoverflow.com/comment/42174429
score: 0
type: Comment
type: QuestionComment
has text: to match the numbers `\\d+`
comment on: http://stackoverflow.com/q/26800435

http://stackoverflow.com/comment/42234017
comment on: http://stackoverflow.com/a/26809874
has text: @fge yes, this is true, i wanted to provide just hint how to solve problem or where to start, it is allways better when questioner compose the solution himself from hints than by copy pasting the whole provided solution without actually understanding what it does.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26802004
has comment: http://stackoverflow.com/comment/42269075
tagged with: cxf
upvote count: 2
linked to: http://stackoverflow.com/q/26720402
tagged with: web-services
type: Question
tagged with: java
has body: When I start a webservice soap client using cxf and spring, I'm getting the following error about 100 times: org.apache.cxf.transport.https.HttpsURLConnectionFactory: Default key managers cannot be initialized: c:\users\me\.keystore (File not found) What does that mean? Where does this error come from? //cxf 3.0.1 autogenerated: @WebServiceClient @Generated public class SoapService extends CXFService { } //instantiated by new SoapService(new SpringBus()); /edit: probably duplicate of the following, which has no answers: wsdl2java - WARNING: Default key managers cannot be initialized
has comment: http://stackoverflow.com/comment/42257917
downvote count: 0
has title: CXF: Default key managers cannot be initialized
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: spring
score: 2
answer count: 0

http://stackoverflow.com/comment/76108326
type: AnswerComment
type: Comment
score: 0
has text: what would happen if multiple write happening at different threads on same volatile variable concurrently?
comment on: http://stackoverflow.com/a/26757012

http://stackoverflow.com/comment/42110053
comment on: http://stackoverflow.com/a/26762424
has text: May I just ask how would I use the BigInteger class in my code? Sorry for so many questions :(
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41986558
has text: When I do something like this, I'm missing roughly half my expected outputs. Is it reasonable for the Reducer to not collect/emit a key-value pair?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26695769
type: Comment

http://stackoverflow.com/comment/42289309
type: QuestionComment
comment on: http://stackoverflow.com/q/26772188
score: 0
has text: if you want to get the twitter tweets to hdfs using flume refer the below link : http://www.thecloudavenue.com/2013/03/analyse-tweets-using-flume-hadoop-and.html
type: Comment

http://stackoverflow.com/comment/42049435
has text: Remove the lowercased letter first (e.g. using a regex), then use toCharArray().
comment on: http://stackoverflow.com/q/26730918
type: QuestionComment
type: Comment
score: 5

http://stackoverflow.com/comment/42189636
type: Comment
comment on: http://stackoverflow.com/a/26800900
type: AnswerComment
score: 0
has text: I wanted to be able to use reflection to read in the rest of the fields. If I used the Json.Serializable interface, wouldn't that require me to manually read and write everything (which is what your Profile class does)? Doing it your way does work nicely, but I was just wondering how to use Json.serializer instead (not that it's vital, but just out of curiosity).

program-entry-point
tags question: http://stackoverflow.com/q/26694612
tag name: program-entry-point
tags question: http://stackoverflow.com/q/26801877
tags question: http://stackoverflow.com/q/26719251
tags question: http://stackoverflow.com/q/26744379
type: Tag
tags question: http://stackoverflow.com/q/26710891

http://stackoverflow.com/comment/44427794
comment on: http://stackoverflow.com/a/26742321
type: Comment
score: 0
type: AnswerComment
has text: hi, if i have By.id("userid") how i can write your code?

http://stackoverflow.com/comment/42118753
has text: Okay, I retract my previous statement. I just removed the commit and close connection lines of code, and it still worked, just with the auto server on. So, do I still need to use the commit statement? What is the benefit of using "commit", or the risk of not using it? Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26764070
type: Comment

http://stackoverflow.com/comment/42093797
type: Comment
has text: I am using simple jsp scriplet
type: AnswerComment
comment on: http://stackoverflow.com/a/26755639
score: 0

http://stackoverflow.com/comment/42248848
has text: The testcase is now added to the question. It's not really small but some what sscce. The issue is fully reproducible now.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26816650

http://stackoverflow.com/comment/42217784
type: Comment
score: 0
type: AnswerComment
has text: Thank you. I got it now. Do you know what difference it makes to the result (when I print it to screen) if I use UTF-8 or ASCII encoding? I will print it in hex
comment on: http://stackoverflow.com/a/26824312

http://stackoverflow.com/comment/42034084
has text: "what would happen to the list if something like this was called: ptr = mystery( ptr, 50 );" can't you run it and figure out (using a debugger if you need to)
comment on: http://stackoverflow.com/q/26722078
score: 0
type: Comment
type: QuestionComment

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

http://stackoverflow.com/comment/42104587
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26761568
has text: The answer pointed out why you're getting an error, but: what were you trying to accomplish? What did you think `if (c)` was going to do, and why is it there?
score: 0

http://stackoverflow.com/comment/42227614
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26830104
type: QuestionComment
has text: `"I don't really have a minimum working example."` -- then consider making one since that's what most of us would have to do to fully understand your problem and help you, but since it's your question, the onus of effort should be yours.

http://stackoverflow.com/q/26678285
has title: How to find out Mule flow status
has body: I have a Mule flow that I'm starting by means of the following script: muleContext.registry.lookupFlowConstruct('targetFlow').start() However, I'd like the script to be executed only when the flow is stopped. Is there any way that I can check this in the script before doing the start?
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26715852
possible better answer: http://stackoverflow.com/a/31218853
has answer: http://stackoverflow.com/a/31218853
tagged with: mule
tagged with: mule-studio
answer count: 2
tagged with: groovy
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26715852

http://stackoverflow.com/comment/42027795
comment on: http://stackoverflow.com/q/26713813
type: Comment
type: QuestionComment
has text: You should send email to support@svnkit.com but it looks like some JVM/JRE issue.
score: 0

arrays
tags question: http://stackoverflow.com/q/26684290
tags question: http://stackoverflow.com/q/26754502
tags question: http://stackoverflow.com/q/26814881
tags question: http://stackoverflow.com/q/26772157
tags question: http://stackoverflow.com/q/26752824
tags question: http://stackoverflow.com/q/26820463
tags question: http://stackoverflow.com/q/26694929
tags question: http://stackoverflow.com/q/26716002
tags question: http://stackoverflow.com/q/26771364
tags question: http://stackoverflow.com/q/26727714
tags question: http://stackoverflow.com/q/26697448
tags question: http://stackoverflow.com/q/26678482
tags question: http://stackoverflow.com/q/26705580
tags question: http://stackoverflow.com/q/26796138
type: Tag
tags question: http://stackoverflow.com/q/26776312
tags question: http://stackoverflow.com/q/26826465
tags question: http://stackoverflow.com/q/26766265
tags question: http://stackoverflow.com/q/26780643
tags question: http://stackoverflow.com/q/26795681
tags question: http://stackoverflow.com/q/26768046
tags question: http://stackoverflow.com/q/26795100
tags question: http://stackoverflow.com/q/26740232
tags question: http://stackoverflow.com/q/26707520
tags question: http://stackoverflow.com/q/26793454
tags question: http://stackoverflow.com/q/26735902
tags question: http://stackoverflow.com/q/26826187
tags question: http://stackoverflow.com/q/26773663
tags question: http://stackoverflow.com/q/26679860
tags question: http://stackoverflow.com/q/26691940
tags question: http://stackoverflow.com/q/26733809
tags question: http://stackoverflow.com/q/26781154
tags question: http://stackoverflow.com/q/26704512
tags question: http://stackoverflow.com/q/26813095
tags question: http://stackoverflow.com/q/26748318
tags question: http://stackoverflow.com/q/26720731
tags question: http://stackoverflow.com/q/26809346
tags question: http://stackoverflow.com/q/26678869
tags question: http://stackoverflow.com/q/26793827
tags question: http://stackoverflow.com/q/26745332
tags question: http://stackoverflow.com/q/26807352
tags question: http://stackoverflow.com/q/26773780
tags question: http://stackoverflow.com/q/26702496
tags question: http://stackoverflow.com/q/26705104
tags question: http://stackoverflow.com/q/26746430
tags question: http://stackoverflow.com/q/26753386
tags question: http://stackoverflow.com/q/26676304
tags question: http://stackoverflow.com/q/26723322
tags question: http://stackoverflow.com/q/26699782
tags question: http://stackoverflow.com/q/26801877
tags question: http://stackoverflow.com/q/26698043
tags question: http://stackoverflow.com/q/26693722
tags question: http://stackoverflow.com/q/26789237
tags question: http://stackoverflow.com/q/26706400
tags question: http://stackoverflow.com/q/26776200
tags question: http://stackoverflow.com/q/26770659
tags question: http://stackoverflow.com/q/26792298
tags question: http://stackoverflow.com/q/26686872
tags question: http://stackoverflow.com/q/26681336
tags question: http://stackoverflow.com/q/26795120
tags question: http://stackoverflow.com/q/26717583
tags question: http://stackoverflow.com/q/26752720
tags question: http://stackoverflow.com/q/26695573
tags question: http://stackoverflow.com/q/26793489
tags question: http://stackoverflow.com/q/26770419
tags question: http://stackoverflow.com/q/26826616
tags question: http://stackoverflow.com/q/26808538
tags question: http://stackoverflow.com/q/26765252
tags question: http://stackoverflow.com/q/26741706
tags question: http://stackoverflow.com/q/26827520
tags question: http://stackoverflow.com/q/26724224
tags question: http://stackoverflow.com/q/26698627
tags question: http://stackoverflow.com/q/26684007
tags question: http://stackoverflow.com/q/26750441
tags question: http://stackoverflow.com/q/26740138
tags question: http://stackoverflow.com/q/26704381
tags question: http://stackoverflow.com/q/26696569
tags question: http://stackoverflow.com/q/26706439
tags question: http://stackoverflow.com/q/26817380
tags question: http://stackoverflow.com/q/26676614

http://stackoverflow.com/comment/42006557
score: 0
type: AnswerComment
has text: Yea. The variables are declared outside the loop. I keep getting error messages like : Exception in thread "main" java.lang.NumberFormatException: For input string: "c" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at virtualStore.main(virtualStore.java:79) when ever i try to push 'c' or 'q' when it's asking me to 'enter item numbers 1 through 4'.
type: Comment
comment on: http://stackoverflow.com/a/26704219

http://stackoverflow.com/comment/42167946
has text: Seems not to be working for me. When I click the EditView and then click anywhere on the screen, the keyboard still stays there.
comment on: http://stackoverflow.com/a/26716500
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42061083
has text: Thank you, I tested "Ctrl+Shift+F" and it worked according to the "Formatter" setting and formatted few more additional things also. But I just want to format the if-else block, can I do that independently? and also can I apply formatter at Project level instead of individual file?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26735223
type: Comment

http://stackoverflow.com/q/26674463
type: UnansweredQuestion
tagged with: spring
type: Question
has body: When I run compile() after the mapRow is done. The error gives me Property 'dataSource' is required. I have this on my xml &lt;bean id="ProcedureRepository" class="mypackage.ProcedureRepository"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; My java ProcedureRepository private DataSource dataSource; @Resource @Qualifier("dataSource") public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public String searchCode(String code){ new SeachCode(dataSource).execute(code); return code; } My SeachCode public class SearchCode extends StoredProcedure{ public SearchCode(DataSource dataSource) { super(dataSource, "MYPROC"); ... compile(); It happens when I call this: ProcedureRepository procedureRepository = new ProcedureRepository(); procedureRepository.searchCode(parameters.code); I don't know where I'm missing, i tried to add new bean in my xml, but no success, same to add new setDataSource at SearchCode
tagged with: java
answer count: 1
score: 0
has title: Jdbc Spring at Property 'dataSource' is required or NullPointer
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41948515
has answer: http://stackoverflow.com/a/26674664

http://stackoverflow.com/comment/41979095
has text: If you could use `Map<Long, Person>` reference for instance of `Map<Long, Student>` it would mean that via such reference you could put to this map any kind of person, not only Student (in other words generics are not covariant).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26691278

http://stackoverflow.com/comment/42084361
type: Comment
comment on: http://stackoverflow.com/a/26749763
type: AnswerComment
has text: I edited the loop to have the indexOf statements, but now I'm throwing a StackOverflow error. Never dealt with this error before so I'm not sure what's happening.
score: 0

http://stackoverflow.com/comment/42051278
type: Comment
type: QuestionComment
has text: Process p = Runtime.exec("root@10.117.217.160"); Cannot make a static reference to the non-static method exec(String) from the type Runtime
comment on: http://stackoverflow.com/q/26731213
score: 0

http://stackoverflow.com/comment/90328670
type: AnswerComment
comment on: http://stackoverflow.com/a/51682968
score: 0
type: Comment
has text: Consider making an effort to use proper indentation when posting code - it'll make answers easier to read.

http://stackoverflow.com/q/26790508
has title: Java Web Start shows "launched from downloaded JNLP file"
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26891671
accepted answer: http://stackoverflow.com/a/26891671
favorite count: 0
linked to: http://stackoverflow.com/q/21207037
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I have a similar issue to Java Web Start security dialogs with Java 7 update 51 and Java 7 update 51 - Prompts user confirmation message about Publisher name every time My questions is Why are there multiple locations listed? Second location being "Launched from downloaded JNLP file". I don't always see this, only sometimes, and I'm not sure what's special that makes "Launched from downloaded JNLP file" to show up as a location. I know I can include the "Application-Library-Allowable-Codebase" attribute in my jar manifest to get the security prompt with the checkbox, but I don't understand why the "Location" section of the security prompt and how it's determined Thanks!
tagged with: jar
tagged with: java-web-start
tagged with: manifest
tagged with: security

http://stackoverflow.com/a/26784200
answers question: http://stackoverflow.com/q/26782664
upvote count: 1
has body: You can make class like this and put all properties in it. class PropertiesObject { private PropertiesObject instance = null; public static PropertiesObject instace() { if(instance == null) { loadInstance(); // this is done one time } return instance; } }
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42081192
type: Comment
has text: Just to expand, `try...catch` statements will only catch runtime errors. Type-checking is done at compile time, as you say
score: 3
comment on: http://stackoverflow.com/a/26748314
type: AnswerComment

http://stackoverflow.com/comment/42013771
comment on: http://stackoverflow.com/q/26711101
has text: I want a Regular Expression for this. @Reyjohn
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26756360
tagged with: comparator
tagged with: relationship
has comment: http://stackoverflow.com/comment/42095603
linked to: http://stackoverflow.com/q/10213493
has comment: http://stackoverflow.com/comment/42094819
has title: How do I relate two elements from separate ArrayLists?
has comment: http://stackoverflow.com/comment/42094821
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42095131
tagged with: java
accepted answer: http://stackoverflow.com/a/26758620
tagged with: average
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42094827
has answer: http://stackoverflow.com/a/26758620
has body: I currently have two ArrayLists that are not linked, though in order to run some of the methods I require, I believe I may need to nest one ArrayList within the object that fills the other ArrayList. My two lists are: public static ArrayList&lt;Earthquake&gt; quakeList = new ArrayList&lt;&gt;(); public static ArrayList&lt;Observatory&gt; obsList = new ArrayList&lt;&gt;(); where: public Earthquake(String n, String obs, double m, int y, double lat, double lng) { magnitude = m; setQuakeYear(y); setLatitude(lat); setLongitude(lng); setQuakeName(n); setObsName(obs); } and: public Observatory(String n, String c, int y, double a) { this.setObsname(n); this.setObscountry(c); this.setObsyear(y); this.setObsarea(a); avgMag = (averageEarthquake()); } Which contain data on earthquakes and observatories respectively. My problem comes when trying to link the Earthquake data with a specific observatory, as I will need this functionality in order to return the Observatory with the largest AVERAGE earthquake magnitude on record. I have a method to return the average Earthquake size at the observatory: public double averageEarthquake() { Observatory o = new Observatory(); int i = 0; double sum = 0.0; for(Earthquake quake : rcdQuakes) { i++; sum += quake.magnitude; } o.avgMag = sum / i; return sum / i; } (rcdQuakes is a new ArrayList that am trying to add only earthquakes where obsName matches the Observatory.obsname) Using the comparator as follows to order the obsList by averageEarthquake: class ObsObsComp implements Comparator&lt;Observatory&gt;{ @Override public int compare(Observatory o1, Observatory o2) { if (o1.averageEarthquake() &gt; o2.averageEarthquake()) { return -1; } if (o1.averageEarthquake() &lt; o2.averageEarthquake()) { return 1; } else { return 0; } } } The method I am calling to do this (in the IO main method) is: public static Earthquake obsLargestAvg() { Collections.sort(obsList, new ObsObsComp()); return obsList.get(0); } In which I am hoping to order the obsLis…
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/42040978
type: Comment
has text: Yes, but the problem is your program may never enter the condition checkedItemPositions.get(i) of button3.
type: AnswerComment
comment on: http://stackoverflow.com/a/26724928
score: 0

http://stackoverflow.com/comment/41964017
score: 0
has text: Hmmm. Something must not be right though, to @Seelenvirtuose 's point. You shouldn't be getting the NoClassDefFoundError if those are on the classpath. Any idea why those are showing up?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26680745

http://stackoverflow.com/q/26722772
has body: I can create an AttributedString like so: AttributedString as = new AttributedString("Hello world"); Straightforward question -- how can I get the underlying text ("Hello world") from the AttributedString object? as.toString() produces the string "java.text.AttributedString@65f00565" I see in AttributedString.class that this information is stored, but deliberately private-- all (with the exception of length) reading operations are private, since AttributedString instances are accessed through iterator So looks like I need to use as.getIterator() to get an AttributedCharacterIterator and iterate over it to produce the underlying string ? Is this the best approach, and why this information is so inaccessible?
has answer: http://stackoverflow.com/a/26723161
has comment: http://stackoverflow.com/comment/42036003
tagged with: string
has comment: http://stackoverflow.com/comment/42035428
favorite count: 0
has title: Get Text (plain String) from AttributedString -- how to do, and why so hard?
has comment: http://stackoverflow.com/comment/42035900
accepted answer: http://stackoverflow.com/a/26723161
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42035847
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42035930
has comment: http://stackoverflow.com/comment/42036071
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/45866058
has comment: http://stackoverflow.com/comment/42035224
downvote count: 0
has comment: http://stackoverflow.com/comment/42035568
has comment: http://stackoverflow.com/comment/42035912
possible better answer: http://stackoverflow.com/a/45866058
has comment: http://stackoverflow.com/comment/42036096

http://stackoverflow.com/q/26810342
favorite count: 0
tagged with: testng
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has body: I currently have two different TestSuites (SUITE1.XML and SUITE2.xml) with different configurations (e.g browsers, Os)... I call both SUITES inside testng.xml to run on saucelabs... and it runs fine... Only what I am concerned is, I want these suites to run parallel instead of sequential... The output i get is [TestNG] Running: /Users/muzamilabbasi/Automation/BaublebarTest/Suite1.xml This is Browser String FIREFOX This is Platform String WIN8 This is Version String 25 This is Browser String FIREFOX This is Platform String WIN8 This is Version String 25 log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. Page Title isGoogle Page Title isGoogle =============================================== mysuite1 Total tests run: 2, Failures: 0, Skips: 0 =============================================== [TestNG] Running: /Users/muzamilabbasi/Automation/BaublebarTest/Suite2.xml This is Browser String FIREFOX This is Platform String XP This is Version String 7 This is Browser String FIREFOX This is Platform String XP This is Version String 7 Page Title isGoogle Page Title isGoogle I have searched alot of web and mostly answers I got is using ANT {PARALLEL} task I can achieve but how? I need an example.. Please help. I am using macOS &amp; TESTNG 6.8.6
has answer: http://stackoverflow.com/a/26858328
tagged with: saucelabs
type: Question
has title: Is there a possible way to run two .xml files in testng.xml parallel?
has answer: http://stackoverflow.com/a/36856735
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26824648

http://stackoverflow.com/comment/42121770
type: QuestionComment
comment on: http://stackoverflow.com/q/26770604
has text: Only if it is static ( and it seems static from your main code ). Show the MathStats code.
score: 0
type: Comment

http://stackoverflow.com/q/26748264
tagged with: runnable
has title: How a wandering Passenger can be depicted in a Thread
has body: I am writing a multi-threaded program in which Passenger wanders for a random time and waits for a cab ride. I am wondering how do I depict a wandering passenger in the Passenger Thread? class Passenger extends ThreadEvent implements Runnable { String passengerStatus; Integer passengerNumber; public String getPassengerStatus() { return passengerStatus; } public void setPassengerStatus(String status) { passengerStatus = status; } public Passenger(Integer _passengerNumber) { passengerNumber = _passengerNumber; } @Override public void run() { try { System.out.println("Passenger wandering "); // How to Implement wandering passenger here? System.out.println("Passenger waiting for Ride "); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/42081124
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42081547
has comment: http://stackoverflow.com/comment/42081588
type: Question
tagged with: java
tagged with: random
score: 0

http://stackoverflow.com/q/26815995
tagged with: java
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26816059
has body: I have created database in one application and that application is installed in multiple devices.My requirement is that if i change the value in database of one device then,that changes in database should reflect in another device of same application.I need it without server/third api. Thanks in advance...
linked to: http://stackoverflow.com/q/9608832
has comment: http://stackoverflow.com/comment/42202831
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42202876
has comment: http://stackoverflow.com/comment/42202861
tagged with: sqlite
score: 1
accepted answer: http://stackoverflow.com/a/26816059
favorite count: 0
possible better answer: http://stackoverflow.com/a/26816102
type: Question
tagged with: sockets
tagged with: android
has answer: http://stackoverflow.com/a/26816102
has comment: http://stackoverflow.com/comment/42202846
tagged with: android-sqlite
has title: How to share database between same application in multiple devices without server
upvote count: 3
has comment: http://stackoverflow.com/comment/42202927

http://stackoverflow.com/q/26681336
upvote count: 0
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/41961502
favorite count: 0
has comment: http://stackoverflow.com/comment/41961437
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/41961486
tagged with: java
downvote count: 3
has body: I know how to create arrays like so: int[] myIntArray = new int[]{1,2,3}; My question is this. What if I had a file, titled Lab11Input.txt, and filled it with integer values. How would I go about creating a method that opens the file, counts the number of numbers in the file, creates the array, then fills the array with the values from the file? For example, if I pass in Lab11Input.txt as an argument, could I do it that way?
has comment: http://stackoverflow.com/comment/41961460
type: Question
has answer: http://stackoverflow.com/a/26681380
has title: Creating an array from a text file in java

http://stackoverflow.com/comment/42143520
comment on: http://stackoverflow.com/q/26757276
has text: Why you do not use channelSftp.get(String src, OutputStream dst);?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41953224
score: 0
has text: Stefan, this means in this context I would indeed only need 2 classes ie OccurencesCouner and OccurencesCounterApp. I think I got confused about needing to use a Controller. Thanks
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26673731

http://stackoverflow.com/comment/42006841
has text: The default `service()` internally calls `doGet()` or `doPost()` etc. Spring MVC works like you expect.
type: Comment
comment on: http://stackoverflow.com/q/26706987
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42016567
comment on: http://stackoverflow.com/a/26712549
type: AnswerComment
has text: I don't think that will help, because the command `which` actually returns the particular executable you use when you write `java` on the command line. If it says `/usr/java/jdk1.6.0_27/bin/java` then that's what you're using, not /usr/bin/java (though they may be the same).
score: 0
type: Comment

http://stackoverflow.com/comment/42275838
comment on: http://stackoverflow.com/a/26742450
score: 0
type: AnswerComment
type: Comment
has text: only .txt files i am getting

postgresql
tags question: http://stackoverflow.com/q/26679415
tags question: http://stackoverflow.com/q/26698788
tags question: http://stackoverflow.com/q/26724433
tags question: http://stackoverflow.com/q/26749128
tags question: http://stackoverflow.com/q/26801688
tags question: http://stackoverflow.com/q/26751397
tags question: http://stackoverflow.com/q/26766592
tags question: http://stackoverflow.com/q/26742927
tag name: postgresql
tags question: http://stackoverflow.com/q/26712202
tags question: http://stackoverflow.com/q/26767947
tags question: http://stackoverflow.com/q/26714086
tags question: http://stackoverflow.com/q/26690671
tags question: http://stackoverflow.com/q/26740890
type: Tag
tags question: http://stackoverflow.com/q/26695516
tags question: http://stackoverflow.com/q/26776215
tags question: http://stackoverflow.com/q/26774861
tags question: http://stackoverflow.com/q/26817041
tags question: http://stackoverflow.com/q/26805821
tags question: http://stackoverflow.com/q/26720902
tags question: http://stackoverflow.com/q/26807320
tags question: http://stackoverflow.com/q/26741762
tags question: http://stackoverflow.com/q/26809513
tags question: http://stackoverflow.com/q/26758301
tags question: http://stackoverflow.com/q/26674556
tags question: http://stackoverflow.com/q/26676625
tags question: http://stackoverflow.com/q/26798477
tags question: http://stackoverflow.com/q/26701903
tags question: http://stackoverflow.com/q/26709945

http://stackoverflow.com/q/26806907
has answer: http://stackoverflow.com/a/26807003
score: 0
tagged with: records
has answer: http://stackoverflow.com/a/26807995
has title: Reading a records file and create a index for it
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42186734
tagged with: java
tagged with: file
has body: So I need to read from a records file where '#' determines the end of a record and '|' the end of a field like this: #9783642217074|Interaction|Macie|Furtado,Elizabeth|Winckler,Marco|2011#. Then I need to write just the first field of each record in another file. I'm trying to use Java I/O RandomAccessFile but I really need some light to figure it out. If anyone could tell what methods or the ideia behind this Ill be thankful.
type: Question
has comment: http://stackoverflow.com/comment/42186803
answer count: 2

http://stackoverflow.com/a/26704279
type: Answer
has comment: http://stackoverflow.com/comment/42001700
upvote count: 2
has body: Your double[][] matrix variable is local to the constructor, so it only exists within the scope of the constructor. Make it an instance variable in order to access it from other methods. public class MatrixMaker { private int rows; private int columns; private double[][] matrix; public MatrixMaker(int m, int n){ rows = m; columns = n; matrix = new double[rows][columns]; } This would make it accessible to the printer method. ...
score: 2
accepted answer of: http://stackoverflow.com/q/26704260
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26704260

http://stackoverflow.com/a/26755934
accepted answer of: http://stackoverflow.com/q/26755820
answers question: http://stackoverflow.com/q/26755820
has body: First you have forgot the assignment for s.replace(" ",""). Store that in a variable, e.g. x = s.replace(" ",""); For string comparison use .equals() method instead of ==
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/26824472
has answer: http://stackoverflow.com/a/26824497
has title: Number of multiples of x in a range for large numbers
tagged with: java
has comment: http://stackoverflow.com/comment/42217937
downvote count: 1
has answer: http://stackoverflow.com/a/26824544
type: Question
type: AnsweredQuestion
tagged with: math
has body: This is simple mathematics I guess, but I just can't figure it out + I'm new to coding. I need to find out how many numbers are divisible by x in a range. Here's an example: I need to find how many numbers in the range 11 to 30 are divisible by 3. The answer is 7, and I already coded it: while (a &lt;= b) { if (a % 3 == 0) { c++; a++; else { a++; } } HOWEVER, this works horribly for large numbers as I check every single number. I tried doing c = (b-a)/3, but obviously this doesn't work for all examples, just like it doesn't for the one above. So, could you please help me find some sort of a simple equation that would calculate this for me. I'm feeling so stupid for not being able to figure this one out.
answer count: 2
has comment: http://stackoverflow.com/comment/42217967
accepted answer: http://stackoverflow.com/a/26824544
score: 1
favorite count: 0
tagged with: division
possible better answer: http://stackoverflow.com/a/26824497
upvote count: 2

http://stackoverflow.com/q/26752881
has comment: http://stackoverflow.com/comment/42090033
favorite count: 0
has comment: http://stackoverflow.com/comment/42089043
has comment: http://stackoverflow.com/comment/42091929
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26754223
score: 1
has body: I'm using Jackson 2.4 to convert POJOs to/from Maps. I wrote a small test program as below. import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Map; public class TestObjectMapper { private Object byteVal; private Object shortVal; private Object intVal; private Object longVal; private Object floatVal; private Object doubleVal; public TestObjectMapper() { byteVal = (byte) 127; shortVal = (short) 255; intVal = 10; longVal = 20L; floatVal = 1.2F; doubleVal = 1.4; System.out.println("Constructor"); System.out.println("byteVal.getClass() = " + byteVal.getClass()); System.out.println("shortVal.getClass() = " + shortVal.getClass()); System.out.println("intVal.getClass() = " + intVal.getClass()); System.out.println("longVal.getClass() = " + longVal.getClass()); System.out.println("floatVal.getClass() = " + floatVal.getClass()); System.out.println("doubleVal.getClass() = " + doubleVal.getClass()); System.out.println(); } public Object getByteVal() { return byteVal; } public Object getShortVal() { return shortVal; } public Object getIntVal() { return intVal; } public Object getLongVal() { return longVal; } public Object getFloatVal() { return floatVal; } public Object getDoubleVal() { return doubleVal; } public static void main(String[] args) { ObjectMapper mapper = new ObjectMapper(); TestObjectMapper t = new TestObjectMapper(); Map map = mapper.convertValue(t, Map.class); System.out.println("map = " + map); System.out.println(); for (Object key : map.keySet()) { System.out.format("map.get(\"%s\").getClass() = %s\n", key, map.get(key).getClass()); } String k = "byteVal"; System.out.format("((Integer) map.get(\"%s\")).byteValue() = %d\n", k, ((Integer) map.get(k)).byteValue()); k = "floatVal"; System.out.format("((Double) map.get(\"%s\")).floatValue() = %f\n", k, ((Double) map.get(k)).floatValue()); } } which generates the following output: Constructor byteVal.getClass() = class java.lang.Byte shortVal.getClass() = class java.lang.Short intVal.getClass() = cla…
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/25076030
tagged with: java
has title: Java Jackson default type mapping
has comment: http://stackoverflow.com/comment/42089298
tagged with: types
answer count: 1
downvote count: 0
tagged with: jackson

libgdx
tags question: http://stackoverflow.com/q/26692078
tags question: http://stackoverflow.com/q/26789219
tags question: http://stackoverflow.com/q/26764046
tag name: libgdx
tags question: http://stackoverflow.com/q/26797620
tags question: http://stackoverflow.com/q/26714842
tags question: http://stackoverflow.com/q/26744201
tags question: http://stackoverflow.com/q/26831425
tags question: http://stackoverflow.com/q/26727136
tags question: http://stackoverflow.com/q/26831389
tags question: http://stackoverflow.com/q/26789377
tags question: http://stackoverflow.com/q/26792133
tags question: http://stackoverflow.com/q/26680014
tags question: http://stackoverflow.com/q/26789568
tags question: http://stackoverflow.com/q/26826668
tags question: http://stackoverflow.com/q/26751739
tags question: http://stackoverflow.com/q/26825360
type: Tag
tags question: http://stackoverflow.com/q/26703765
tags question: http://stackoverflow.com/q/26771358
tags question: http://stackoverflow.com/q/26782787
tags question: http://stackoverflow.com/q/26676636
tags question: http://stackoverflow.com/q/26733103
tags question: http://stackoverflow.com/q/26711047
tags question: http://stackoverflow.com/q/26721442
tags question: http://stackoverflow.com/q/26742027
tags question: http://stackoverflow.com/q/26828257
tags question: http://stackoverflow.com/q/26729213
tags question: http://stackoverflow.com/q/26756456
tags question: http://stackoverflow.com/q/26755790
tags question: http://stackoverflow.com/q/26690547
tags question: http://stackoverflow.com/q/26765655
tags question: http://stackoverflow.com/q/26784561
tags question: http://stackoverflow.com/q/26703134
tags question: http://stackoverflow.com/q/26684275
tags question: http://stackoverflow.com/q/26701358
tags question: http://stackoverflow.com/q/26771832
tags question: http://stackoverflow.com/q/26826347
tags question: http://stackoverflow.com/q/26733301
tags question: http://stackoverflow.com/q/26822134

http://stackoverflow.com/comment/42103828
has text: public void runNew (Runnable pkt){ threadPool.execute(pkt); } , and _threadPool = new ThreadPoolExecutor(10, 10, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
type: QuestionComment
comment on: http://stackoverflow.com/q/26756688
type: Comment
score: 0

http://stackoverflow.com/q/26817348
tagged with: java
has answer: http://stackoverflow.com/a/26817506
score: 0
answer count: 2
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/26817506
has title: getting NullPointerException and don't know why. war game
type: AnsweredQuestion
has body: I'm writing the card game "war". my classes: Main DeckOfCards and Card: import java.util.*; public class DeckOfCards { private ArrayList&lt;Card&gt; deck; private static final Random randomNumbers=new Random(); public DeckOfCards() { deck=new ArrayList&lt;Card&gt;(); } public DeckOfCards(int cardsFaces) //normal deck has 4 faces { deck=new ArrayList&lt;Card&gt;(); for (int i=0;i&lt;cardsFaces;i++) for (int j=2;j&lt;=14;j++) { deck.add(new Card(j)); } } public void shuffle() { for(int first=0;first&lt;deck.size();first++) { int second =randomNumbers.nextInt(deck.size()-1); Card temp=deck.get(first); deck.set(first, deck.get(second)); deck.set(second, temp); } } public Card dealCard() { if (deck.isEmpty()) { System.out.println("trying to deal from empty deck"); return null; } else return deck.remove(0); } public ArrayList&lt;Card&gt; getDeck() { return deck; } public String toString() { String s=""; for (int i=0;i&lt;deck.size();i++) { s=s+deck.get(i)+" "; } return s; } public boolean isEmpty() { return (deck.isEmpty()); } public void addCard(Card c) { deck.add(c); } public int size() { return deck.size(); } } public class Card { private int value;//2-14 , 14 is ace. public Card(int value) { this.value=value; } public int getValue() { return value; } public String toString() { return Integer.toString(value); } } public class Main { public static void main(String[] args) { DeckOfCards gameDeck =new DeckOfCards(1); gameDeck.shuffle(); DeckOfCards p1Deck=new DeckOfCards();//player 1 deck DeckOfCards p2Deck=new DeckOfCards(); //player 2 deck DeckOfCards sideDeck=new DeckOfCards(); Card p1Card; Card p2Card; boolean gameOver=false; while(!gameDeck.isEmpty()) //dealing cards to players { p1Deck.addCard(gameDeck.dealCard()); p2Deck.addCard(gameDeck.dealCard()); } while(gameOver==false) { p1Card=p1Deck.dealCard(); p2Card=p2Deck.dealCard(); System.out.println("p1card="+p1Card.getValue()+" p2card="+p2Card.getValue()); if(p1Card.getValue()&gt;p2Card.getValue()) //player 1 won the…
has comment: http://stackoverflow.com/comment/42205254
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26817486
accepted answer: http://stackoverflow.com/a/26817486
type: Question
linked to: http://stackoverflow.com/q/218384

http://stackoverflow.com/a/26740762
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26740604
has body: "the I can't know which column was clicked when in handler." What about JTableHeader#columnAtPoint(Point point)? (i.e. MouseEvent.getPoint) Returns the index of the column that point lies in, or -1 if it lies out of bounds
type: Answer

http://stackoverflow.com/q/26771984
type: Question
has title: Using Scrapy inside Java?
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: python
has answer: http://stackoverflow.com/a/26773548
has body: This is a follow up question to this: Basically, I have a java applet that is running in a browser, and I want it to scrape a few pages. Is there a way to get all the benefits of python-driven scrapy using Java? (And to throw an extra spanner in the works, I'm developing on a Windows machine... this is my first time trying to use Python, so I have no idea what the limitations are when considering using them together. Perhaps there is a better way to scrape using Java?)
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/13532170
tagged with: scrapy

http://stackoverflow.com/comment/42091527
comment on: http://stackoverflow.com/q/26752874
score: 0
type: Comment
type: QuestionComment
has text: Yes, you're right.. the problem is the unmarshal. When read the xml, in the object B doesn't put the reference to A. To persit correctly a bidirectional relationship you must add in both side the objects. In few words, when you try to persist in the instances of B there isn't the referenct to A.

http://stackoverflow.com/q/26753498
downvote count: 1
type: Question
has title: Java Regex : How to skip in between text while forming groups?
score: -1
upvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/17290916
tagged with: regex
has answer: http://stackoverflow.com/a/26753577
has body: How can i parse "dd-MM-yyyy hh:mm:ss" from following multiline entry ? Data:11-11-2011 Time:01:01:00 1) So as to parse "11-11-2011 T 01:01:00" we can use simple date format as "dd-MM-yyyy 'T' hh:mm:ss". But how can we introduce '\n' char in above mentioned example ? 2) Or else please help me defining a java REGEX pattern, which will evaluate to "11-11-2011 01:01:00" and will ignore the "newline and Time:" string in above example.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42138896
has text: if (min.getfName().compareTo(array[j].getfName()) > 0){ . In this line what if min.getfName() is null ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26780643

http://stackoverflow.com/q/26761570
type: Question
has body: I am trying to get the localtimezone using TimeZone.getDefault(), server is running in CST Timezone but whenever i execute the below piece of code, i am getting the output as "Wed Nov 5, 2014 03:52:22 PM GMT" but i need the timezone in CST. Is there something wrong with my code? SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy hh:mm:ss zzz"); Date dtTimeStamp = dateFormat.parse((String) map.get("TimeStamps")); SimpleDateFormat dateFormat2 = new SimpleDateFormat("E MMM d, yyyy hh:mm:ss a zzz"); TimeZone tzDefault = TimeZone.getDefault(); dateFormat2.setTimeZone(tzDefault); dateFormat2.format(dtTimeStamp);
has title: TimeZone issue in my java code
has answer: http://stackoverflow.com/a/26763029
tagged with: date
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26761872
favorite count: 0
tagged with: datetime
score: -1
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42104531
has comment: http://stackoverflow.com/comment/42106436
downvote count: 1

http://stackoverflow.com/a/26751029
answers question: http://stackoverflow.com/q/26750916
type: Answer
accepted answer of: http://stackoverflow.com/q/26750916
upvote count: 4
downvote count: 0
score: 4
type: AcceptedAnswer
has body: As Eran commented that totally depends on what someFunction(); returns .Both ArrayList&lt;E&gt; and LinkedList implements List interface . You can try , System.out.println("" + listExample.getClass()); to find out the which has been implemented. From docs, public final Class&lt;?&gt; getClass() Returns the runtime class of this Object. The returned Class object is the object that is locked by static synchronized methods of the represented class.

http://stackoverflow.com/q/26703906
tagged with: solaris
has title: Parse Unix Command Output in Java
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42002982
favorite count: 0
has comment: http://stackoverflow.com/comment/42009319
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42002943
tagged with: unix
has comment: http://stackoverflow.com/comment/42163167
answer count: 0
upvote count: 1
type: Question
has body: I am executing the finger -m command in Unix. It returns the output as below. Login Name TTY Idle When Where Sam Sam D S pts/2 Sun 13:25 10.xxx.xxx.xx Peter Peter M Thomas pts/1 58 Sun 12:25 10.xxx.xxx.xx How do I parse this in a Java program? There is a space and tab, both combinations, in the output of the command. Also the output produced is not unique with the space and tab as between login and name it returns space but between other its tab. Is there a way we can display the output which results only tab so we can ignore the space and process.
has comment: http://stackoverflow.com/comment/42117931
tagged with: java
has comment: http://stackoverflow.com/comment/42042255

string
tags question: http://stackoverflow.com/q/26693369
tags question: http://stackoverflow.com/q/26789327
tags question: http://stackoverflow.com/q/26741701
tags question: http://stackoverflow.com/q/26749777
tags question: http://stackoverflow.com/q/26779497
tags question: http://stackoverflow.com/q/26819671
tags question: http://stackoverflow.com/q/26798262
tags question: http://stackoverflow.com/q/26722772
tags question: http://stackoverflow.com/q/26813935
tags question: http://stackoverflow.com/q/26728654
tags question: http://stackoverflow.com/q/26705806
tags question: http://stackoverflow.com/q/26805873
tags question: http://stackoverflow.com/q/26794630
tags question: http://stackoverflow.com/q/26784319
tags question: http://stackoverflow.com/q/26825650
tags question: http://stackoverflow.com/q/26816385
tags question: http://stackoverflow.com/q/26682595
tags question: http://stackoverflow.com/q/26673217
tags question: http://stackoverflow.com/q/26746231
tags question: http://stackoverflow.com/q/26820668
tags question: http://stackoverflow.com/q/26787148
tags question: http://stackoverflow.com/q/26741595
tags question: http://stackoverflow.com/q/26730918
tags question: http://stackoverflow.com/q/26717079
tags question: http://stackoverflow.com/q/26699172
tags question: http://stackoverflow.com/q/26786625
tags question: http://stackoverflow.com/q/26755361
tags question: http://stackoverflow.com/q/26769199
tags question: http://stackoverflow.com/q/26755820
tags question: http://stackoverflow.com/q/26777513
tags question: http://stackoverflow.com/q/26771276
tags question: http://stackoverflow.com/q/26825190
tags question: http://stackoverflow.com/q/26773491
tags question: http://stackoverflow.com/q/26813533
tags question: http://stackoverflow.com/q/26786347
tags question: http://stackoverflow.com/q/26710834
tags question: http://stackoverflow.com/q/26791441
tags question: http://stackoverflow.com/q/26699317
tags question: http://stackoverflow.com/q/26729105
tags question: http://stackoverflow.com/q/26822258
tags question: http://stackoverflow.com/q/26681281
tags question: http://stackoverflow.com/q/26726449
tags question: http://stackoverflow.com/q/26812399
tags question: http://stackoverflow.com/q/26811636
tags question: http://stackoverflow.com/q/26742020
tags question: http://stackoverflow.com/q/26796419
tags question: http://stackoverflow.com/q/26817414
tag name: string
tags question: http://stackoverflow.com/q/26755647
tags question: http://stackoverflow.com/q/26758678
tags question: http://stackoverflow.com/q/26794275
tags question: http://stackoverflow.com/q/26687573
tags question: http://stackoverflow.com/q/26824672
tags question: http://stackoverflow.com/q/26784036
tags question: http://stackoverflow.com/q/26722140
tags question: http://stackoverflow.com/q/26676816
tags question: http://stackoverflow.com/q/26816474
tags question: http://stackoverflow.com/q/26709428
tags question: http://stackoverflow.com/q/26702095
tags question: http://stackoverflow.com/q/26814315
tags question: http://stackoverflow.com/q/26745736
tags question: http://stackoverflow.com/q/26708394
tags question: http://stackoverflow.com/q/26740063
tags question: http://stackoverflow.com/q/26673641
tags question: http://stackoverflow.com/q/26746658
tags question: http://stackoverflow.com/q/26714126
tags question: http://stackoverflow.com/q/26703332
tags question: http://stackoverflow.com/q/26780114
tags question: http://stackoverflow.com/q/26678516
tags question: http://stackoverflow.com/q/26750963
tags question: http://stackoverflow.com/q/26754502
tags question: http://stackoverflow.com/q/26737802
tags question: http://stackoverflow.com/q/26773042
tags question: http://stackoverflow.com/q/26778958
type: Tag
tags question: http://stackoverflow.com/q/26800445
tags question: http://stackoverflow.com/q/26724764
tags question: http://stackoverflow.com/q/26747281
tags question: http://stackoverflow.com/q/26808062
tags question: http://stackoverflow.com/q/26735276

http://stackoverflow.com/a/26709186
answers question: http://stackoverflow.com/q/26709026
score: 0
type: Answer
has body: Most likely your code is like this : public class Temp extends SuperTemp { // subclass static { System.out.println("Initializing Temp"); } } class SuperTemp { // super class static int i = 0; static { System.out.println("Initializing SuperTemp"); } } class SomeOtherClass { public static void main(String[] args) { System.out.println(Temp.i); // from some other class you are calling SubClass.superClassField } } O/P : Initializing SuperTemp 0 The reason : During Runtime Temp.i will be resolved to SuperTemp.i by the JVM. So, Temp will be loaded but not initialized. Looking at the way classes are loaded : O/P of java -verbose:class [Loaded SomeOtherClass from file XXXX] [Loaded SuperTemp from file XXXX] [Loaded Temp from file XXXX] Initializing SuperTemp 0

http://stackoverflow.com/q/26752663
answer count: 1
tagged with: http://stackoverflow.com/tag/pdf
has body: I am using java and iText to create a pdf. Is it possible to add a map with a pointer on it so the user will know where the starting point is? Clarification (from a meanwhile deleted answer by the OP which should have been an edit of the question) my problem is can i add at iText google map from web and not as an image
favorite count: 0
has title: Adding maps at iText Java
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42088604
score: 2
has answer: http://stackoverflow.com/a/26758842
tagged with: java
tagged with: itext
type: Question
tagged with: google-maps
has comment: http://stackoverflow.com/comment/42130001
downvote count: 0

http://stackoverflow.com/a/26693010
has comment: http://stackoverflow.com/comment/41981627
has comment: http://stackoverflow.com/comment/41981694
has comment: http://stackoverflow.com/comment/41981818
has comment: http://stackoverflow.com/comment/41981732
has comment: http://stackoverflow.com/comment/41982513
has comment: http://stackoverflow.com/comment/41981929
score: 0
answers question: http://stackoverflow.com/q/26692919
has comment: http://stackoverflow.com/comment/41981886
type: Answer
has body: You could use db4o for persisting your data. Its an object-database with a spimple api to use. You can store java object read or delete them.. Download it here DB4O And use the snippets of this tutorial (GER):Tutorial in German Here is an example: and Code: package db4o.example; public class Student { String name; public Student(String name) { this.name = name; } @Override public String toString() { return "Student Name: " + name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } package db4o.example; import java.util.List; import com.db4o.Db4oEmbedded; import com.db4o.ObjectContainer; public class Main { public static void main(String[] args) { ObjectContainer db = Db4oEmbedded.openFile("F:\\studentDB"); saveExample(db); readAllExample(db); readExample(db); deleteAllExample(db); db.close(); } private static void deleteAllExample(ObjectContainer db) { System.out.println("DeleteAllExample Example:"); List&lt;Student&gt; allStudents =readAllExample(db); for (Student student : allStudents) { db.delete(student); } db.commit(); } private static List&lt;Student&gt; readAllExample(ObjectContainer db) { System.out.println("ReadAllExample Example:"); List&lt;Student&gt; allStudents = db.query(Student.class); System.out.println("Count: " + allStudents.size()); for (Student student : allStudents) { System.out.println(student); } return allStudents; } private static void readExample(ObjectContainer db) { System.out.println("ReadExample Example:"); Student queryStudent = new Student("Max Mustermann"); // Gets all Students named Max Mustermann List&lt;Student&gt; students = db.queryByExample(queryStudent); System.out.println("Count: " + students.size()); for (Student student : students) { System.out.println(student); } } private static void saveExample(ObjectContainer db) { System.out.println("Save Example:"); Student myStudent = new Student("Max Mustermann"); db.store(myStudent); db.commit(); } }

http://stackoverflow.com/q/26770007
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26770198
type: Question
has title: How do you replicate this java interface in Swift?
has comment: http://stackoverflow.com/comment/42122041
tagged with: ios
answer count: 1
has comment: http://stackoverflow.com/comment/42120715
favorite count: 0
accepted answer: http://stackoverflow.com/a/26770198
has body: I know in swift you use protocols, but you can't instantiate a protocol by itself like you can do with an interface in java. Here is an example in Java restartGameButton.setOnClickListener(new GuiClickListener() { @Override public void onClick(float x, float y) { // TODO Auto-generated method stub restartScene(); //I can put whatever code I want in here. //This is great because I can embed this inside of another class //like a game scene. } }); Inside restartGameButton I have a variable that just holds the interface. In the setOnClickListener() I can create a new interface instance with the onClick() method asking to be implemented and pass it to restartGameButton. This allows you to add whatever code you want in the onClickMethod. How can you do this in Swift? Swift only seems to allow you use a protocol as essentially an exstention of an object...not cool.
upvote count: 3
downvote count: 1
tagged with: swift
score: 2
has comment: http://stackoverflow.com/comment/42120684

http://stackoverflow.com/comment/41993427
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26699178
has text: Check out this topic. It should be pretty informative: http://stackoverflow.com/questions/14450538/using-javas-referencequeue
type: Comment

http://stackoverflow.com/comment/42692932
comment on: http://stackoverflow.com/a/26950325
has text: Did that work for you? If not, you can create a new issue at the browsermob github page.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26801958
downvote count: 0
tagged with: websocket
favorite count: 0
tagged with: embedded-jetty
has body: I saw another question like this on StackOverflow, but the answers he got were pretty, rediculous. "Connect to the localhost." -- Like, okay. Anyway, the problem is I finally got my embedded Jetty server to compile and run, the problem was since I'm using it in an API i needed the sources, instead of just the dependency. I'm running the most basic hello-world code right now, and the server is starting, but none of my browsers can form a connection. Here's the code: try { httpServer = new Server(8080); httpServer.setHandler(new JettyPage()); httpServer.start(); } catch(Exception e) { e.printStackTrace(); } Naturally, here's JettyPage.java: public class JettyPage extends AbstractHandler { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html;charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); baseRequest.setHandled(true); response.getWriter().println(" Hello world. "); } } The output in the console: 2014-11-07 07:01:05.155:INFO::main: Logging initialized @599ms 2014-11-07 07:01:05.190:INFO:oejs.Server:main: jetty-9.3.0.M1 2014-11-07 07:01:05.215:INFO:oejs.ServerConnector:main: Started ServerConnector@6e5e91e4{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} 2014-11-07 07:01:05.215:INFO:oejs.Server:main: Started @660ms Firefox: The connection was reset Opera: No data received Chrome: No data received --- Yes, I am connecting to localhost:8080 I've also tried: 0.0.0.0:8080 and 127.0.0.1:8080 Note: If I disable my apache server that's running on port 80, and bind Jetty to port 80, I still can't connect.
type: UnansweredQuestion
tagged with: jetty
has title: Browser can't connect to Jetty server
has answer: http://stackoverflow.com/a/28633630
has answer: http://stackoverflow.com/a/26802898
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/32103885
score: 4
tagged with: servlets
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/117925952

http://stackoverflow.com/q/26710853
tagged with: maven-profiles
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/42013443
has body: I am new to Maven and I'm trying to make some improvements on an existing project. I am sure there's an efficient way to build a profile with parameters or somehow reduce the lines size of the tasks. The current profiles are built like this one: green com.smart.soapui soapui-pro-maven-plugin 5.1.2 resources/api/API-NEW-automation.xml true sanity-api true HTML target message=Running API Sanity test maven-antrun-plugin validate run <delete file="src/main/resources/config.properties" /> <copy file="src/main/resources/green/config.properties" tofile="src/main/resources/config.properties" /> <delete file="src/main/resources/TestData.properties" /> <copy file="src/main/resources/green/TestData.properties" tofile="src/main/resources/TestData.properties" /> <delete file="src/main/resources/loginTestData.csv" /> <copy file="src/main/resources/green/loginTestData.csv" tofile="src/main/resources/loginTestData.csv" /> <delete file="src/main/resources/browsingTestData.csv" /> <copy file="src/main/resources/green/browsingTestData.csv" tofile="src/main/resources/browsingTestData.csv" /> <delete file="src/main/resources/endUsersDetails.csv" /> <copy file="src/main/resources/green/endUsersDetails.csv" tofile="src/main/resources/endUsersDetails.csv" /> Since every profile has these tasks (and there are more than shown here) I though of using a generic code. Did any of you have experienced something like that? Thanks.
tagged with: pom.xml
has title: How can I minimize Maven POM.XML file
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/26711307
tagged with: parameters
tagged with: java
has comment: http://stackoverflow.com/comment/42014754

http://stackoverflow.com/comment/42084505
score: 0
comment on: http://stackoverflow.com/q/26749480
has text: I suggest Conn's URL http://stackoverflow.com/questions/4391720/how-can-i-get-a-resource-content-from-a-static-context
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42216361
has text: Have you looked at the manager application ? It gives you a list of sessions, with some additional info.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26823640
score: 0

http://stackoverflow.com/a/26768716
accepted answer of: http://stackoverflow.com/q/26768523
upvote count: 11
has body: Yes, there is such a thing as JavaFX virtual keyboard in the Oracle Java 8 distribution, though it is not documented or supported by Oracle outside of the embedded version of JavaFX. However, the virtual keyboard does seem to ship with the Oracle desktop Java 8 JRE and it does seem to work there if you toggle some undocumented and unsupported system properties. Try: -Dcom.sun.javafx.isEmbedded=true And maybe also -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx Some related sketchy info on the internet: Activating touch-enabled controls in JavaFX JavaFX 8 Embedded Mode Oracle JavaFX forum post. JavaFX WebView / WebEngine show on-screen-keyboard automatically for each text input The guys over at javafxports might know more, so you could try asking there if you want more information (if you are targeting one of their devices).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26768523
has comment: http://stackoverflow.com/comment/42119233
type: Answer
score: 11

http://stackoverflow.com/comment/42188312
has text: If you have a bunch of classes that all define the same static method, you can't call it polymorphically, which means that you'd have to call `Zerkling.countHowMany()`, `OtherUnit.countHowMany()`, `YetSomethingElse.countHowMany()`, explicitly in your code. Or did you have any other thought for how you plan to do this?
type: Comment
comment on: http://stackoverflow.com/q/26807630
score: 0
type: QuestionComment

http://stackoverflow.com/a/26815694
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26815677
upvote count: 5
has body: You need to create a new LinkedList before adding images to it Right now you are merely declaring a pointer to it, so img is probably something like null when you try to add to it. img = new LinkedList&lt;BufferedImage&gt;();
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/26815677

http://stackoverflow.com/comment/42230793
score: 0
has text: i thinks error is already solved via my answer, why have you hold the question. the question.
comment on: http://stackoverflow.com/q/26829514
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42066606
comment on: http://stackoverflow.com/a/26740258
type: AnswerComment
score: 0
type: Comment
has text: @fge: Why do you think it's possible for enums?

http://stackoverflow.com/comment/42004326
type: Comment
type: QuestionComment
has text: ok now I see where this is going. In this case I would add the two fields in the TypeAndSize class and just not use them, if the type is not "shark"
comment on: http://stackoverflow.com/q/26705387
score: 0

http://stackoverflow.com/q/26816931
has answer: http://stackoverflow.com/a/26816958
has title: How to take single input in java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26816945
type: AnsweredQuestion
has body: I'm trying to take input by using code int rs=Integer.parseInt(args[0]); but it throw exception ArrayOutOfBondException. Please help me code is below.I need to take input only one time in commandline argument package techgig; import java.util.*; public class Techgig { public static int ta[]={1,12,5,111,200,1000,10,9,6,7,4}; public static void main(String[] args) { Vector v = new Vector(); // TODO code application logic here System.out.println("Amount Mark has:"); System.out.println("=============================");//here is the code int rs=Integer.parseInt(args[0]); // int rs=50; System.out.print("==============================="); //int a=0; int count=0; int min=0,temp,totalamount=0; System.out.print("\nToys Available:{"); for(int a=0;a&lt;ta.length;a++) { if(a!=0) { System.out.print(","); } System.out.print(ta[a]); } System.out.print("}\n"); System.out.println("Buy Maximum toys with maximum left"); for(int i=0;i&lt;ta.length;i++) { // System.out.print("\t"+ ta[i]); for( int j=i+1;j&lt;ta.length;j++) { if(ta[j]&lt;ta[i]) { temp=ta[j]; ta[j]=ta[i]; ta[i]=temp; } // System.out.print("\t"+ ta[i]); } } for(int k=0;k&lt;ta.length;k++) { totalamount=min; // System.out.print("\t"+ ta[k]); min=min+ta[k]; if(min &gt;rs) { break; } count=count+1; v.add(ta[k]); } int sav=0; sav=rs-totalamount; //System.out.println("Amount Mark has:"+rs); System.out.println("Output:{"+v.size()+","+sav+"}"); System.out.println("Explanation"); System.out.println("Maximum number of toys="+v.size()+""+v); System.out.println("Saving="+sav); } }
has comment: http://stackoverflow.com/comment/42204351
tagged with: java
accepted answer: http://stackoverflow.com/a/26816945
has answer: http://stackoverflow.com/a/26816969
type: Question
possible better answer: http://stackoverflow.com/a/26816958

http://stackoverflow.com/a/26684963
has comment: http://stackoverflow.com/comment/41968088
type: Answer
answers question: http://stackoverflow.com/q/26684809
has comment: http://stackoverflow.com/comment/41968132
has body: The key to writing most recursive programs (especially the ones you're given as assignments) is to look for a larger problem that contains a similar but smaller occurrence of the same problem. In your case, the "larger problem" would be to print the 6 lines that start and end with "call number 2". That is, print lines for call numbers 2 through 4. The way to do this is: print the first line that says "call number 2", solve the problem to print the 4 lines for call numbers 3 through 4, and print the last line that says "call number 2". The part in the middle is the smaller occurrence of the same problem. That's going to be the recursive call. Since your larger problem is going to start with "call number 2", and your smaller problem is going to start with the call number that's one higher, I'd recommend arranging things so that you call recurse(n+1) instead of recurse(n-1). If you do that, you'll need a second parameter so that you know when to stop recursing--something like recurse(n+1, last). Hopefully this will be enough to get you thinking on the right track.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41968041
downvote count: 0

http://stackoverflow.com/comment/42009716
comment on: http://stackoverflow.com/a/26708788
has text: @curositykiller Edited. Emphasis added.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26706743
has comment: http://stackoverflow.com/comment/42009939
score: 2
has comment: http://stackoverflow.com/comment/42006486
answers question: http://stackoverflow.com/q/26706321
downvote count: 0
has body: What you are talking about (TypeAndSize.Species.EMPTY) is not a member field of Spicies. When we talk about "member field", it normally implies instance variable (for which it is also possible to write in enum in Java). In the aspect you are asking, you can simply interpret enum being a special shorthand of writing a special class with class constants: enum Foo { A, B; } is similar to class Foo { public static final Foo A = new Foo(); public static final Foo B = new Foo(); private Foo() {} } (There are still a lot of difference between enum and the handcrafted class, but they are not yet your concern)
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26706321
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42006680

http://stackoverflow.com/comment/74788211
comment on: http://stackoverflow.com/q/26826579
type: Comment
has text: Although it's not an answer, and although Java 9 is not final yet; but in Java 9 both java.util.Observer and java.util.Observable are deprecated.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26688636
possible better answer: http://stackoverflow.com/a/26745125
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26745125
accepted answer: http://stackoverflow.com/a/26689440
type: Question
has comment: http://stackoverflow.com/comment/41974509
has comment: http://stackoverflow.com/comment/41974532
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/41974502
score: 5
answer count: 3
has body: I have previously used Hibernate and now I am trying to understand JDBC. I have done loads of research on Spring JDBC but still I could not understand how to create relationships between objects. Assume I have a Product: public class Product { private Long id; private String nam; private Customer customer; //constructor, getters and setters. } and a Customer: public class Customer { private Long id; private String name; private List&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); //constructor, getters and setters } The relationship between Customer and Product is @OneToMany. How to correctly save the product and customer objects in the db using SpringJDBC? Thank you
downvote count: 0
has answer: http://stackoverflow.com/a/26689440
has comment: http://stackoverflow.com/comment/41974385
has comment: http://stackoverflow.com/comment/41974554
favorite count: 0
has comment: http://stackoverflow.com/comment/41974604
tagged with: jdbc
has answer: http://stackoverflow.com/a/26689134
tagged with: spring
has title: Object-mapping in Spring JDBC?

http://stackoverflow.com/comment/41966321
comment on: http://stackoverflow.com/q/26682547
score: 0
has text: i will read about that, thx!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42070006
type: AnswerComment
has text: I think the assumption here is that he wants to make his own for practice.
type: Comment
score: 7
comment on: http://stackoverflow.com/a/26738067

http://stackoverflow.com/comment/42097313
comment on: http://stackoverflow.com/q/26757314
type: Comment
type: QuestionComment
has text: Thanks for tip. By habit I don't use white space but if I ever do I will know why.
score: 0

http://stackoverflow.com/a/26683316
has body: In the folder you're storting the image also create a file called ".nomedia". This will prevent the gallery from showing all images in that folder. If you dont want the whole folder to be excluded. You could prefix the image name with a dot. Example: ".myimagethumb" this wil prevent the gallery from showing your file.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26683141
upvote count: 2
answers question: http://stackoverflow.com/q/26683141

http://stackoverflow.com/comment/42193243
score: 0
has text: Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
type: Comment
comment on: http://stackoverflow.com/q/26809450
type: QuestionComment

http://stackoverflow.com/comment/42187678
has text: You can find the source for this [here](http://commons.apache.org/proper/commons-lang/apidocs/src-html/org/apache/commons/lang3/StringUtils.html) around line 4684.
type: Comment
score: 17
comment on: http://stackoverflow.com/a/26791724
type: AnswerComment

http://stackoverflow.com/comment/42148675
comment on: http://stackoverflow.com/q/26784561
score: 0
type: Comment
type: QuestionComment
has text: i think, you paste code GameWorld.addScore()

http://stackoverflow.com/comment/41960425
has text: @ElliottFrisch `communicate` does read from the buffer, though
type: Comment
comment on: http://stackoverflow.com/q/26680710
score: 0
type: QuestionComment

http://stackoverflow.com/a/26727652
accepted answer of: http://stackoverflow.com/q/26727580
answers question: http://stackoverflow.com/q/26727580
type: Answer
score: 2
upvote count: 2
has body: I see the following two issues: Your first switch should also switch on counter instead of on inputNumber. For the loop surrounding your second switch, you should loop from 1 to 5 instead of 0 to 4. On a side note: better to use a list or array to store your 5 numbers instead of using a separate variable for each.
has comment: http://stackoverflow.com/comment/42043969
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26792189
tagged with: intellij-idea
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm developing plugin for Intellij Idea and doing some tests. In one of my tests I need persisting state to be updated. But it doesn't happens and neither loadState nor getState is called. I wrote class that implements PersistingStateComponent (i think I did it correctly because it's not the first time I did it). In one test I call method that adds data to State class, and it's successfully added but not saved. Another one should get that data, but it gets empty State. Test class implements LightPlatformTestCase. Documentation says : Persistent Component Lifecycle The loadState() method is called after the component has been created (only if there is some non-default state persisted for the component), and after the XML file with the persisted state is changed externally (for example, if the project file was updated from the version control system). In the latter case, the component is responsible for updating the UI and other related components according to the changed state. The getState() method is called every time the settings are saved (for example, on frame deactivation or when closing the IDE). If the state returned from getState() is equal to the default state (obtained by creating the state class with a default constructor), nothing is persisted in the XML. Otherwise, the returned state is serialized in XML and stored. So is it possible that none of these conditions happen? Can I do something in test method to update my persisting state? Or it supposed to work and I should look for issue in my code? Update: When I run plugin it works fine. My class looks like that: @State(name = "MyStateName", storages = {@Storage(id="MyStateId", file = "D:/MyStateName.xml")}) public class MyClass implements PersistentStateComponent&lt;MyClass.State&gt; { public static class State{ Integer someValue = 10; } State myState = new State(); public State getState() { return myState; } public void loadState(State state) { myState = state; } public SFApexClassWrapp getValue() { re…
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42191645
has comment: http://stackoverflow.com/comment/42178733
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27911229
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/42172911
has comment: http://stackoverflow.com/comment/42178819
has comment: http://stackoverflow.com/comment/42188810
has title: How to update persisting state of intellij idea plugin in test class?
tagged with: intellij-plugin

http://stackoverflow.com/comment/42109764
has text: [a-z0-9] removes lowercase and number from string but special character like "!@#" are still there in array so will you please give code to remove all special character
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26731264

http://stackoverflow.com/q/26729799
has comment: http://stackoverflow.com/comment/42050254
tagged with: java
type: Question
tagged with: apache-commons
has answer: http://stackoverflow.com/a/61485016
has answer: http://stackoverflow.com/a/26730109
has comment: http://stackoverflow.com/comment/42050082
has answer: http://stackoverflow.com/a/26734722
has comment: http://stackoverflow.com/comment/50181239
tagged with: apache-commons-csv
has answer: http://stackoverflow.com/a/36330001
has title: Invalid char between encapsulated token and delimiter in Apache Commons CSV library
downvote count: 0
has comment: http://stackoverflow.com/comment/42047581
favorite count: 0
has answer: http://stackoverflow.com/a/34881599
score: 39
has body: I am getting the following error while parsing the CSV file using the Apache Commons CSV library. Exception in thread "main" java.io.IOException: (line 2) invalid char between encapsulated token and delimiter at org.apache.commons.csv.Lexer.parseEncapsulatedToken(Lexer.java:275) at org.apache.commons.csv.Lexer.nextToken(Lexer.java:152) at org.apache.commons.csv.CSVParser.nextRecord(CSVParser.java:450) at org.apache.commons.csv.CSVParser.getRecords(CSVParser.java:327) at parse.csv.file.CSVFileParser.main(CSVFileParser.java:29) What's the meaning of this error ?
upvote count: 39
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/42231760
score: 0
has text: Am I heading for the TumbleWeed-Badge?
comment on: http://stackoverflow.com/q/26821715
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42312538
score: 0
has text: Ah "resampling" is the term I am looking for. Thanks!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26806959

http://stackoverflow.com/comment/41995608
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26700910
has text: Have added the class path in the question. Should I place the jar file in one of the above folder.

http://stackoverflow.com/comment/42150333
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26770207
has text: @Thilo in Linux it usually cleans up although running it privileged all bets are off. Also a leak as a regular user could bring the system to its knees by digging into swap. Windows... I have no idea, depends on the version.
score: 0

http://stackoverflow.com/a/26907693
has body: I found the solution, it was a bug in aSmack, reconnect() method in ReconnectionManager class must by synchronized to avoid this exception, Now I'm using asmack-android-19-0.8.10.jar and it has this fix.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26768841
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26768841
type: AcceptedAnswer

http://stackoverflow.com/a/26744206
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26738582
score: 1
upvote count: 1
has body: I am running a Weblogic server on my local machine on which I am testing my application. It appears that every time you make any changes to a log4j properties file you need to restart the server for changes to take an effect. I was republishing the project without restarting the server. The logger configuration above is working fine for both minute and hour logging. I will test the daily logging tonight, but I am sure that everything will be in order. If anyone is interested, here are my Maven dependencies for the logger: org.slf4j slf4j-api 1.4.2 org.slf4j slf4j-log4j12 1.4.2 org.apache.logging.log4j log4j-slf4j-impl 2.1 org.apache.logging.log4j log4j-core 2.1
accepted answer of: http://stackoverflow.com/q/26738582
type: AcceptedAnswer

http://stackoverflow.com/a/26806437
type: Answer
has comment: http://stackoverflow.com/comment/42187447
has body: You use a native query so your query has to be like this "select * from book where price between ? and ?". If you use a query (jpql) you can do mapping by name. Here you have to mapp by the number of the parameter : query.setParameter(1, 20.0); query.setParameter(2, 30.0); EDIT: for named parameter "Using EclipseLink, you can specify a named parameter in a native query using the EclipseLink # convention." from http://www.eclipse.org/eclipselink/documentation/2.5/concepts/queries006.htm
score: 0
answers question: http://stackoverflow.com/q/26806123
has comment: http://stackoverflow.com/comment/42186994

http://stackoverflow.com/a/26823198
answers question: http://stackoverflow.com/q/26822839
type: Answer
downvote count: 0
has body: Blocking the thread is really a block java uses for example to control multithreaded application. An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code. The worst case of this is Thread.sleep(), which sets the condition to an exact time period to wait. There are some convenience methods provided that help you write code that will wait only as long as required. WebDriverWait in combination with ExpectedCondition is one way this can be accomplished. An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance. You should not use Java's thread.sleep as a replacement for the selenium once, as you could potentially create multithreading errors depending on what else you do within the application. (Deadlocks for example, or race conditions)
score: 1
upvote count: 1

http://stackoverflow.com/a/26832905
type: Answer
has body: Fragmentation can occur at many laters in the protocol. It can occur in IP, with an IP datagram being fragmented into multiple IP datagrams, and it can occur in protocols running atop TCP. The "Don't fragment" bit is an IP bit. The packet segmentation you're seeing is at the TCP layer; that segmentation is completely separate from the fragmentation that happens at the IP layer. IP reassembly is fairly easy to do in a packet analysis program; all the data you need in order to reassemble fragments is available in the IP protocol headers of the fragments. TCP reassembly is NOT as easy to do. The abstraction TCP provides to protocols running on top of TCP is a sequenced stream of octets (bytes); there are no packet boundaries. A packet, or other multi-byte structure, sent over TCP could arbitrarily be broken into TCP segments at any point in the packet. This means that TCP reassembly in a packet analysis program requires that the code that understands TCP segments and the code that understands the protocol running atop TCP to cooperate. See, for example, the tcp_dissect_pdus() routine in Wireshark's packet-tcp.c file, and the code in its req_resp_hdrs.c file.
has comment: http://stackoverflow.com/comment/42261355
answers question: http://stackoverflow.com/q/26830235
score: 0
has comment: http://stackoverflow.com/comment/42243321

http://stackoverflow.com/q/26680858
has comment: http://stackoverflow.com/comment/41960624
has body: I was given a programming problem that given an array, determine if it is a post order traversal of a binary tree. My solution is as follows: public static boolean isPostOrder(int[] array) { int root = array[array.length - 1]; int i = 0; while(array[i] < root) { i++; } while(array[i] > root) { i++; } return i == array.length - 1; } I am trying to understand Big O. I have read this tutorial: What is a plain English explanation of "Big O" notation? However, I am still confused about addition and the while loops. I'm assuming in this case my while loops are O(1) since we are just comparing a value in an array to an integer, or am I wrong about this? Now the addition is also O(1) because we are just adding 1 to some integer 1, right? Therefore, is this an O(1) solution or am I missing something?
has comment: http://stackoverflow.com/comment/41960499
has answer: http://stackoverflow.com/a/26680990
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26680966
has comment: http://stackoverflow.com/comment/41960475
favorite count: 0
tagged with: binary-search-tree
type: UnansweredQuestion
has title: Big-O Analysis - While Loops
tagged with: java
linked to: http://stackoverflow.com/q/487258
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/32869332
has body: I had the same problem and what helped me was to issue a httpget.abort() before closing the InputStream and before issuing EntityUtils.consume(entity). httpget.reset() should have the same effect.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26722404
type: Answer
score: 1

http://stackoverflow.com/q/26830987
has title: How to change name of apache tomcat acess url?
tagged with: java
tagged with: maven-tomcat-plugin
has answer: http://stackoverflow.com/a/27517794
type: Question
tagged with: apache
has answer: http://stackoverflow.com/a/27270072
score: 0
answer count: 2
tagged with: tomcat
type: UnansweredQuestion
has body: I want to change name of Apache tomcat access URL For example:- localhost:8080 I want to change the localhost:8080 to myserver.com:8080 how to do?
has comment: http://stackoverflow.com/comment/42228800
tagged with: tomcat7

http://stackoverflow.com/comment/41991526
type: AnswerComment
has text: I was trying to crack down the implementation of your algorithm and found similarities between your answer and @trooper. Really helped me to understand the concept.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26693934

http://stackoverflow.com/q/26815953
answer count: 1
has body: I can write to the random access file directly after I create it but as soon as I try to write from my function then it breaks. private void openFile() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY ); int result = fileChooser.showSaveDialog( this ); // user clicked Cancel button on dialog if ( result == JFileChooser.CANCEL_OPTION ) { return; } File fileName = fileChooser.getSelectedFile(); if ( fileName == null || fileName.getName().equals( "" ) ) { JOptionPane.showMessageDialog( this, "Invalid File Name", "Invalid File Name", JOptionPane.ERROR_MESSAGE ); } else { // Open the file try { RandomAccessFile output = new RandomAccessFile( fileName, "rw" ); createRecord(); } catch ( IOException e ) { JOptionPane.showMessageDialog( this, "File does not exist", "Invalid File Name", JOptionPane.ERROR_MESSAGE ); } } } private void createRecord() { String firstName = tfdFirst.getText(); String lastName = tfdLast.getText(); String emailAddress = tfdEmail.getText(); String homeAddress = tfdAddress.getText(); Long phoneNumber = new Long(tfdPhone.getText()); char gender = tfdGender.getText().charAt(0); System.out.println(firstName + lastName + emailAddress + homeAddress + phoneNumber + gender); try { output.seek(0); output.writeChar(gender); writeString( output, lastName); writeString( output, firstName); writeString( output, emailAddress); writeString( output, homeAddress); output.writeLong(phoneNumber); } catch(IOException ex) { ex.printStackTrace(); } } Sorry for the wall of code, but those are the two offending functions. The first tries to open a RandomAccessFile called output, before calling createRecord() which tries to write user input from a JFrame to the file. If I put a simple writeInt() function in the place of createRecord() then it works okay but once createRecord() is called it's as if output never existed. I've been working at this for hours to no avail, so if someone could help find a solution I would be …
tagged with: randomaccessfile
has title: NullPointerException When Writing to a RandomAccessFile
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/26815975
has comment: http://stackoverflow.com/comment/42202719
has comment: http://stackoverflow.com/comment/42202734
has comment: http://stackoverflow.com/comment/42202804
has comment: http://stackoverflow.com/comment/42202809
tagged with: swing
has answer: http://stackoverflow.com/a/26815975
type: AnsweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/42117116
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26767906
has text: @awhitesong It depends entirely on the underlying `OutputStream` that the `PrintWriter` prints to. In the case of the `Servlet`, that prints to the `OutputStream` I linked to in my answer. Also, `System.out` is not a `PrintWriter`.
type: AnswerComment

http://stackoverflow.com/a/26804574
type: Answer
has body: From the documentation: Sheet sheet = workbook.getSheetAt(0); sheet.autoSizeColumn(0); //adjust width of the first column sheet.autoSizeColumn(1); //adjust width of the second column
answers question: http://stackoverflow.com/q/26804035
score: 0

http://stackoverflow.com/comment/42124009
score: 0
has text: Hi peeskillet, thanks for answering. I added dependencies into the pom.xml and resolved many errors. but still I have one package missing, which is "org.apache.commons.dbcp", do you know what is the <dependency><dependency/> for it? thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26770991

http://stackoverflow.com/comment/99816072
type: AnswerComment
comment on: http://stackoverflow.com/a/26805320
type: Comment
has text: That is a known issue, modena.css sets only 8 values (see [source](https://github.com/javafxports/openjdk-jfx/blob/4f0addff16de7182752bc60541f44baeb0e99d2a/modules/javafx.controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css#L2750)), but there are already a few solutions like this [one](https://stackoverflow.com/questions/32890539/javafx-stackedbarchart-automatically-reuse-the-same-color-on-different-series-h).
score: 1

http://stackoverflow.com/a/26804921
has body: your error happens at com.rayana.calculator2.MainActivity$1.onClick(MainActivity.java:62) which has the following command at it double result = A+B; there are not the doubles you are looking for
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26804747

http://stackoverflow.com/a/26732142
downvote count: 0
has comment: http://stackoverflow.com/comment/42052160
upvote count: 3
has body: you will need an infinite loop wrapping your "stoppable" loop. because once you leave the loop you have to make sure that you can enter it again.
has comment: http://stackoverflow.com/comment/42051748
type: Answer
answers question: http://stackoverflow.com/q/26732112
has comment: http://stackoverflow.com/comment/42051658
score: 3

http://stackoverflow.com/comment/42212874
score: 0
has text: I just added the stack trace to the question above.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26820922

http://stackoverflow.com/comment/41986725
has text: @Eric @Dyrborg Actually, more like 40%, that was just an estimate. It is reliably 120ms with `break` and 75ms with the size hack.
comment on: http://stackoverflow.com/q/26695869
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26754510
upvote count: 1
type: Question
tagged with: nashorn
has title: Nashorn - debug javascript run in Nashorn
has body: I use eclipse luna as IDE. I'm working in web application. When I code in javascript, sometimes I forget to put semicolon, but everything still work fine if my javascript run in browser. But when I run my javascript in nashorn, it will throw an error because I didn't put semicolon the error say s nashorn Error: :1:68 Expected ; but found var ..... ... ... in at line number 1 at column number 68 The problem is, the console always shows me the error at line number 1, I think because nashorn reads my javascript file as single line, but truthfully my javascript file contains many lines. It is hard to find the error because the console always say the error is in line number 1. I know something is wrong with my code, but I don't know how to fix it. Nashorn.java public class Nashorn { public Nashorn() { } public static String readFileAsText(String theUrl){ String allLine = ""; try { URL url = new URL(theUrl); BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream())); String inputLine = ""; while ((inputLine = in.readLine()) != null){ allLine += inputLine; //System.out.println("read : "+inputLine); } in.close(); } catch (MalformedURLException e) { System.out.println("url Error: "); } catch (IOException e) { System.out.println("I/O Error: "); } return allLine; } public static void main(String[] args) { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(null); ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("nashorn"); try { //readFileAsText String room = Nashorn.readFileAsText("http://localhost:8080/monsterpuzzle/data/Room.js"); scriptEngine.eval( room ); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("nashorn Error: "+e.getMessage()); e.printStackTrace(); } } } Room.js var Room = function(){ this.test = function(){ print("lalala"); }; } var room = new Room(); room.test(); my problem : Nashorn always shows me the error at line number 1. However, the error is not in line number 1 but in anoth…
tagged with: javascript
has comment: http://stackoverflow.com/comment/42093128
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26785467
score: 1
tagged with: java

http://stackoverflow.com/a/26729589
has comment: http://stackoverflow.com/comment/42047208
has body: Congratulations, you put in only one piece of code a lot of bad practices ! You put a lot of scriptlet in JSP. You'd better use a servlet for this processing, and only use JSP for the view (display) part. Servlet are true Java classes and as such are easier to write and test. You concatenate user input strings in a query without using prepared statements (but I acknowledged you noticed it :-) ). Never do that, it is a open trap for SQL injection (just google for it) You store in database cleartext passwords. Good practices recommend to only store a non inversible hash of the password. If the database is compromised, the attacker cannot get passwords. You impose role = '' in the query. I would be very surprised if you ever find an admin role with that ! You use the role for choosing to what page redirect. It is not by itself a bad practice, but it can be if you do not test that user has a valid role in redirected page. Common usage is to have one single page with parts displayed only according to role (&lt;c:if&gt; blocs in JSP). And what means rs.getInt(rolle) ? You get rolle from result set, fine use it directly and test if it is null before doing any rolle.equals(...) (NPE is not far) For the prepared statement, you could do: PreparedStatement st = connection.prepareStatement("select * from users where uname=? and pass=?"); st.setString(1, userid); st.setString(2, pwd); ResultSet rs = st.executeQuery(); That way, not only you are protected from SQL injection, but you get a line from database from userid, pwd whatever the role can be. Edit : After that query, you can still read any attribute from users table : if (rs.next()) { String username = rs.getString("uname"); String email = rs.getString("email"); String rolle = rs.getString("role"); session.setAttribute("customer_name", username); int usser = rs.getInt("id"); session.setAttribute("customer_id", usser); And the tests should be if (rolle == null || role.isEmpty()) { // process no role case first - it deals wi…
type: Answer
has comment: http://stackoverflow.com/comment/42047740
upvote count: 2
has comment: http://stackoverflow.com/comment/42047325
accepted answer of: http://stackoverflow.com/q/26729208
answers question: http://stackoverflow.com/q/26729208
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42119097
comment on: http://stackoverflow.com/q/26769212
score: 0
type: Comment
has text: You have an integer division problem and are assigning the wrong value to `fldCelsius`...
type: QuestionComment

http://stackoverflow.com/a/26800346
type: Answer
has body: You need use an ajax component, something like: Items being added <ui:repeat value="#{itemBean.items}" var="item"> <h:outputLabel value="Item" for="name" /> <h:inputHidden value="#{item.id}" /> <h:inputText id="name" value="#{item.name}" /> <h:commandLink action="#{cargoBean.addItem(item)}"> <f:ajax render="list" /> Add </h:commandLink> </ui:repeat>
answers question: http://stackoverflow.com/q/26800080
has comment: http://stackoverflow.com/comment/42175337
score: 0

http://stackoverflow.com/comment/42200011
has text: A con of int vs. boolean `visited` array: the int array takes more memory, about 4x ([estimated](http://stackoverflow.com/questions/383551/what-is-the-size-of-a-boolean-variable-in-java)) that of a similarly sized boolean array in Java. I see no reason to use an int array.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26813832
score: 0

http://stackoverflow.com/comment/41960953
comment on: http://stackoverflow.com/a/26681135
score: 0
type: AnswerComment
type: Comment
has text: So why It's not working ? When I select RIGHT at my ComboBox, nothing changes. Is my code wrong ? I thought It's about the final declaration.

http://stackoverflow.com/comment/42238514
has text: ok, so that's pretty much how I've attached to the jvm so far (with minor differences). So I guess that brings me to the next question: How do I get a pointer to a jvmtiEnv, in order to call GetStackTrace, if not from a callback? The point is to call that function periodically.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26795511

http://stackoverflow.com/a/26675885
has body: You can use indexOf and equals method of Arraylist. Say for example, you have recordArrayList, record2ArrayList and you want to get record3ArrayList. Now, You need to make one loop for recordArrayList as below. for(Record recordObject: recordArrayList){ Record2 tmpRecord2 = new Record2(); record2.setTheSameKeyAsRecord(recordObject.getTheKeyWhateveer()); Record2 actualRecord2Object= record2ArrayList.indexOf(tmpRecord2); // This will return the actual object from the list. But you need to implement the equals method inside Record2.java. If there is no corresponding object then it returns null. So handle it and continue for the loop. // Now you have both recordObject and actualRecord2Object. You can create object of Record3 and put inside the list. } So at the end of the loop, you would have record3ArrayList which would contains the instance of Record3. If you want to remove the same key object from recordArrayList and record2ArrayList then you can do in above for loop after creating Record3.
answers question: http://stackoverflow.com/q/26674747
type: Answer
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42120664
type: QuestionComment
score: 0
has text: It looks like a circular dependency.
comment on: http://stackoverflow.com/q/26769989
type: Comment

http://stackoverflow.com/comment/42209848
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26820102
has text: Also, does that code compile?? `letter[i].addActionListener = (new ActionListener());` ??

http://stackoverflow.com/q/26826312
has comment: http://stackoverflow.com/comment/42220892
has title: ANSI to UTF-8 through Java : some lines are lost
answer count: 1
downvote count: 0
tagged with: utf-8
favorite count: 0
has body: I wanted to convert some files from ANSI (Arabic) to UTF-8. It works but after the new file is created, it is missing some lines (at the end). Any ideas why? This is the code : public class CustomFileConverter { private static final char BYTE_ORDER_MARK = '\uFEFF'; public void createFile(String inputFile, String outputFile) throws IOException{ FileInputStream input = new FileInputStream(inputFile); InputStreamReader inputStreamReader = new InputStreamReader(input, "windows-1256"); // Arabic char[] data = new char[1024]; int i = inputStreamReader.read(data); if(new File(outputFile).exists()){ new File(outputFile).delete(); } FileOutputStream output = new FileOutputStream(outputFile,true); Writer writer = new OutputStreamWriter(output,"UTF-8"); String text = ""; writer.write(BYTE_ORDER_MARK); while(i !=-1){ String str = new String(data,0,i); text = text+str; i = inputStreamReader.read(data); } // System.out.print(text); It is printed Completely writer.write(text); // File lacks some final lines... output.close(); input.close(); } }
accepted answer: http://stackoverflow.com/a/26826429
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26826429
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42221069
type: Question

http://stackoverflow.com/q/26782670
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/26782701
has comment: http://stackoverflow.com/comment/42142857
downvote count: 1
has comment: http://stackoverflow.com/comment/42142619
type: Question
has body: I'm trying to write this program to retrieve a path / multiple paths in MySQL by a given integer variable titled "NumOfServings". I can't seem to get it to work for some reason: @Path("/recipes/{NumOfServings}") @GET @Produces("text/plain") public String getRecipesByServingSize(@PathParam("NumOfServings") String ourServingSize) throws SQLException, ClassNotFoundException { int checkServingSize = 0; try { checkServingSize = Integer.parseInt(ourServingSize); }catch (NumberFormatException FAIL) { checkServingSize = 1; } String connectStr="jdbc:mysql://localhost:3306/fooddb"; String username="root"; String password="csci330pass"; String driver="com.mysql.jdbc.Driver"; Class.forName(driver); Connection con = DriverManager.getConnection(connectStr, username, password); String sql = "Enter in a Recipe ID from Recipe database, WHERE ID = ?"; PreparedStatement prepStmt = con.prepareStatement(sql); if (ourServingSize &gt;= 6) { prepStmt.setInt(1, ourServingSize); ResultSet rs = prepStmt.executeQuery(); } else { prepStmt.setInt(0, ourServingSize); ResultSet rs = prepStmt.executeQuery(); } String result = ""; while (rs.next()) { int recipeID3 = rs.getInt("RecipeID"); String recipeName3 = rs.getString("RecipeName"); String recipeType3 = rs.getString("RecipeType"); String instructions3 = rs.getString("Instructions"); int amtServings3 = rs.getInt("NumOfServings"); int timeMinutes3 = rs.getInt("TotalTimeInMinutes"); result += "ID: "+recipeID3+ "\n" + "Name: "+recipeName3+ "\n" + "Type: "+recipeType3+ "\n" + "Instructions: "+instructions3+ "\n" + "Total Servings: "+amtServings3+ "\n" + "Total Time: "+timeMinutes3+ "\n" + "\n"; } return result; } I've tried If - Else statements and a while loop, but I can't get it to work without spewing a series of errors at me. What exactly is wrong with this code? What exactly is missing that is causing me these errors?
score: -1
has comment: http://stackoverflow.com/comment/42142999
has comment: http://stackoverflow.com/comment/42142934
upvote count: 0
linked to: http://stackoverflow.com/q/26712370
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42142504
tagged with: web-services
has comment: http://stackoverflow.com/comment/42142644
has comment: http://stackoverflow.com/comment/42143285
has title: Why is it that this java code is not able to retrieve something by a given integer?

http://stackoverflow.com/comment/42042771
comment on: http://stackoverflow.com/q/26727000
score: 0
type: Comment
type: QuestionComment
has text: can you explain back = (back+1) % (MAX_QUEUE);? how u come up with this?

http://stackoverflow.com/q/26727137
type: Question
answer count: 1
downvote count: 0
tagged with: directory
has title: Unable to access folder with full stops in it
favorite count: 0
has comment: http://stackoverflow.com/comment/42043061
has comment: http://stackoverflow.com/comment/42043621
has answer: http://stackoverflow.com/a/26727214
has body: I have the following code which shows a folder without any full stops in it and java successfully detects it as a folder, but if the folder contains any full stops in it, it does not detect it as a folder or even a file even though it exists List&lt;String&gt; files = new ArrayList&lt;String&gt;(); files.add("F:/some dir/"); files.add("F:\\somedir\\some.other.directory.with.full.stops.in.it"); files.add("F:\\somedir\\some.other.directory.with.full.stops.in.it\\"); files.add("F:/somedir/some.other.directory.with.full.stops.in.it"); files.add("F:/somedir/some.other.directory.with.full.stops.in.it/"); files.add("F:\\somedir\\some.other.directory.with.full.stops.in.it\\sub directory"); files.add("F:\\somedir\\some.other.directory.with.full.stops.in.it\\sub directory\\"); files.add("F:/somedir/some.other.directory.with.full.stops.in.it/sub directory"); files.add("F:/somedir/some.other.directory.with.full.stops.in.it/sub directory//"); for(String filePath : files) { File file = new File(filePath); System.out.println("===== " + filePath + " ===== "); System.out.println("IsDirectory = " + file.isDirectory()); System.out.println("IsFile = " + file.isFile()); } and here is the output on my system (windows 8.1 64 bit jre 1.8.0_25) ===== F:/some dir/ ===== IsDirectory = true IsFile = false ===== F:\somedir\some.other.directory.with.full.stops.in.it ===== IsDirectory = false IsFile = false ===== F:\somedir\some.other.directory.with.full.stops.in.it\ ===== IsDirectory = false IsFile = false ===== F:/somedir/some.other.directory.with.full.stops.in.it ===== IsDirectory = false IsFile = false ===== F:/somedir/some.other.directory.with.full.stops.in.it/ ===== IsDirectory = false IsFile = false ===== F:\somedir\some.other.directory.with.full.stops.in.it\sub directory ===== IsDirectory = false IsFile = false ===== F:\somedir\some.other.directory.with.full.stops.in.it\sub directory\ ===== IsDirectory = false IsFile = false ===== F:/somedir/some.other.directory.with.full.stops.in.it/sub …
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42043136
accepted answer: http://stackoverflow.com/a/26727214
has comment: http://stackoverflow.com/comment/42043226

http://stackoverflow.com/q/26734587
has comment: http://stackoverflow.com/comment/42057513
favorite count: 0
tagged with: iso
tagged with: applepay
answer count: 5
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77588321
accepted answer: http://stackoverflow.com/a/26734920
has answer: http://stackoverflow.com/a/26734966
score: 11
has body: I have a an ISO 4217 numeric currency code: 840 I want to get the currency name: USD I am trying to do this: Currency curr1 = Currency.getInstance("840"); But I keep getting java.lang.IllegalArgumentException how to fix? any ideas?
type: Question
has answer: http://stackoverflow.com/a/54098389
has title: convert iso 4217 numeric currency code to currency name
has comment: http://stackoverflow.com/comment/42056165
tagged with: java
possible better answer: http://stackoverflow.com/a/54098389
has comment: http://stackoverflow.com/comment/42055907
has comment: http://stackoverflow.com/comment/42056177
has answer: http://stackoverflow.com/a/53464146
downvote count: 0
has answer: http://stackoverflow.com/a/26734920

http://stackoverflow.com/a/26810458
answers question: http://stackoverflow.com/q/26810323
accepted answer of: http://stackoverflow.com/q/26810323
has body: In Java, calling repaint erases all drawn elements on screen (other than Swing Components). This means that calling getContentPane().setBackground(Color.RED) is only visible until the frame is repainted (which you do right away). To prevent this, it is good practice to call super.paint(g) at the start of the paint method, as this allows the JFrame to render visuals like background color before drawing. You could also consider using setColor(Color.RED) followed by clearRect(x, y, width, height) to change the background color. However, this is probably less efficient.
has comment: http://stackoverflow.com/comment/42194413
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42194375
score: 0
type: Answer

http://stackoverflow.com/comment/42090944
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26750806
type: AnswerComment
has text: Are you sure you are getting values correctly from EditText ? did you tried placing Log to see if values you are getting for x1,x2,x3 are as expected ? your for loop is also using x instead of income array to check the length see if its the problem.

http://stackoverflow.com/comment/42063667
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26738821
has text: yes ' ' did i need reset.css ?
type: Comment

http://stackoverflow.com/comment/42101228
comment on: http://stackoverflow.com/q/26759737
has text: Ahhhh, great solve, @hfontanez. You got it!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42043461
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26712659
type: Comment
has text: I think the question is misunderstood, Say if i have 1000 files[file names can be anything] and i want to restrict getting the files name like i will give starting Number and ending number. like 1 to 20 and i want to load those 20 files alone.

http://stackoverflow.com/q/26820378
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26820456
has title: How to make Java regex to replace non-alphabetic signs and add underscores in Java class names?
tagged with: non-alphanumeric
tagged with: regex
type: AnsweredQuestion
has body: I am generating Java classes from input which represents some model language. Customer who creates input models, doesn´t care about Java, so sometimes I get this kind of names of classes: 1) Struct+ 2) Controller: 3) * Obviously, this is not compilable. I would need some nice regex for this to generate something like this: 1) Struct_more 2) Controller_prefix 3) All Could you please help me to sort out regex for this input? I want to underscore in between and replace non-alphabetic signs with something meaningfull and valid. Thanks
has comment: http://stackoverflow.com/comment/42210435
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26820456
tagged with: replace

http://stackoverflow.com/comment/42072170
type: QuestionComment
comment on: http://stackoverflow.com/q/26741856
has text: @jalopaba: thanks for the information! I'll delete my erroneous comment.
score: 0
type: Comment

http://stackoverflow.com/q/26692919
has answer: http://stackoverflow.com/a/26693010
has comment: http://stackoverflow.com/comment/41981570
answer count: 2
downvote count: 0
has title: How do I store information from methods to be used in another session?
has comment: http://stackoverflow.com/comment/41981537
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26693037
has body: So I'm making a program that will store the meetings I've had with some kids I'm tutoring. It'll keep tabs on the meeting times, discussions, and how many hours I've done. I know how to write all the methods to do that, but my issue is that the program will only hold that information for the session that the program is open... how would I go about storing this information and accessing it after the program is closed and opened again? This is some excerpts from a test score keeper program I did in java class that has this same issue... public class Student { private String name; private int test1; private int test2; private int test3; public Student() { name = ""; test1 = 0; test2 = 0; test3 = 0; } public Student(String nm, int t1, int t2, int t3){ name = nm; test1 = t1; test2 = t2; test3 = t3; } public Student(Student s){ name = s.name; test1 = s.test1; test2 = s.test2; test3 = s.test3; } public void setName(String nm){ name = nm; } public String getName (){ return name; } public void setScore (int i, int score){ if (i == 1) test1 = score; else if (i == 2) test2 = score; else test3 = score; } public int getScore (int i){ if (i == 1) return test1; else if (i == 2) return test2; else return test3; } public int getAverage(){ int average; average = (int) Math.round((test1 + test2 + test3) / 3.0); return average; } public int getHighScore(){ int highScore; highScore = test1; if (test2 &gt; highScore) highScore = test2; if (test3 &gt; highScore) highScore = test3; return highScore; } public String toString(){ String str; str = "Name: " + name + "\n" + //\n makes a newline "Test 1: " + test1 + "\n" + "Test 2: " + test2 + "\n" + "Test 3: " + test3 + "\n" + "Average: " + getAverage(); return str; } }
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26693037
has comment: http://stackoverflow.com/comment/41981450
possible better answer: http://stackoverflow.com/a/26693010

http://stackoverflow.com/comment/42073063
score: 0
type: QuestionComment
has text: What is `minDistance`? Where do you initialize it?
type: Comment
comment on: http://stackoverflow.com/q/26743595

http://stackoverflow.com/q/26691399
score: 0
answer count: 1
has title: Java Servlets session.getAttribute and setAttribute
has answer: http://stackoverflow.com/a/26691773
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: session
accepted answer: http://stackoverflow.com/a/26691773
tagged with: servlets
has body: I was trying to make a counter for the get requests of each session and I finally made it, however, I have a question in order to get to the bottom of the logic how this works. Here is my code: public class FirstServlet extends HttpServlet { private static final long serialVersionUID = 1L; final String COUNTER = "Counter"; /** * @see HttpServlet#HttpServlet() */ public FirstServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); PrintWriter out = resp.getWriter(); int count = 1; Integer i = (Integer) session.getAttribute(COUNTER); if(i != null){ count = i.intValue() +1; } session.setAttribute(COUNTER, new Integer(count)); out.println(" "); out.println(" "); out.println(" Session Counter "); out.println(" "); out.println(" "); out.println("Your session ID is " + session.getId()); out.println(" and you have hit this page " + count + " time(s) during this browser session"); } Here are the questions: Integer i = (Integer) session.getAttribute(COUNTER); if(i != null){ count = i.intValue() +1; } Since I'm making Integer i and then casting it to integer, does this mean that no matter of the String value it will always have an int value of 0? (because COUNTER is of type String) My second question is: why do I have to use session.setAttribute() after I get it in order to print the new value. My logic is the following. As we know each servlet is instantiated only once - I get the attribute (session.getAttribute(COUNTER)), check if i is different than null and then increment it, if I comment the setAttribute I'll not be able to see the new incremented value. Why do I have to set again in order to get the right value? When I press refresh I'm making a new get request and it takes the old value of COUNTER (for example 2), then we check …

http://stackoverflow.com/comment/41974497
has text: @monti Sorry, that was a typo, of course I meant `getDataModel()`. The other model is for the arrows. (Fixed it.)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26676421

http://stackoverflow.com/q/26757876
has comment: http://stackoverflow.com/comment/42097852
has comment: http://stackoverflow.com/comment/42098376
answer count: 0
has body: I have an XML file something like the following: &lt;link&gt; &lt;![CDATA[ https://r16---sn-o097znl7.googlevideo.com/videoplayback?itag=36&amp;expire=1415213271&amp;requiressl=yes&amp;sparams=id%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Crequiressl%2Csource%2Cupn%2Cexpire&amp;upn=e8gdyXXONR4&amp;signature=7B6D037A1C22DBFB32744C8255BB84578FA32025.AD47E1B35C9BA4B427CB27FE2DBC8B5C68EEB18E&amp;ms=au&amp;mv=m&amp;mt=1415191522&amp;source=youtube&amp;ip=216.12.194.2&amp;initcwndbps=1583750&amp;sver=3&amp;key=yt5&amp;id=o-AP0H2mfAbAl9n-uDZ0Xto3KC7qHeCFL1TC5_aLlW-odn&amp;fexp=930666%2C932404%2C940240%2C947209%2C947215%2C948124%2C952302%2C952605%2C952901%2C953912%2C957103%2C957201&amp;ipbits=0&amp;mm=31&amp;ratebypass=yes ]]&gt; &lt;/link&gt; It contains a long URL and is using CDATA. The URL is showing up fine until here. I am trying to parse it using XMLParser. Using the following code: static final String key_link="link"; XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); // getting XML Document doc = parser.getDomElement(xml); // here URL is url to xml document String size=parser.getValue(e,key_link); It is returning empty. When I replace the long link with some other text without CDATA I am able to read it. With CDATA I am not able to read the value into a string in the client. How do I resolve this problem?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42098345
has comment: http://stackoverflow.com/comment/42098422
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/42098505
tagged with: android
has title: parsing xml in android that contains cdata as tag
score: 0
tagged with: java

http://stackoverflow.com/q/26761813
has answer: http://stackoverflow.com/a/26762032
accepted answer: http://stackoverflow.com/a/26762598
type: Question
tagged with: java
tagged with: jboss
tagged with: eclipse
answer count: 2
has body: I am getting this error and do not know how to get round it. I am trying to start up the JBOSS server but it is failing. I am using windows and have tried tasklist/FI "PID eq 8080" at the command line and it just says. INFO: No tasks are running which match the specified criteria. The only thing i can think of is that I have been using net beans to run the glass fish server but I am unsure on how to shut that down as i dont think it has a PID. any help to resolve and get the jboss server running
type: AnsweredQuestion
has title: jboss Address already in use: JVM_BIND localhost/127.0.0.1:8080. fails on windows
has answer: http://stackoverflow.com/a/26762598
score: 0
possible better answer: http://stackoverflow.com/a/26762032

http://stackoverflow.com/comment/41975064
has text: Thanks. This is pretty much easier than what I was trying
comment on: http://stackoverflow.com/a/26680021
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26729559
has body: I am running Spring MVC application with hibernate.cfg as below: org.hibernate.transaction.JDBCTransactionFactory org.hibernate.dialect.MySQLDialect true UTF-8 UTF-8 jdbc:mysql://10.2.10.123:3306/xxx com.mysql.jdbc.Driver xxx false xxx true org.hibernate.connection.C3P0ConnectionProvider 1 100 50 0 10 7200 thread 5 false When I run application in local environment, it runs without any problem. But on server it gives exception as: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 206,756 milliseconds ago. The last packet sent successfully to the server was 3 milliseconds ago. Further I get following log: Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3119) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3573) ... 90 more DEBUG: 11:42:41.858 com.mchange.v2.resourcepool.BasicResourcePool.trace(BasicResourcePool.java:1644) - trace com.mchange.v2.resourcepool.BasicResourcePool@2b5cccf1 [managed: 7, unused: 6, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@5700187d) DEBUG: 11:42:41.861 com.mchange.v2.resourcepool.BasicResourcePool.decrementPendingAcquires(BasicResourcePool.java:422) - decremented pending_acquires: 0 DEBUG: 11:42:41.858 com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:967) - Successfully destroyed resource: com.mchange.v2.c3p0.impl.NewPooledConnection@61b03322 DEBUG: 11:42:41.861 com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.finerLoggingTestPooledConnection(C3P0PooledConnectionPool.java:323) - Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@c2beb14] on CHECKOUT has FAILED. java.sql.SQLException: Connection is invalid Can anyone help?
type: UnansweredQuestion
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/32860067
has answer: http://stackoverflow.com/a/61686163
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
tagged with: c3p0
has title: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure?
has comment: http://stackoverflow.com/comment/42047870
score: 0
answer count: 2

http://stackoverflow.com/q/26674924
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26677294
has title: Prevent JDOM2 from creating xmlns=""
tagged with: java
tagged with: jdom-2
has body: I try to add new &lt;class&gt; elements to a persistence.xml file with JDOM2. persistenceUnitEl.add(new Element("class").addContent(className)); The problem is that jdom2 always adds xmlns="" to the &lt;class&gt; elements. How can i prevent this? removeAttribute("xmlns") does not work and removeNameSpace(el.getNameSpace()) also does not work.
type: Question
answer count: 2
tagged with: jdom
has answer: http://stackoverflow.com/a/32003786
score: 0

http://stackoverflow.com/a/26684969
upvote count: 1
score: 1
has body: I can think of two potential problems: An applet can't read files located on the web server. If the file is packed inside a jar file, you need special code in order to read it. Specifically, you need a ClassLoader's getResourceAsStream. For the second, the easiest way to get the ClassLoader's getResourceAsStream is to call Class's getResourceAsStream. I haven't tested it, but something like this should work: BufferedReader br = new BufferedReader(new InputStreamReader(Table.class.getResourceAsStream("/Products.csv"))); If that doesn't compile, change Table.class to this.getClass() Note that the / is there to indicate that Products.csv is at the root of the .jar file. Otherwise, it will use the package name as a directory to look in (i.e. if the package was package this.is.my.boomstick;, it'd try to open this/is/my/boomstick/Products.csv)
has comment: http://stackoverflow.com/comment/41968124
answers question: http://stackoverflow.com/q/26684676
has comment: http://stackoverflow.com/comment/41985748
has comment: http://stackoverflow.com/comment/41968134
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41968182
downvote count: 0
has comment: http://stackoverflow.com/comment/41985854
type: Answer
accepted answer of: http://stackoverflow.com/q/26684676

http://stackoverflow.com/q/26741284
has comment: http://stackoverflow.com/comment/42068715
answer count: 0
has comment: http://stackoverflow.com/comment/42068468
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
type: Question
has comment: http://stackoverflow.com/comment/42068592
linked to: http://stackoverflow.com/q/218384
tagged with: hashmap
tagged with: java
has title: java null pointer exception hashMap containsKey
score: 0
has comment: http://stackoverflow.com/comment/42068424
has comment: http://stackoverflow.com/comment/42068884
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42068804
has comment: http://stackoverflow.com/comment/42068924
has body: I am trying to understand why I get the following error: Exception in thread "main" java.lang.NullPointerException at HashMapClass.person_exists(HashMapClass.java:12) at MainClass.main(MainClass.java:7) I would have expected that by using contains key I would avoid pointing to nothing. Put another way, how do I query by hashMapClass when it is Empty? MainClass.java public class MainClass { public static void main(String[] args) { HashMapClass people = new HashMapClass(); boolean e = people.person_exists("foo"); } } HashMapClass.java import java.util.HashMap; public class HashMapClass { private HashMap&lt;String, PersonClass&gt; people; HashMapClass() { this.people = people; } public boolean person_exists(String name) { if (this.people.containsKey(name)) { return true;} else {return false;}} } PersonClass.java import java.util.HashMap; public class PersonClass { private String name; private HashMap&lt;String, Integer&gt; archive; private int x; PersonClass(String name) { this.name = name; this.archive = archive; this.x = 10; } }
has comment: http://stackoverflow.com/comment/42068608

http://stackoverflow.com/comment/41978689
score: 0
has text: I can't speak for Java, but I can tell you that in C#, when MSFT implemented 64 bit versions there was zero impact to questions like this. The reason is that the main differences in 32 and 64 bit applications are in addressiblity, not function. The registers at the hardware layer have more room, they are not 4 bytes any longer they are 8 bytes. But in order to accomodate legacy apps. there were some unique things that had to happen, for example there are two registries, two program file paths etc. But the IDEs handled it perfectly. Mostly transparent to the developer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26690996

http://stackoverflow.com/a/26777163
answers question: http://stackoverflow.com/q/26776293
has body: Mind the space between the positive pattern and the negative! And the last semicolon should not be there. Here's a pattern that works: DecimalFormat formatter = new DecimalFormat("+#0.000 ; -#0.000"); Does this help?
upvote count: 1
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/26831389
upvote count: 2
has title: How to keep the same jump height in libgdx
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26845050
tagged with: java
has body: I'm developing a 2D video game using libgdx. I ran into a problem when I try to make jumping a body. It does not jump as expected after making it moving to the right.(I can only move to the right or Jump) If the body jumps before it's moving to the right everything goes fine. But If I decide to make jumping the body after moving it to the right. The body no longer jumps to the same height (It jumps less high). And I don't figure out why.. My method to jump the body : if (player.isPlayerOnGround()) { body.applyForceToCenter(0, 200, true); } My method to move the body right if (player.isPlayerOnGround()) { body.setLinearDamping(0f); body.setLinearVelocity(1f,0f); isMoving = true; } My method to stop the body moving right : body.setLinearDamping(5f); isMoving = false; The world use a -9.81f gravity and the body 1f for the Mass. P.S : Sorry for me bad english, it's not my native language. Thank you.
tagged with: box2d
type: Question
tagged with: libgdx
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26845050
favorite count: 0

http://stackoverflow.com/q/26697102
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Once I got this Question Latest Jersey example does not work answered, I run into another curious problem: The server, GET methods work fine. I tested and added some test code for helloworld-pure-jax-rs example, and esp. added a POST request for JSON: package org.glassfish.jersey.examples.helloworld.jaxrs; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("helloworld") public class HelloWorldResource { public static final String CLICHED_MESSAGE = "Hello World!"; @GET @Produces(MediaType.TEXT_PLAIN) public String getHello() { return CLICHED_MESSAGE; } @GET @Produces(MediaType.APPLICATION_JSON) public String getHelloJson() { return "{ \"message\":" + CLICHED_MESSAGE + "}"; } @GET @Produces(MediaType.TEXT_HTML) public String getHelloHtml() { return " " + " " + "Hello Jersey" + " " + " " + CLICHED_MESSAGE + " " + " "; } @GET @Produces(MediaType.TEXT_PLAIN) @Path("/v2") public String getHello2() { return CLICHED_MESSAGE + " v2"; } @GET @Produces(MediaType.TEXT_PLAIN) @Path("/{id}") public String getHelloId(@PathParam("id") String id) { return CLICHED_MESSAGE + " Parameter: " + id; } @GET @Produces(MediaType.TEXT_PLAIN) @Path("/id/{id : [a-zA-Z][a-zA-Z_0-9]}") public String getHelloIdId(@PathParam("id") String id) { return CLICHED_MESSAGE + " Parameter: " + id; } @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public Response test(String test) { if (test.equals("test")) return Response.status(400).entity("Error: " + test).build(); return Response.status(200).entity(test).build(); } @POST @Path("/test") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response testJSON(Test test) { String result = "Test JSON created : " + test.getName() + "" + test.getAge(); // return result; return Response.status(200).entity(result).build(); } @POST…
upvote count: 7
type: Question
tagged with: jersey
accepted answer: http://stackoverflow.com/a/26697415
answer count: 1
downvote count: 0
tagged with: jax-rs
favorite count: 0
tagged with: rest
has title: MediaType.APPLICATION_XML and MediaType.APPLICATION_JSON in a Jersey demo application
has answer: http://stackoverflow.com/a/26697415
type: AnsweredQuestion

http://stackoverflow.com/comment/41993828
type: Comment
comment on: http://stackoverflow.com/q/26699930
has text: I've amended the bottom part of my question, I hope it is clearer now. You're right, I was hoping to clear the textfields, only when a valid object is created. Where would be the best place to put the codes to clear the textfields?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42141263
has text: correct indentation helps you (and us) to understand your code more quickly and find the mistakes you actually made. For starters : each closing-bracket should be on the same height as the corresponding opening-bracket and each content between those should be more indented (e.g. 4 spaces more) http://mbreen.com/javastyle.html
comment on: http://stackoverflow.com/a/26781651
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42007911
comment on: http://stackoverflow.com/a/26706398
type: AnswerComment
type: Comment
has text: That's strange, runOnUiThread is a standard activity method, nothing obscure, look at the docs: http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable) ... Maybe there's a misspelling? I just noticed it's runOnUiThread with a lowercase "i".
score: 1

http://stackoverflow.com/comment/42088209
type: QuestionComment
comment on: http://stackoverflow.com/q/26752443
has text: You haven't initialized the TextArea. Add it before setting text to it inside the constructor
score: 0
type: Comment

http://stackoverflow.com/a/26812808
type: Answer
score: 0
has body: Constructors should be camelized(as a convention, same with the class name) and it return only the type of itself see my example :) Account() { return; }
answers question: http://stackoverflow.com/q/26811266

http://stackoverflow.com/a/26695108
type: Answer
answers question: http://stackoverflow.com/q/26694887
score: 0
has comment: http://stackoverflow.com/comment/41985381
has body: Please use Arrays.sort() for sorting instead.This is not exact solution for the problem, but an alternate way for it. import java.util.Arrays; public class Test{ Public static void main(String args[]){ String str[]= {'Mike','Adam','Peter','Brian'}; System.out.println("str"+str[0]); // Mike Arrays.sort(str); System.out.println("str"+str[0]); //Adam } }

http://stackoverflow.com/q/26732775
has comment: http://stackoverflow.com/comment/42053006
has comment: http://stackoverflow.com/comment/42052557
type: Question
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/77458935
has comment: http://stackoverflow.com/comment/42052637
downvote count: 0
has answer: http://stackoverflow.com/a/26765811
has body: I have 2 tables. Table1 has a column called 'id' which is a number. Table2 has a column called entity_id which is varchar. Table1 has one to Many relation with Table2. Here is my Hibernate mapping for Table1 @Entity @Table(name="Table1") public class Table1 implements Serializable { private long id; private List&lt;Table2&gt; notes; @Id @Column(name="ID") public long getId() { return id; } public void setId(long id) { this.id= id; } @OneToMany(fetch=FetchType.EAGER,targetEntity=Table2.class) @Fetch(FetchMode.JOIN) @JoinColumn(name="ENTITY_ID",referencedColumnName="ID") public List&lt;Table2&gt; getNotes() { return storeNotes; } public void setNotes(List&lt;Table2&gt; notes) { this.notes = notes; } } When I create a ctiteria with Table1 and try to list the data, I am getting Invalid number error because the type mismatch in the join column. can you please let me know how can I ast id to varchar?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Join columns of different types in Hibernate
linked to: http://stackoverflow.com/q/3096985
score: 2
tagged with: join
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42158179
type: Comment
type: QuestionComment
has text: Check out this [posting](http://stackoverflow.com/questions/1140358/how-to-initialize-log4j-properly). It should help you figure out your problem.
comment on: http://stackoverflow.com/q/26791074
score: 0

http://stackoverflow.com/comment/42095121
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26756496
has text: Look at this post http://stackoverflow.com/questions/8194408/how-to-access-parameters-in-a-restful-post-method/8194612#8194612

http://stackoverflow.com/comment/42195200
comment on: http://stackoverflow.com/q/26810859
score: 0
type: Comment
type: QuestionComment
has text: Netbeans won't actually copy libraries into a Jar file. You have to distribute several Jar's (your Jar plus any libraries) in order to get the "whole" project. [Look at OneJar](http://one-jar.sourceforge.net/) though, it might help you.

http://stackoverflow.com/q/26754757
score: 0
has body: I have a stored procedure in which avg_pressure column is empty.I have to create a method to calculate the average of various columns in a row and put that calculated average values in respective row and column.My average calculated method is:- public int arrayAverage() throws NumberFormatException, SQLException { int sum = 0; int count = 0; getConnection(); String A= rs.getString("st1_vs1_bag1_rb"); String B= rs.getString("st1_vs1_bag2_rb"); String C= rs.getString("st1_vs1_bag4_rb"); for (int i = 0; i &lt; a.length; i++) { for (int j = 0; j &lt; a[i].length; j++) { sum +=Integer.parseInt(A+B+C); count++; } My table data is retrieved from following method:- public String[][] getDbTable() { int i = 0; String [][]a = new String[3600][16]; System.out.println("datetime is" +d); System.out.println("datetime is" +currentDate); try { con = getConnection(); String sql = "exec vcs_gauge @gauge_name=?,@first_rec_time=?,@last_rec_time=?"; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println("date is "+df.format(currentDate)); clstmt = con.prepareCall(sql); clstmt.setString(1,"vs1_bag"); clstmt.setString(2, "2014-09-01 10:00:00"); clstmt.setString(3, "2014-09-01 11:00:00"); clstmt.execute(); rs = clstmt.getResultSet(); while (rs.next()) { for(int j=0; j&lt;16; j++) { a[i][j] = rs.getString(j+1); } i++; } } catch( Exception e ) { System.out.println("\nException in Display Bean in getDbTable(String code):"+e); } finally { closeConnection(); } return a; } But when i run arrayAverage() method through jsp then following exception is thrown. com.microsoft.sqlserver.jdbc.SQLServerException: The result set is closed. Thanks in advance.
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/26756700
has title: Average calculation of various columns of stored procedure in java
type: UnansweredQuestion
tagged with: sql-server-2012
tagged with: java
tagged with: average
type: Question

http://stackoverflow.com/comment/42200000
has text: @BlazeTama sure, when I check on the other activity, I log the newFile and it returns the object, but returns null when i try to get its property.
comment on: http://stackoverflow.com/q/26814119
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/26690028
favorite count: 0
has comment: http://stackoverflow.com/comment/41976882
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41976848
tagged with: android
tagged with: android-fragments
answer count: 0
tagged with: java
has title: Change activities to fragments
upvote count: 1
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/41976986
has body: For my thesis I'm doing an Android app and its more or less almost done but my problem is that I started it using activities and now I really should swap to fragments and I'd like to change as few as possible. Due to copyrights of such app in my country I can only give some idea how it looks. I have top header with user info etc which is build on activity, and it should stay like it is, then I have button panel build as activity and then there is content which I need to rewrite to fragments. The base structure of app is build on BaseActivity class and all other classes extend BaseActivity: public class BaseActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // some code here, db connectors etc } // Some more functions like sending session context to server, retriving it void setNavigationDrawer() { setUserInfo(sessionContext); DrawerLayout sDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); sDrawerLayout = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view sDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.drawer_list_item, DisplayedUserInfo)); // Set the list's click listener sDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ sDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ); // Set the drawer toggle as the DrawerListener sDrawerLayout.setDrawerListener(sDrawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } protected void setUpNavigation() { // setting nav buttons i.e if(userInfo != null) { userInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), userInfoActivity.class); intent.putExt…
downvote count: 0
score: 1
tagged with: android-activity

http://stackoverflow.com/comment/42109419
type: Comment
has text: Thanks.But will this practice retain the order of elements in new list similar to that in original?
comment on: http://stackoverflow.com/a/26764113
type: AnswerComment
score: 0

http://stackoverflow.com/q/26735259
has body: I'm beginner with Java/Android and Parse. Today i need your help . I don't know what i'm doing wrong. Look to my picture My .jar file is in "Lib" , but i'm receiving the red lines in my project. Also ,how can you see in Parse.initialize seems that this is not recognized.
accepted answer: http://stackoverflow.com/a/26735334
linked to: http://stackoverflow.com/q/16615038
answer count: 1
downvote count: 0
favorite count: 0
tagged with: parse-platform
tagged with: android
has title: Error to initialize the parse.com code in Android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42080638
score: 1
has answer: http://stackoverflow.com/a/26735334
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/26760106
answer count: 3
has answer: http://stackoverflow.com/a/37598535
has comment: http://stackoverflow.com/comment/42101685
has title: Convert date to long (manually)
has comment: http://stackoverflow.com/comment/42102128
tagged with: time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26761113
linked to: http://stackoverflow.com/q/6841333
has body: I want to convert a date to a long value (that is the milliseconds) I have a date like 2/11/2014 I want to calculate the date in long (manual) What I've tried (2014 - 1970 ) * 31449600000 + 11 * 2592000000 + 2 * 604800000 This equals 1413504000000. But http://www.fileformat.info/tip/java/date2millis.htm tells me that 1413504000000 is Date (America/New_York) Thursday, October 16, 2014 8:00:00 PM EDT Date (GMT) Friday, October 17, 2014 12:00:00 AM GMT Date (short/short format) 10/16/14 8:00 PM Where I'm wrong? Again, I want to do this manually, not using java code.
has comment: http://stackoverflow.com/comment/42101645
has comment: http://stackoverflow.com/comment/42101693
tagged with: java
has comment: http://stackoverflow.com/comment/42101675
has comment: http://stackoverflow.com/comment/42101564
type: Question
has comment: http://stackoverflow.com/comment/42102714
has comment: http://stackoverflow.com/comment/42101729
has comment: http://stackoverflow.com/comment/42102633
linked to: http://stackoverflow.com/q/11221703
has answer: http://stackoverflow.com/a/26761343
has comment: http://stackoverflow.com/comment/42101905
tagged with: date
score: 0

http://stackoverflow.com/comment/42199569
score: 0
type: Comment
type: QuestionComment
has text: I suspect that what's happening is you've managed to arrange things so that `main_road == roads` - that would result in the concurrent modification exception that you're seeing. You could check this easily enough (for example, put in a line like `if main_road==roads System.out.println("Oops!");`
comment on: http://stackoverflow.com/q/26813616

http://stackoverflow.com/q/26749830
has title: Gxt tree grid double click to show pop up
tagged with: event-handling
favorite count: 0
tagged with: treegrid
has comment: http://stackoverflow.com/comment/42084433
has answer: http://stackoverflow.com/a/26772037
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: gxt
possible better answer: http://stackoverflow.com/a/26772037
has answer: http://stackoverflow.com/a/26760305
accepted answer: http://stackoverflow.com/a/26760305
type: Question
tagged with: gwt
score: 3
has body: How do I catch double click event in gxt tree grid? I already try this from : Click Handlers for Trees in GXT 3? tree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); tree.getSelectionModel().addSelectionHandler(new SelectionHandler&lt;MenuView.MenuDto&gt;() { public void onSelection(SelectionEvent&lt;MenuDto&gt; event) { MenuDto mnu = event.getSelectedItem(); Info.display("Tree Handler", mnu.getDescripcion()); } }); But it only works for single click, not double click. I want if user press double click, pop up will show.
linked to: http://stackoverflow.com/q/10743869
has comment: http://stackoverflow.com/comment/42085482
has comment: http://stackoverflow.com/comment/42084006
upvote count: 3
answer count: 2

http://stackoverflow.com/comment/42198852
score: 0
type: Comment
type: QuestionComment
has text: how to i repetatively make new jlabels and add random characters in them using a loop?
comment on: http://stackoverflow.com/q/26783278

http://stackoverflow.com/a/26704422
answers question: http://stackoverflow.com/q/26704354
has comment: http://stackoverflow.com/comment/42010817
has comment: http://stackoverflow.com/comment/42002790
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42002232
has body: It looks like you have the method signature wrong. It should be: RGBToHSV(int red, int green, int blue, float[] hsv) See: http://developer.android.com/reference/android/graphics/Color.html#RGBToHSV(int,%20int,%20int,%20float[]) Unless you were after this one? colorToHSV(int color, float[] hsv) See: http://developer.android.com/reference/android/graphics/Color.html#colorToHSV(int,%20float[]) Note that both methods are static Both work fine in Android Studio for me.
has comment: http://stackoverflow.com/comment/42002300
score: 0

http://stackoverflow.com/q/26766366
type: Question
score: 0
has title: Unable to get standard SSL client to work with axis2 web service
answer count: 1
tagged with: web
has body: Alright I have a wsdl with web methods that I create stubs via axis2java with the following command: wsdl2java -uri https://path/to/service?wsdl -p com.my.java.package It generates all the required stubs but I am having a hard time actually using them. I have two URLs both HTTPS however one of them has message encryption with rampart. I have been able to get the more difficult message encrypted URL to work fine. I initialize my encrypted stub like follows: ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null); NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint); ServiceClient client = stub._getServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(aEndPoint)); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, this.loadPolicy("repository/policy/HTTPS_Policy.xml")); client.setOptions(options); client.engageModule("rampart"); return stub; For my non-encrypted (HTTPS ONLY) I have tried the above method of stub initializing as well as the following: ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null); NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint); ServiceClient client = stub._getServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(aEndPoint)); client.setOptions(options); The plain HTTPS stub does not work. At best I get a soap header missing exception. I can however use these web methods via SOAPui. So I know the URL/WSDL/web methods are working great. I am more familiar with wsimport and not axis2.... axis2 seems much more difficult to do such a simple thing. How am I supposed to setup the stub for calling a non-message encrypted web service? Why is axis2 such a pain to work with? Is it just a problem with me not understanding something. If SOAPui can immediately generate web requests/responses then I feel the axis2 tool should be able to do the same especially since the…
tagged with: web-services
tagged with: wsdl2java
accepted answer: http://stackoverflow.com/a/26805553
type: AnsweredQuestion
tagged with: java
tagged with: apache-axis
has answer: http://stackoverflow.com/a/26805553

http://stackoverflow.com/comment/42046225
has text: okay not a standard for every programming language.But the Answer to this question still remains why compiler need seperate areas to put variables in appropriate memory areas.
type: AnswerComment
comment on: http://stackoverflow.com/a/26728485
score: 0
type: Comment

http://stackoverflow.com/comment/65506892
comment on: http://stackoverflow.com/q/26678407
score: 0
has text: man how u fix wrong values in magnitude index? its sometime like i = max_length_of_magnitude and values in freq = 46000+
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26770041
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42138397
tagged with: design-patterns
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42124749
has comment: http://stackoverflow.com/comment/42123381
has body: I have just started the transition from the Java SE to EE and I would like to know the best practice for the following problem. I have a Java SE application that I would like to put up online. The web/EE part has been set up with Windows7/Apache Tomcat and standard servlet/JSP. For the Java application it is really a collection of interdependent source file. My plan is to create an executable .jar file that will be invoked by a servlet and the output stream and filtered error stream will be handed over to the online user. The factors that I have in mind are (in order of priority) : overhead of the .jar invocation consequently, high traffic handling, although it is an academic tool security as the invocation is with structured user input that is passed as command line arguments to the .jar (i am talking script injection type vulnerabilities as an input) modularity as the Java application may undergo several revision, so if there is a simpler coupling between the app and web app I would take it without too much of the overhead stated above So my question is whether the plan stated above, the right way of doing this? Also can anybody else think of any other factors that I should be concerned with? Any input or pointers would be hugely appreciated! Edit:: So previously I had done this project with WIn7/Apache HTTP/PHP where PHP would generate a unique file name with user input and send it off to the jar program with an exec function call and file name as command line argument. The program would generate a similar named output file and PHP would take the contents of that output file and put it back to the user. The problem was every exec call would instantiate a new JVM instance and if ever this site got a lot of user the server would crawl/crash handling those many requests. That is why I moved to a native Java server. I had the same idea here too except that I wanted the program as a unit (jar) so that any new revision would be easier to deploy. And Now this is a tenta…
accepted answer: http://stackoverflow.com/a/26775287
tagged with: java
has title: Integrating Java SE application as a service with Java EE application best practices
tagged with: scalability
has comment: http://stackoverflow.com/comment/42179814
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26775287
score: -1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42167499

http://stackoverflow.com/q/26779014
has comment: http://stackoverflow.com/comment/42145632
has comment: http://stackoverflow.com/comment/42140013
tagged with: canvas
has comment: http://stackoverflow.com/comment/42136814
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42171097
has body: I want to develop a simple interactive game (like arcanoid). I already have implemented a menu and different views, and now I need to develop the actually game (draw flying ball, some movable platform) and I don't know how to do this. I need something like canvas where I can draw my graphic each frame. I have tryed to implement this with Canvas and Timer. But it doesn't want update graphic itself, but only when user clicks on screen or similar. Also I saw com.google.gwt.canvas.client.Canvas, but I cannot understand how to use it in Vaadin application. So my question is next: is it possible to draw some graphic each frame with high framerate in any way? If possible, how can I do this? P.S. I use the Vaadin 7.3.3.
upvote count: 6
has answer: http://stackoverflow.com/a/26883088
type: AnsweredQuestion
tagged with: java
has title: How to create interactive graphic with Vaadin?
has comment: http://stackoverflow.com/comment/42140109
has comment: http://stackoverflow.com/comment/42140459
has comment: http://stackoverflow.com/comment/42139102
type: Question
has comment: http://stackoverflow.com/comment/42156274
accepted answer: http://stackoverflow.com/a/26883088
tagged with: vaadin
score: 6

http://stackoverflow.com/comment/68824948
type: QuestionComment
has text: Duplicate problem, see:[http://stackoverflow.com/questions/9932923/why-cant-maven-find-an-osgi-bundle-dependency?lq=1](http://stackoverflow.com/questions/9932923/why-cant-maven-find-an-osgi-bundle-dependency?lq=1) This problem is also known as a bug: [https://issues.apache.org/jira/browse/HADOOP-12839](https://issues.apache.org/jira/browse/HADOOP-12839)
comment on: http://stackoverflow.com/q/26819626
score: 0
type: Comment

http://stackoverflow.com/comment/42231354
comment on: http://stackoverflow.com/a/26832360
type: AnswerComment
score: 0
has text: check this out http://stackoverflow.com/questions/24449344/using-android-support-v7-widget-cardview-in-my-project-eclipse
type: Comment

http://stackoverflow.com/comment/42008375
comment on: http://stackoverflow.com/a/26707957
type: AnswerComment
has text: man I love you, and your quick answer, I didn't know it was greedy expression I don't understand how come that I didn't think of that!, but still could you explain to me how comes that if finds as the first group the whole and not just <!-- ? ...
score: 0
type: Comment

http://stackoverflow.com/q/26722090
accepted answer: http://stackoverflow.com/a/26722247
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26722656
has answer: http://stackoverflow.com/a/26722656
tagged with: javascript
tagged with: jquery
has body: I have a ppc landing page that I want to change the hidden value of a form field based on the URL parameter. The field &lt;input id="Campaign_ID" name="Campaign_ID" type="hidden" value="7g012455dv5441vdf"&gt; The URL would be something like mysite.com/?campaignidvalue=7g012455dv5441vdf There will be other field "values" that are also based on the URL parameter, so it has to tie the "input id" (or name) to that specific value.
has comment: http://stackoverflow.com/comment/42034736
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42034035
has comment: http://stackoverflow.com/comment/42034113
has comment: http://stackoverflow.com/comment/42034564
has title: populate hidden input form fields based on URLparameters
tagged with: php
has answer: http://stackoverflow.com/a/26722247

http://stackoverflow.com/q/26810691
tagged with: loops
upvote count: 1
downvote count: 1
type: Question
has title: how to write java program that read 5 numbers and calculate how many numbers has value from 0-9
has answer: http://stackoverflow.com/a/26810750
has answer: http://stackoverflow.com/a/26810919
has comment: http://stackoverflow.com/comment/42194338
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26810754
favorite count: 0
has body: import java.util.Scanner; public class good { public static void main(String[] args) { Scanner variable = new Scanner(System.in); int i = 0, counter = 0, n = 0; for (i = 0; i &lt; 5; i++) { n = variable.nextInt(); } if ((0 &lt;= n) &amp;&amp; (n &lt;= 9)) { counter++; } System.out.println("the number of values enterd from 0-9 is " + counter); } } I have no errors in my program but I'm not getting a right answer. For example : ----jGRASP exec: java good 5 6 4 the number of values enterd from 0-9 is 0 ----jGRASP: operation complete. I shoud get "3" but I get "0"
has comment: http://stackoverflow.com/comment/42193991
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42193999
has comment: http://stackoverflow.com/comment/42194182
tagged with: java

http://stackoverflow.com/q/26704512
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42002135
favorite count: 0
has answer: http://stackoverflow.com/a/26704617
has answer: http://stackoverflow.com/a/26704584
tagged with: linked-list
linked to: http://stackoverflow.com/q/5662394
type: UnansweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I want to create an array of pointers to linked lists and then go through each list. To create it can I simply create however many lists I need and then just do something like LinkedList array[] = new LinkedList[length]; and then just set a loop to set each value in the array to point to one of the lists? How would I go through each list after I set it all up? I thought it was something like while(array[x].hasNext()){ //do stuff x++; }
has title: go through an array of linked lists
has comment: http://stackoverflow.com/comment/42002156
score: 0

http://stackoverflow.com/comment/42167708
has text: http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html
type: QuestionComment
comment on: http://stackoverflow.com/q/26796864
type: Comment
score: 1

http://stackoverflow.com/q/26812760
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42197939
type: Question
has body: I am using a List being initialized in spring.xml. I need to use propertyPlaceholderConfigurer to loose-couple initial values in pointList.cfg.properties file. this is spring.xml code: classpath:pointList.cfg.properties Triangle Class code is: package edu.akarimin.koushik; public class Triangle{ private List<Point> pointList; public void draw(){ for (Point point : pointList) { System.out.println("Point= (" +point.getX()+ ","+point.getY()+")"); } public void myInit(){ System.out.println("MyInit method called for Triangle"); } public void cleanUp(){ System.out.println("CleanUp method called for Triangle"); } And main method is: public class DrawingApp { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); Triangle triangle = context.getBean("triangle", Triangle.class); triangle.draw(); } } class Point is: public class Point { private int x; private int y; public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } } Any ideas to fix the problem ?
score: 0
has comment: http://stackoverflow.com/comment/43341997
has title: NumberFormatException and TypeMismatchException for using propertyPlaceholderConfigurer in xml configuration
has comment: http://stackoverflow.com/comment/42197639
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc

http://stackoverflow.com/q/26804526
has comment: http://stackoverflow.com/comment/42369331
has comment: http://stackoverflow.com/comment/42256212
has title: debugger cannot access the parent page variable in the included page
favorite count: 0
tagged with: el
upvote count: 5
downvote count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27053618
tagged with: jstl
score: 5
has comment: http://stackoverflow.com/comment/42223477
has comment: http://stackoverflow.com/comment/42183205
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42370657
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/42223469
has comment: http://stackoverflow.com/comment/42336272
has body: I have parent page named userCreated and I include another page in it named confirmationUser using &lt;%@include file="confirmationUser.jsp" %&gt; in the parent page (userCreated) I have the variable registerUser and I am trying to see its value in intellij but I am getting the error when I am using evaluate expression Local variable '' not found in class closure I am using latest version of intellij I can see any local variable that I defined in the confirmationUser , what should I do to see registerUser in confirmationUser when I run the page there is no problem and it is working but I need to debug because sometims I am getting null pointer exception and I want to directly know what is the problem. Parent Page RegisterUser registerUser = null; Child Page &lt;% String x = "blabla"; Boolean developer = registerUser.getPackage()!=null &amp;&amp; registerUser.getPackage().getName().equals("Developer");%&gt; here I cannot see the registerUser variable However I can see x variable in the debugger

http://stackoverflow.com/a/77984479
has comment: http://stackoverflow.com/comment/137559766
accepted answer of: http://stackoverflow.com/q/26728743
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26728743
score: 1
type: Answer
has body: Why are absolute reads from a ByteBuffer not considered thread-safe? Given the nature of the direct memory buffer (think mmap and other hardware backed files) that can be underneath the ByteBuffer, any external updates are guaranteed to not be properly synchronized -- not good. In addition, the fact that slice() and duplicate() are designed to use the same buffer means that although your ByteBuffer may be used in a thread-safe manner, there may be no guarantee that the "source" buffer is. These complexities may be the reason why blanket not-for-threads warnings are used. Because of this warning, I'm preceding every read from the byte buffer with a call to duplicate. As you mention, different JDKs and/or Java versions may have different implementations but I agree that I don't see any problem with you using the buffer unsynchronized as long as you are careful. The memory backing the ByteBuffer must not being modified by any external entitiy. You must instantiate the ByteBuffer and make any mutating method calls (i.e.e put(...) etc.) before the threads are created or the field holding the buffer needs to be volatile. Your buffer probably should not be a slice, duplicate, or otherwise sharing bytes with any other buffer. Only get(...) non-mutating methods are used by the threads. This means that (like you mention) you can't depend on the value of the offset field. But also be careful of the array() method that returns the actual array buffer and not a copy. Any mutating of the returned array will not be thread-safe. Keith's article hints at some of this: That said, you still have the issue of creating buffers: you need to synchronize access to the slice() or duplicate() call. One way to do this is to create all of your buffers before spawning threads. However, that may be inconvenient, especially if your buffer is internal to another class. An alternative is to use ThreadLocal... Like all threaded issues, the devil is in the details here and I admit that I don't have m…
has comment: http://stackoverflow.com/comment/137562289
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/137519232

http://stackoverflow.com/comment/42096895
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26756805
has text: It is a wizard of sorts, but the path they take through the wizard will change depending on options they choose, in this case there is a change in the screen depending on whether the user is importing or exporting data with the wizard.
score: 0

http://stackoverflow.com/comment/42091629
comment on: http://stackoverflow.com/a/26754184
score: 0
type: Comment
has text: I change log level to DEBUG,did't find the message,which java file dose this message exist? thanks
type: AnswerComment

http://stackoverflow.com/q/26697293
tagged with: cmd
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26697357
has answer: http://stackoverflow.com/a/26697354
type: AnsweredQuestion
score: 1
tagged with: java
has title: About java compiling
possible better answer: http://stackoverflow.com/a/26697354
type: Question
downvote count: 0
tagged with: compilation
accepted answer: http://stackoverflow.com/a/26697357
has body: I programmed two java classes (Coordinate.java and Orienteering.java) using Eclipse. These classes are stored in C:\Users\Jack\Desktop\Orienteering\Orienteering\src\jp\co\worksap\global The package is jp.co.worksap.global.Orienteering. I want to know how can I compile the two files in Windows command line and run it? Orienteering.java is the main class.
answer count: 3
has answer: http://stackoverflow.com/a/26697380

http://stackoverflow.com/comment/42037265
type: Comment
comment on: http://stackoverflow.com/a/26723387
score: 0
has text: But what, if the *delay* of the nested select is just because of a - lets call it *bug* - cause the outer-query starts with `INSERT` - Would it *still* be save with regards to concurrent modification, if the concurrent insert kicks in right between the *INSERT* and *(Sub-)SELECT* of "Statement 1"? (I cannot simulate this by calling two scripts ofc, cause it would be a *window* of some mili-seconds)
type: AnswerComment

http://stackoverflow.com/comment/42137639
score: 0
comment on: http://stackoverflow.com/a/26779879
type: Comment
has text: Try following commands: cd C:\JavaPractices\CPTest\src; javac com\web_tomorrow\RunThis1.java;java -cp . com.web_tomorrow.RunThis1
type: AnswerComment

http://stackoverflow.com/a/26722729
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26722591
has body: You should set 2f in order to make a decimal division (now you are doing a integer division in Math.abs(s-j)/2) Then your code should be arr[i] = s + t - Math.abs(s-j)/2f;

http://stackoverflow.com/comment/41976778
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26680241
score: 0
has text: So how would I load a jar?

http://stackoverflow.com/q/26755693
score: 0
answer count: 1
has title: cookie set is not working
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26778128
tagged with: cookies
tagged with: java
type: Question
has body: I'm trying to add a cookie for an ajax request to a backend server: $.cookie("JSESSIONID", jsession); problem is when the request is executed the cookie is not attached. any ideas why? btw: both the projects are located on local vpn : front end : 10.0.50.18 back end: 10.0.110.42
tagged with: apache
tagged with: ajax

http://stackoverflow.com/a/26781736
type: Answer
has body: Here is a small code to perform your operation. The only flaw is the use of replace for padding the 0. import javax.xml.bind.DatatypeConverter; import java.io.UnsupportedEncodingException; public class main { public static void main(String [] args) throws UnsupportedEncodingException { String base64_str = "MDQw"; byte[] decode = DatatypeConverter.parseBase64Binary(base64_str); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; decode.length; i++){ String temp = Integer.toBinaryString(decode[i]); sb.append(String.format("%8s", temp).replace(" ", "0")); } System.out.println(sb.toString()); } }
score: 2
downvote count: 1
upvote count: 3
answers question: http://stackoverflow.com/q/26778958

http://stackoverflow.com/comment/42029653
type: QuestionComment
comment on: http://stackoverflow.com/q/26719669
score: 0
type: Comment
has text: Go to json.org and learn the JSON syntax. It only takes 5-10 minutes to learn.

javabeans
tags question: http://stackoverflow.com/q/26711239
tags question: http://stackoverflow.com/q/26681058
tags question: http://stackoverflow.com/q/26770516
type: Tag
tags question: http://stackoverflow.com/q/26746396
tags question: http://stackoverflow.com/q/26737436
tags question: http://stackoverflow.com/q/26726336
tag name: javabeans

http://stackoverflow.com/a/73782402
type: Answer
score: 0
has body: May be a bit old thread but worth answering this question with exact steps as I struggled alot with this problem. Though its a hacky way to import rulebook from prod to your local. But it works and can save valuable time. Here are the steps: Login to SonarQube as admin. Create a new Quality Profile as below: Download the default xml from local sonarqube by clicking on Backup button. Lets call this file local-rulebook.xml Open both the prod-rulebook.xml file &amp; local-rulebook.xml in notepad. Delete the selected part from local-rulebook.xml &amp; replace with the content from prod-rulebook.xml. Save the file. P.S: Do not change the value of &lt;profile&gt;&lt;name&gt;{yourProfileName}&lt;/name&gt;. Go back to sonarQube and Click Restore at top-right corner of the screen. Import the newly updated file Change the default profile type. Congrats you successfully imported the prod-rulebook.xml to your local sonarqube.
answers question: http://stackoverflow.com/q/26762506

http://stackoverflow.com/q/26783278
has answer: http://stackoverflow.com/a/26785143
downvote count: 1
type: Question
score: -1
has body: I want to print random Unicode characters in a JFRAME in java by using an infinite for loop. I am a newbie in java programming and i hope the answer is not too complex. this is the code so far- import java.awt.*; import javax.swing.*; import java.util.*; public class Matrix extends JFrame{ private static final int NUMBER_OF_REPS = 0; public static void main(String[] args) { int a; Random rand=new Random(); for(a=1;a&gt;0;) { JLabel lbl=new JLabel(); lbl.setForeground(Color.GREEN); lbl.setFont(new Font("MS Arial Unicode",Font.BOLD,12)); lbl.setText("\\u30"+Integer.toHexString(rand.nextInt(96) + 160)); } JFrame frame=new JFrame(); frame.setLocationRelativeTo(null); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.getContentPane().setBackground(Color.BLACK); //error! lbl cannot be resolved to a variable frame.getContentPane().add(lbl); frame.getContentPane().setLayout(new FlowLayout()); } }
tagged with: for-loop
has title: printing Random Unicode Characters in java through infinite FOR loop
upvote count: 0
answer count: 1
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/42198852
has comment: http://stackoverflow.com/comment/42143773
has comment: http://stackoverflow.com/comment/42183634
has comment: http://stackoverflow.com/comment/42148265
has comment: http://stackoverflow.com/comment/42185188
type: UnansweredQuestion
tagged with: infinite
tagged with: java

http://stackoverflow.com/comment/42052001
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26731794
type: Comment
has text: @MarkoTopolnik yes, that is true, but it is too general thus carries only very limited payload.

http://stackoverflow.com/q/26750394
accepted answer: http://stackoverflow.com/a/26750574
tagged with: web-services
type: AnsweredQuestion
tagged with: wso2
tagged with: java
tagged with: apache-axis
tagged with: ubuntu
type: Question
has title: Axis Sample AddressBook exception
has body: I have 2 questions I am trying to run a axis 2 sample. In the last part of the instruction file, there is this line which it says, should be run in the terminal(ubuntu), is not working java -Djava.ext.dirs=%AXIS2_HOME%\lib;%JAVA_HOME%\jre\lib\ext -cp target/classes org.apache.axis2.jaxws.addressbook.AddressBookClient.class I am not an expert in this field, and I am not familiar with ubuntu commands. I feel that this is not an ubuntu command The error I get is, "Invalid Job" Can someone convert this into an ubuntu command? Since it was not working, I built the jar using, mvn clean install Then I copied the jar file to the servicejars directory under repository, in axis2 Then the axis server says that the jar does not contain the WebServices annotation "No @WebService annotated service implementations found in the jar: file:/home/dodan/Programs/axis2-1.6.0/repository/servicejars/jaxws-addressbook-1.6.0-client.jar. Service deployment failed." So I added it to the original java file which did not have that annotation(and the import too) Yet the axis2 server still sys that there is not webservices annotation 2. Can somebody say whether I have missed anything? here is the java file I changed import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.jws.WebService; import java.util.Map; /** * Simple JAX-WS Dispatch client for the address book service implementation. */ @WebService public class AddressBookClient { private static String NAMESPACE = "http://addressbook.jaxws.axis2.apache.org"; private static QName QNAME_SERVICE = new QName(NAMESPACE, "service"); private static QName QNAME_PORT = new QName(NAMESPACE, "port"); private static String ENDPOINT_URL = "http://localhost:8080/axis2/services/AddressBookImplService.AddressBookImplPort"; private static String ADD_ENTRY_BODY_CONTENTS = "&lt;ns1:addEntry xmlns:ns1=\"http://addressbook.jaxws.axis2.apache.org\"&gt;" + "&lt;ns1:firstName xmln…
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26750574

http://stackoverflow.com/q/26770083
has title: MySQL connection with JDBC
type: Question
has body: I'm trying to make a connection to a database on my computer. The password to the database is root, and so is the user. I have connector jar file in my project library, I have 7.0 jre and jdk, the table "clients" in database "Testing1" exists, and has 1 entry with 3 fields, +--------------------+ | Tables_in_Testing1 | +--------------------+ | clients | | esk | | files | +--------------------+ clients table: +----+------------------+-----------------------+ | id | PublicKey | Email | +----+------------------+-----------------------+ | 1 | PublicKeyNumber1 | FirstClient@email.com | +----+------------------+-----------------------+ And here's the code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; class JDBCTest { private static Connection con=null; private static Statement st=null; private static ResultSet rs=null; public static void main(String args[])throws Exception { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Testing1?user=root&amp;password=root"); }catch (Exception e) { System.out.println("e"); } try{ st=con.createStatement(); rs=st.executeQuery("select * from clients"); while(rs.next()) { System.out.println(rs.getString("Key")); } } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } if (con != null) { con.close(); } }catch (SQLException e) { System.out.println(e); } } } } All of this returns an error(in Eclipse) e Exception in thread "main" java.lang.NullPointerException at JDBCTest.main(JDBCTest.java:22) I assume that it's because there is no connection to the databasae, so con is null... but why?
linked to: http://stackoverflow.com/q/17484764
accepted answer: http://stackoverflow.com/a/26770175
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26770131
tagged with: jdbc
has answer: http://stackoverflow.com/a/26770175
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2591505
possible better answer: http://stackoverflow.com/a/26770131
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/26673783
has comment: http://stackoverflow.com/comment/41949605
upvote count: 2
has comment: http://stackoverflow.com/comment/41948116
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41948375
score: 2
downvote count: 0
answer count: 0
tagged with: java
tagged with: jaxb
has title: JAXB treat List elements as its @XmlElements element
type: Question
has body: I have something like: class A { List params; C other; } class B { @XmlElements(value = { @XmlElement(name="d", type=D.class), @XmlElement(name="e", type=E.class), @XmlElement(name="f", type=F.class) }) private Object param; } How should I change annotations to get serialization result like this: <f>…</f> <d>…</d> <d>…</d> <e>…</e> <f>…</f> <d>…</d> …

opennlp
type: Tag
tags question: http://stackoverflow.com/q/26713399
tag name: opennlp

http://stackoverflow.com/comment/42116862
score: 1
has text: Having the code that you *have* written is helpful because it gives an indication of where the problem you are having is located.
type: QuestionComment
comment on: http://stackoverflow.com/q/26761518
type: Comment

http://stackoverflow.com/q/26749480
possible better answer: http://stackoverflow.com/a/26749658
has comment: http://stackoverflow.com/comment/42084524
has answer: http://stackoverflow.com/a/26749658
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/42085209
linked to: http://stackoverflow.com/q/26751103
tagged with: onactivityresult
has title: How to get context inside onActivityResult?
accepted answer: http://stackoverflow.com/a/26749619
has comment: http://stackoverflow.com/comment/42083312
tagged with: android-context
linked to: http://stackoverflow.com/q/4391720
has comment: http://stackoverflow.com/comment/42084505
tagged with: android
has comment: http://stackoverflow.com/comment/42083247
has body: I have a DialogFragment which gives an option to pick a file using startActivityForResult. I then use onActivityResult to recieve the data and request code. After the file is chosen using the filemanager I access it from onActivityResult. Not doing much with the actual file being chosen right now as the main problem is when the file comes in I can get its name, other stuff. Now I add this into a HashMap&lt;String, Object&gt; which is then added to ArrayList&lt;HashMap&lt;String, Object&gt;&gt;. I then want to use a SimpleAdapter with a custom xml layout to populate the listview. The problem is SimpleAdapter requires the context as a parameter. How can I recieve the context in onActivityResult()? Some Code to get a better picture of what I am doing: public class MyFragment extends DialogFragment { ... ... @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { ... //here I want to get the context SimpleAdapter simpleAdapter = new SimpleAdapter(thecontext, attachments_list, R.layout.mycustomlayout, keys, ids); ... } } UPDATE: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.SimpleAdapter.notifyDataSetChanged()' on a null object reference UPDATE FULL CODE: public class MyFragment extends DialogFragment { //code for whole activity public static final String NEW_NOTE_CARD_FRAGMENT_CODE = "1"; //codes for each menu button public static final String PICK_FILE_REQ_CODE = "2"; public static final String PICK_NEW_IMAGE_CODE = "3"; //attachment keys public static final String KEY_ATTACHMENT_NAME = "a_name"; public static final String KEY_ATTACHMENT_DATE_ADDED = "a_date_added"; public static final String KEY_ATTACHMENT_ICON = "a_icon"; ArrayList&lt;HashMap&lt;String, Object&gt;&gt; attachmentsListArray = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); //listview ListView attachmentsListView; SimpleAdapter simpleAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundl…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42083316
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26749619
answer count: 2
has comment: http://stackoverflow.com/comment/42083389
has comment: http://stackoverflow.com/comment/42083284

http://stackoverflow.com/a/26783162
has comment: http://stackoverflow.com/comment/42144160
has body: Your Map should be defined the same type as your List. This is because the List expects a type of Map&lt;Long, Node&lt;? extends MySuperClass&gt;&gt;. The type Node&lt;? extends MySuperClass&gt; and Node&lt;MyClass&gt; are not the same. From http://docs.oracle.com/javase/tutorial/java/generics/inheritance.html Note: Given two concrete types A and B (for example, Number and Integer), MyClass&lt;A&gt; has no relationship to MyClass&lt;B&gt;, regardless of whether or not A and B are related. The common parent of MyClass&lt;A&gt; and MyClass&lt;B&gt; is Object. Note : I add to add a default constructor to your Node class to get the next four lines to compile since I didnt want to type in the params for the other constructor. List&lt;Map&lt;Long, Node&lt;? extends MySuperClass&gt;&gt;&gt; tree = new ArrayList&lt;Map&lt;Long, Node&lt;? extends MySuperClass&gt;&gt;&gt;(); Map&lt;Long, Node&lt;? extends MySuperClass&gt;&gt; myMap = new HashMap&lt;Long, Node&lt;? extends MySuperClass&gt;&gt;(); myMap.put(1L, new Node&lt;MyClass&gt;()); tree.add(myMap);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26782739
answers question: http://stackoverflow.com/q/26782739
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/26775528
has body: Try this one: select from Vettura where inE('follower').size() &gt; 1;
accepted answer of: http://stackoverflow.com/q/26767142
score: 2
answers question: http://stackoverflow.com/q/26767142
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42130530
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/26742595
has title: Why is onCheckedChanged not responding?
linked to: http://stackoverflow.com/q/11794269
has comment: http://stackoverflow.com/comment/42080534
has comment: http://stackoverflow.com/comment/42071368
tagged with: oncheckedchanged
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42075614
has comment: http://stackoverflow.com/comment/42075020
tagged with: android
has comment: http://stackoverflow.com/comment/42071823
has comment: http://stackoverflow.com/comment/42075247
has comment: http://stackoverflow.com/comment/42109435
has comment: http://stackoverflow.com/comment/42074958
score: 2
has body: I have so far the following code for that allows me to set a value to a textview when I click between toggle buttons that are grouped in a radiogroup. For some reason, it seems like the OnCheckedChanged does not get called. Is this the appproach for this? //onClickListener method that returns an interface private View.OnClickListener createClickListener(final int value) { return new View.OnClickListener() { @Override public void onClick(View view) { buttonValue = value; buttonState = true; ToggleButton clickedButton = (ToggleButton) view; RadioGroup radioGroup= (RadioGroup) clickedButton.getParent(); final TextView num = (TextView) view.findViewById(R.id.num); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch(checkedId){ case R.id.number_zero: buttonValue = value; num.setText(buttonValue); System.out.println("Button Value" + buttonValue); case R.id.number_one: buttonValue = value; num.setText(buttonValue); System.out.println("Button Value" + buttonValue); case R.id.number_two: buttonValue = value; num.setText(buttonValue); System.out.println("Button Value" + buttonValue); case R.id.number_three: buttonValue = value; num.setText(buttonValue); System.out.println("Button Value" + buttonValue); } System.out.println("Check changed listener called"); } }); for (int i = 0; i &lt; radioGroup.getChildCount(); ++i) { View nextChild = radioGroup.getChildAt(i); if (!(nextChild instanceof ToggleButton)) { continue; } if (nextChild.getId() != clickedButton.getId() || !clickedButton.isChecked()) { ToggleButton tb2 = (ToggleButton) nextChild; tb2.setChecked(false); } } } }; } Calling using: zero.setOnClickListener(createClickListener(0)); one.setOnClickListener(createClickListener(1)); two.setOnClickListener(createClickListener(2)); three.setOnClickListener(createClickListener(3)) EDIT: For some reason, the text is not being set to the TextView of num. I changed above fro…
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/42081386
tagged with: java
has comment: http://stackoverflow.com/comment/42075415
has comment: http://stackoverflow.com/comment/42072914
has comment: http://stackoverflow.com/comment/42071023
type: Question
has comment: http://stackoverflow.com/comment/42071406
has comment: http://stackoverflow.com/comment/42082836
has comment: http://stackoverflow.com/comment/42102707
has comment: http://stackoverflow.com/comment/42075924
has comment: http://stackoverflow.com/comment/42072111
has comment: http://stackoverflow.com/comment/42073471
upvote count: 2
has comment: http://stackoverflow.com/comment/42083573
tagged with: android-radiogroup
tagged with: android-togglebutton
favorite count: 0

http://stackoverflow.com/q/26806249
has answer: http://stackoverflow.com/a/26810479
has answer: http://stackoverflow.com/a/43344106
tagged with: multicast
type: UnansweredQuestion
tagged with: ip
type: Question
has comment: http://stackoverflow.com/comment/42185532
tagged with: java
score: -1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42185679
has answer: http://stackoverflow.com/a/26809780
has body: I'm working on a project that is designed to be portable across random systems, and have a "server" type program hosted on one computer using ServerSocket, and another "client" program on another computer connecting to that "server" on the same network, using socket. I would like the client to always figure out where the server is on the network, without having to use a multicast system or a hosted system elsewhere, making it all local. I was under the impression that I am able to host the ServerSocket on a specific IP address, and I tried that here: try { InetAddress addr = InetAddress.getByName("192.168.859.672"); serverSocket = new ServerSocket(Integer.parseInt("9532"), 50, addr); } catch (Exception e) { e.printStackTrace(); } But that returns the error java.net.UnknownHostException: 192.168.859.672 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293) at java.net.InetAddress.getAllByName0(InetAddress.java:1246) at java.net.InetAddress.getAllByName(InetAddress.java:1162) at java.net.InetAddress.getAllByName(InetAddress.java:1098) at java.net.InetAddress.getByName(InetAddress.java:1048) at com.pulsepanda.dragon.core.Connection.startServer(Connection.java:30) at com.pulsepanda.dragon.core.Connection.&lt;init&gt;(Connection.java:25) at com.pulsepanda.dragon.core.Run.main(Run.java:5) If this is a way to have it work, having the ServerSocket hosted on a specific IP address, what am I doing wrong? If this is not a valid way of doing things, I have two questions: What is a way I can do this purely locally, without a multicast system, and 2) what is what I'm doing actually used for? Thank you!
has answer: http://stackoverflow.com/a/26809249
tagged with: sockets
answer count: 4
has comment: http://stackoverflow.com/comment/42185702
has title: Hosting a ServerSocket on a specific IP Address
upvote count: 0

http://stackoverflow.com/a/26758036
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42098968
has comment: http://stackoverflow.com/comment/42098266
has body: "webdriver.chrome.driver" and "webdriver.ie.driver" rather refer to standalone apps that you can download at https://code.google.com/p/selenium/wiki/ChromeDriver and https://code.google.com/p/selenium/wiki/InternetExplorerDriver Safari and Firefox don't require this, so they are running out-of-the-box. You might also need a path to your chrome binary, something like this chromeOptions.setBinary(new File("THE PATH TO YOUR CHRMOE BINARY"));
has comment: http://stackoverflow.com/comment/42098186
downvote count: 0
answers question: http://stackoverflow.com/q/26757506

http://stackoverflow.com/q/26817414
possible better answer: http://stackoverflow.com/a/26817454
tagged with: android-studio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26817482
accepted answer: http://stackoverflow.com/a/26817482
tagged with: java
has body: In my program the user will introduce a string(String A) and I want an Array(AA[]) of Strings to get every single letter of the String A. But it says that the Array import java.util.Scanner; public class arrays{ public static void main(String[] args){ String A,B,AA[]; int a,cX,cY,cc,c; Scanner scanner=new Scanner(System.in); System.out.println("Introduce your text"); A=scanner.nextLine(); a=A.length(); cX=0; cY=cX+1; cc=0; for(c=0;c==a;c++){ B=A.substring(cX,cY); AA[cc]=B; cc+=cc; cX+=cX; cY+=cY; } } } It says(The error), that the variable AA might no have been initialized. What I want is to make the Array to have all the letters from the String A... UPDATED: import java.util.Scanner; public class arrays{ public static void main(String[] args){ String A,B,AA[]; int a,cX,cY,cc,c; Scanner scanner=new Scanner(System.in); System.out.println("Introduce your text"); A=scanner.nextLine(); a=A.length(); cX=0; cY=cX+1; cc=0; AA = new String[a]; for(c=0;c==a;c++){ B=A.substring(cX,cY); AA[cc]=B; cc+=cc; cX+=cX; cY+=cY; } System.out.println(AA[2]); } } Now when I print it out, it says null.
has title: How to make an Array of Strings with no values yet
has answer: http://stackoverflow.com/a/26817454
type: Question
tagged with: string
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26817578

http://stackoverflow.com/comment/42222877
comment on: http://stackoverflow.com/q/26827480
type: QuestionComment
score: 0
has text: I believe I have a problem in communication. Seed changes with every usage. After some use it becomes the number it was when the Random is constructed and starts repeating the sequence from that point. If I set the seed manually once in a while with system clock sequence, it would never repeat. But does the Random class do it itself? The question linked does not answer my question.
type: Comment

http://stackoverflow.com/a/26702275
downvote count: 0
answers question: http://stackoverflow.com/q/26701727
has body: I believe this should do the trick. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; public class MainFrame extends JFrame { public static void main(String[] args) { MainFrame frame = new MainFrame(); JPanel centerWrapper = new JPanel(); JPanel center = new JPanel(); center.setBackground(Color.BLUE); JPanel right = new JPanel(); right.setBackground(Color.CYAN); right.setPreferredSize(new Dimension(200, 10)); centerWrapper.setLayout(new BorderLayout()); centerWrapper.add(center, BorderLayout.CENTER); centerWrapper.add(right, BorderLayout.EAST); JPanel bottom = new JPanel(); bottom.setPreferredSize(new Dimension(640, 200)); bottom.setBackground(Color.GREEN); frame.setLayout(new BorderLayout()); frame.add(centerWrapper, BorderLayout.CENTER); frame.add(bottom, BorderLayout.SOUTH); // you can now use center, right and bottom frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(640, 480); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26701727
type: AcceptedAnswer

http://stackoverflow.com/a/26684863
has body: for(int i = 0; i &lt; tokens.length; i++) State parent = new State(false,0,0,null); You cannot have initialization inside for loop without braces. It counts as local variable declaration and is not allowed in Java loops. This is to prevent you from using references which are valid only during object initialization. After iterating over the loop, references to the object created in previous iteration would be lost so garbage collector would soon destroy this objects. This, hovewer, should work (but it is a bad practice and probably won't do what you expect from it): for(int i = 0; i &lt; tokens.length; i++) { State parent = new State(false,0,0,null); } Joshua Bloch in his book Java Puzzlers provides an excellent explanation: A local variable declaration looks like a statement but technically speaking is not; it is a local variable declaration statement [JLS 14.4]. The syntax of the language does not allow a local variable declaration statement as the statement repeated by a for, while, or do loop [JLS 14.12-14]. A local variable declaration can appear only as a statement directly within a block. (A block is a pair of curly braces and the statements and declarations contained within it.)
upvote count: 2
answers question: http://stackoverflow.com/q/26684830
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26684830
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/26750587
answers question: http://stackoverflow.com/q/26705580
score: 0
type: AcceptedAnswer
has body: I figured out my problem. I added an import for the Comparable method. I also changed it to add a line between the output. package student.scores; import java.util.Scanner; import java.util.Comparator; import java.util.ArrayList; import java.util.*; import student.scores.StudentScores.Student.StudentScoreComparator; public class StudentScores{ public static void main(String[] args) { System.out.println("Welcome to the Student Scores Application."); Scanner input = new Scanner (System.in); System.out.println("Enter number of students: "); int numStudents = input.nextInt(); List&lt;Student&gt; students = new ArrayList&lt;&gt;(); int counter = 1; for(int i = 0; i &lt; numStudents; i++) { int studentNum = counter++; System.out.println("\nStudent " + studentNum); System.out.println("Enter Student Last Name: "); String lastName = input.next(); System.out.println("Enter Student First Name: "); String firstName = input.next(); System.out.println("Enter Student Score: "); int score = input.nextInt(); students.add(new Student(lastName, firstName, score)); } Collections.sort(students); System.out.println("Students in alphabetical order: "); for (Student s : students) { System.out.println(s); } System.out.println(); Collections.sort(students, new StudentScoreComparator()); System.out.println("Students by score:"); for (Student s : students) { System.out.println(s); } } static class Student implements Comparable&lt;Student&gt; { private String lastName; private String firstName; private int scores; public Student (String lastName, String firstName, int score) { this.lastName = lastName; this.firstName = firstName; this.scores = score; } public int getScores() { return scores; } public String getLastName() { return lastName; } public String getFirstName() { return firstName; } @Override public int compareTo(Student s) { if (s.lastName.equals(lastName)) { return firstName.compareToIgnoreCase(s.firstName); } return lastName.compareToIgnoreCase(s.lastName); } static class StudentSco…
type: Answer
accepted answer of: http://stackoverflow.com/q/26705580

http://stackoverflow.com/comment/42137040
score: 0
comment on: http://stackoverflow.com/q/26772676
type: Comment
has text: @OO7 I'm using the annotations: https://gist.github.com/imduffy15/3b270c062a9fe18d57d7
type: QuestionComment

http://stackoverflow.com/comment/42152399
type: Comment
type: QuestionComment
has text: It's that way because the designers of each language choose to design them that way. What else are you expecting to hear? You'd have to ask the designers of the language why they choose to make any particular design decision. We can't know why they choose what they did.
score: 4
comment on: http://stackoverflow.com/q/26788016

http://stackoverflow.com/comment/42172239
has text: Wow thank you, all of you and sorry for my noobish conduct. I almost got it, but I don't know how to use it with the finish button and to implement the new text, i made this, but I think its wrong: if (i == 1 ) { //Your 2 Image testanzeige.setImageResource(R.drawable.visustest); startActivityForResult( setResult(position), MainActivity.class); } e
type: AnswerComment
comment on: http://stackoverflow.com/a/26797539
score: 0
type: Comment

http://stackoverflow.com/comment/41971945
type: Comment
comment on: http://stackoverflow.com/q/26683732
score: 0
has text: Ask a new question about each specific problem. Edits that change question meaning are discouraged.
type: QuestionComment

http://stackoverflow.com/comment/42019314
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26714445
has text: You don't have to compile it, but you could try to parse it. If it's parsable I guess it's safe to assume that you're dealing with Java source file.

http://stackoverflow.com/a/26789548
has comment: http://stackoverflow.com/comment/42161314
has comment: http://stackoverflow.com/comment/42161354
score: 0
type: AcceptedAnswer
has body: It is impossible for access to a linked list to take less than O(n). You will need to traverse through the array to access indivividual elements. There are faster ways to access individual elements, but that would require changing your data structure. The easiest data structure that I can think of would be an array. But then your insert and remove would be O(n). So, in choosing your data structure, the question becomes what will you be doing more of insert and remove, or get?
accepted answer of: http://stackoverflow.com/q/26789009
answers question: http://stackoverflow.com/q/26789009
type: Answer

http://stackoverflow.com/comment/42151683
type: QuestionComment
comment on: http://stackoverflow.com/q/26787650
has text: where do you call `getValueOfFields()` ?
score: 0
type: Comment

http://stackoverflow.com/comment/42037846
type: Comment
comment on: http://stackoverflow.com/a/26724017
score: 2
type: AnswerComment
has text: @Hannes Note that you can also wrap your expression in curly brackets and do even more initialization if you need/want.

http://stackoverflow.com/comment/42055393
comment on: http://stackoverflow.com/q/26734389
type: Comment
type: QuestionComment
has text: you should save your downloaded file in Hangman.java
score: 3

storage
tag name: storage
tags question: http://stackoverflow.com/q/26728684
tags question: http://stackoverflow.com/q/26730909
tags question: http://stackoverflow.com/q/26758185
type: Tag

http://stackoverflow.com/a/26705664
has body: I see three options. Option 1 - create an ArrayList or array yourself Pros: Fast and easy to do Cons: Easy to get out of date Option 2 - Use reflection Pros: It will always be up to date Cons: Slower to run (highly unlikely to be a problem if you only do it once), harder to read the code Option 3 - Read the file as a string Pros: It will also be up to date. Cons: Gives you strings, but not Java references. I sometimes use this approach when writing unit tests (for example to confirm I didn't forget to add something manually using approach #1)
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/42018155
answers question: http://stackoverflow.com/q/26705531
type: Answer
score: 2

http://stackoverflow.com/comment/42192672
type: QuestionComment
has text: If it takes a `double` rather than a `Double`, you can use `double.class`. (Note capitalization)
score: 1
comment on: http://stackoverflow.com/q/26810020
type: Comment

http://stackoverflow.com/a/26694323
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26694322
answers question: http://stackoverflow.com/q/26694322
upvote count: 1
type: Answer
downvote count: 0
has body: Scanner n = new Scanner(new File("C:\\Users\\omar\\Documents\\NetBeansProjects\\omar\\src\\omar.in")); This is where the file is located in your computer. That won't help you at all when running the program on a Judge's computer. You need to open the file from where the contest's instruction said it would be.
score: 1

http://stackoverflow.com/a/26772930
type: Answer
has body: You have started the animation always at the zero position, change the animation like this: timeline.getKeyFrames().addAll( new KeyFrame(Duration.ZERO, new KeyValue(myRectangle.translateXProperty(), myRectangle.getTranslateX()), new KeyValue(myRectangle.translateYProperty(), 0) ), .... EDIT: Incorporating the comment, all you need is timeline.getKeyFrames().add( new KeyFrame(new Duration(1000), new KeyValue(myRectangle.translateXProperty(), event.getX()) ) );
has comment: http://stackoverflow.com/comment/42145948
accepted answer of: http://stackoverflow.com/q/26771972
answers question: http://stackoverflow.com/q/26771972
has comment: http://stackoverflow.com/comment/42137191
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/26780108
tagged with: crosswalk-runtime
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: android
favorite count: 0
tagged with: cordova
type: Question
upvote count: 2
has body: From this Reference WebChromeClient has method onConsoleMessage() that I want to override: My application used Cordova framework and my class is inherited from CordovaChromeClient. So far so good until I migrated to Crosswalk framework. In basic words I replaced Cordova with Cordova provided by Crosswalk. Crosswalk also has class CordovaChromeClient but it doesn't have onConsoleMessage(). My goal is to catch JavaScript errors and send report but with Crosswalk I have no clue how to get info what client prints with console.log(/* */) From XWalkUIClient.JavascriptMessageType: I have so far only following options: XWalkUIClient.JavascriptMessageType JAVASCRIPT_ALERT JavaScript alert dialog. XWalkUIClient.JavascriptMessageType JAVASCRIPT_BEFOREUNLOAD JavaScript dialog for a window-before-unload notification. XWalkUIClient.JavascriptMessageType JAVASCRIPT_CONFIRM JavaScript confirm dialog. XWalkUIClient.JavascriptMessageType JAVASCRIPT_PROMPT JavaScript prompt dialog. Any ideas? I use crosswalk-cordova-8.37.189.12-arm
tagged with: java
has title: Crosswalk Cordova class CordovaChromeClient doesn't have method "onConsoleMessage"

http://stackoverflow.com/q/26808126
has answer: http://stackoverflow.com/a/26808391
linked to: http://stackoverflow.com/q/4319537
has answer: http://stackoverflow.com/a/26808179
type: Question
has answer: http://stackoverflow.com/a/26809012
downvote count: 0
has title: Why does boolean change value in method in java
answer count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/42189368
has comment: http://stackoverflow.com/comment/42190661
accepted answer: http://stackoverflow.com/a/26808391
has answer: http://stackoverflow.com/a/26808171
upvote count: 1
has comment: http://stackoverflow.com/comment/42190572
has answer: http://stackoverflow.com/a/26808205
type: AnsweredQuestion
has body: I would like to know why if I set eq = false in the secondPart method then change it to true in the removeAccess method(for the System.out.println shows that eq = true) but then back in the secondPart() the System.out.println shows that eq = false? public void secondPart(){ boolean eq = false; removeAccess(copy,d,eq); System.out.println(eq); } private void removeAccess(List&lt;Integer&gt; copy, Integer letterNum,boolean eq){ for(int i =0; i&lt;copy.size(); i++){ System.out.println("LetterNum:" + letterNum); System.out.println("Copy:" + copy.get(i)); if(letterNum == copy.get(i)){ copy.remove(letterNum); eq = true; break; } else{ eq = false; } } System.out.println("Eq:" + eq); }
score: 1
has answer: http://stackoverflow.com/a/26808438
tagged with: java
has comment: http://stackoverflow.com/comment/42189116
possible better answer: http://stackoverflow.com/a/26808179

http://stackoverflow.com/q/26756069
has comment: http://stackoverflow.com/comment/42094451
favorite count: 0
has comment: http://stackoverflow.com/comment/42094952
has body: I'm trying to call the testResultDTO constructor with a boolean parameter but keep geting an error TestResultDTO : public class TestResultDTO extends AbstractDTO { private Boolean test; private Boolean locked; public TestResultDTO() { super(); } public TestResultDTO(Boolean locked, Boolean test) { super(); this.test = test; this.locked = locked; } the query: SELECT NEW com.xxx.model.dto.widgets.results.TestResultDTO(p.isLocked, IF((p.playerStatus = 'STANDARD'), false, true)) From player p Where p.id = 1 the error: java.lang.NullPointerException at org.hibernate.internal.util.ReflectHelper.getConstructor(ReflectHelper.java:355) Is there a way to pass a boolean parameter hard coded ('true')??
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/26756602
accepted answer: http://stackoverflow.com/a/26756602
has comment: http://stackoverflow.com/comment/42095681
has title: HQL- Select new constructor with boolean parameters
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/42094840
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42145409
type: Comment
type: QuestionComment
has text: what did you try, and what were the errors shown?
score: 1
comment on: http://stackoverflow.com/q/26784291

http://stackoverflow.com/q/26743193
type: Question
has body: I am trying to create a simple JOGL program, and have run into a problem. I just imported all of the necessary packages into my class file, however now, every time I use the glTranslate function, it is being flagged red as an error, for example at the end of this block of code. public void lab2a(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glTranslatef(-1.0f, -1.0f, -6f); // Drawing first rectangle (blue) gl.glBegin(GL.GL_QUADS); gl.glColor3f(0f, 0f, 1f); // sets color to blue gl.glVertex3f(-0.5f, 0.5f, 0.0f); //Top left vertice gl.glVertex3f(0.5f, 0.5f, 0.0f); //Top right vertice gl.glVertex3f(-0.5f, -0.5f, 0.0f); //Bottom left vertice gl.glVertex3f(0.5f, -0.5f, 0.0f); //Bottom right vertice gl.glEnd(); gl.glTranslate(1.1f, 0f, 0f); The flag reads: "cannot find symbol", and is present for each use of glTranslate I use. Does anybody have any idea how to fix this?
has answer: http://stackoverflow.com/a/26767791
score: 0
has title: glTranslate error in simple JOGL program
answer count: 1
has comment: http://stackoverflow.com/comment/42072490
tagged with: jogl
type: UnansweredQuestion
tagged with: opengl
tagged with: java

http://stackoverflow.com/a/26834421
answers question: http://stackoverflow.com/q/26832235
accepted answer of: http://stackoverflow.com/q/26832235
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42346052
has comment: http://stackoverflow.com/comment/42352494
upvote count: 1
type: AcceptedAnswer
has body: Those limitations apply to JPA 1.0 for Datastore. Cloud SQL is using native MySQL driver in App Engine so JPA should work properly (there are examples for EclipseLink, DataNucleus and Hibernate).
type: Answer

http://stackoverflow.com/comment/41986995
type: Comment
has text: Yes I do. I'm putting current in my for each loop?
score: 0
comment on: http://stackoverflow.com/a/26695971
type: AnswerComment

http://stackoverflow.com/comment/42179815
comment on: http://stackoverflow.com/q/26802620
score: 0
type: Comment
has text: Why are other people's comments disappearing from this page?
type: QuestionComment

http://stackoverflow.com/comment/42104874
has text: Can you show me INSERT statement? try use SQLException?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26761436

http://stackoverflow.com/q/26729105
has comment: http://stackoverflow.com/comment/42046490
has title: ArrayList's containsAll returning wrong value
downvote count: 0
has comment: http://stackoverflow.com/comment/42047913
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/42047520
has answer: http://stackoverflow.com/a/26738279
accepted answer: http://stackoverflow.com/a/26730364
has answer: http://stackoverflow.com/a/26732020
has comment: http://stackoverflow.com/comment/42046320
tagged with: android
answer count: 4
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/42046318
has body: Let's say: a = ["s", "i", "n", "e", "d"]; b = ["s", "e", "n", "d"]; (a and b are of type List&lt;String&gt;) How can I determine if all the letters in b are contained in a? -- not necessarily in order (In this case, it's true since [s,e,n,d] is in a and b) Using a.containsAll(b) does not always work! Another example: a=["b", "a", "z", "z", "z"] b=["a", "a", "b", "b"] Here I want the result to be false since [a,a,b,b] does not appear in any sort of order in a, but using a.containsAll(b) will return true!
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26729164
has answer: http://stackoverflow.com/a/26730364
has comment: http://stackoverflow.com/comment/42046559
possible better answer: http://stackoverflow.com/a/26729164
has comment: http://stackoverflow.com/comment/42046377

http://stackoverflow.com/a/26795769
has comment: http://stackoverflow.com/comment/42169130
downvote count: 0
has comment: http://stackoverflow.com/comment/42166328
has body: I copied an image into the same working directory from where the program was executed and using the following HTML... This is a h1 And code... import java.awt.EventQueue; import java.io.File; import java.net.URL; import java.util.Dictionary; import java.util.Hashtable; import javax.imageio.ImageIO; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestEditor { public static void main(String[] args) { new TestEditor(); } public TestEditor() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JEditorPane editor = new JEditorPane(); try { editor.setPage(new File("testPage.html").toURI().toURL()); } catch (Exception exp) { exp.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(editor)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } Was able to get it to run without problems... Put the image in the relative location from the program execution context (".")
has comment: http://stackoverflow.com/comment/42166312
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26795483
upvote count: 1
has comment: http://stackoverflow.com/comment/42169097

http://stackoverflow.com/comment/41990361
type: Comment
has text: The limit of 16,383 is only for standard connections, for `type=fastload` the limit is JVM memory. I added a link to a short article on Teradata's developer exchange.
comment on: http://stackoverflow.com/a/26691385
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41986146
type: Comment
type: QuestionComment
score: 0
has text: @peeskillet *"I've seen it used before for swing"* Yep, just as I was looking down the list of questions of that tag, it seemed to have many entries involving Java. Don't know in that case if it is better to edit the tag description to mention Java as well, or go through the list and bulk edit it out for questions tagged Java. In fact, even typing that was so tiring that I don't even think I'll bother to 'take it to Meta' to find out which is considered better. ;)
comment on: http://stackoverflow.com/q/26694426

http://stackoverflow.com/a/26770169
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42121571
has comment: http://stackoverflow.com/comment/42121657
type: Answer
has comment: http://stackoverflow.com/comment/42121833
answers question: http://stackoverflow.com/q/26770030
accepted answer of: http://stackoverflow.com/q/26770030
has body: You're trying to override a method within a method. Not only is this illegal in Java, it's not how painting in Swing is done. You've not provided a return type of the paintComponent method When calling a method, you don't need to declare the parameter type super.paintComponent(Graphics g);, just pass the instance of the right type of object to it, super.paintComponent(g); Don't mix console based input with GUI input. GUI's run in an event driven environment, this makes them non-linear in nature and makes it difficult to collect information from the user at the command line while the UI is running. Before you go any further, take a look at: Creating a GUI With JFC/Swing Painting in AWT and Swing Performing Custom Painting Reading/Loading an Image Inheritance How to Use Labels (which would be easier then custom painting the images) Take this... public paintComponent(Graphics g){ error here(paintComponent cannot be resolved to a variable)(Illegal modifier for 'g') super.paintComponent(Graphics g); and error here (cannot use super)(Graphics cannot be resokved to a variable) g.drawImage(image, 0, 0, 100, 100, null);} Out of your for-loop and make it a method of your Core class... @Override public void paintComponent(Graphics g) { // ^--- Need this... super.paintComponent(g); // ^--- Don't need Graphics, just an instance of it... } main is NOT a class, it is a method, a method of Core ;) For example... public class Core extends JPanel{ public static void main(String[] args){ //.. pane.setLayout(new GridLayout(number, number)); for(int j = 1; j &lt;= number; j++){ Color backColor = Color.white; Image image = new ImageIcon((images.get(j)) + ".jpg").getImage(); // This be bad... //public paintComponent(Graphics g){//error here(paintComponent cannot be resolved to a variable)(Illegal modifier for 'g') // super.paintComponent(Graphics g);//and error here (cannot use super)(Graphics cannot be resokved to a variable) // //g.drawImage(image, 0, 0, 100, 100, null);} ColorPanel pan…
has comment: http://stackoverflow.com/comment/42121141
has comment: http://stackoverflow.com/comment/42121784
has comment: http://stackoverflow.com/comment/42121425
upvote count: 5
has comment: http://stackoverflow.com/comment/42121632

http://stackoverflow.com/comment/42219273
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26825342
has text: Can you print your list.

http://stackoverflow.com/comment/42213887
score: 0
comment on: http://stackoverflow.com/q/26822178
type: QuestionComment
type: Comment
has text: Please MouseListener is not my problem on this case. The problem is to make the method call right. Thank you!

http://stackoverflow.com/q/26710368
type: UnansweredQuestion
type: Question
has title: List of Camel DSL commands
tagged with: java
tagged with: apache-camel
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26752174
has body: I am working on camel and new to that technology as well. i pretty much understand the concepts, but i couldnt find a place where I can get the list of DSL commands(both JAVA &amp; Spring) and their functionalities. Also is it possible to create user defined DSL that we can use?
tagged with: dsl

http://stackoverflow.com/q/26687256
has answer: http://stackoverflow.com/a/26687374
has body: Layout &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#e6e6e6"&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/headerbar" android:padding="10dip" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_centerVertical="true" android:src="@drawable/logo" /&gt; &lt;TextView android:id="@+id/textViewtest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/imageView1" android:layout_alignParentRight="true" android:layout_marginRight="18dp" android:text="@string/appsetting" android:background="@drawable/pinkbuttonbackground" android:layout_centerVertical="true" android:padding="5dp" android:textAppearance="@dimen/textfontsize" /&gt; &lt;/RelativeLayout&gt; &lt;Button android:id="@+id/item_buttonId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/okButton" android:textColor="#ffffff" android:background="#be0054" android:textStyle="bold" /&gt; &lt;AutoCompleteTextView android:id="@+id/item_autoComplete" android:layout_width="150dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1" android:textCursorDrawable="@null" android:background="@drawable/background_textfield" android:singleLine="true" android:paddingLeft="2dp" android:textColor="#000000" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layou…
type: Question
has comment: http://stackoverflow.com/comment/41972122
has comment: http://stackoverflow.com/comment/41972177
score: 0
has comment: http://stackoverflow.com/comment/41972132
answer count: 1
has comment: http://stackoverflow.com/comment/41972113
has comment: http://stackoverflow.com/comment/41972161
tagged with: android
accepted answer: http://stackoverflow.com/a/26687374
type: AnsweredQuestion
has title: application crash when I used layout_toRightOf in android
tagged with: java

http://stackoverflow.com/q/26743762
favorite count: 0
has body: I am trying to reverse the contents of the file by each word. I have the program running fine, but the output i am getting is something like this 1 dwp 2 seviG 3 eht 4 tnerruc 5 gnikdrow 6 yrotcerid 7 ridkm 8 desU 9 ot 10 etaerc I want the output to be something like this dwp seviG eht tnerruc gnikdrow yrotcerid ridkm desU ot etaerc The code i am working with import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.util.*; public class Reproduce { public static int temp =0; public static class ReproduceMap extends MapReduceBase implements Mapper&lt;LongWritable, Text, IntWritable, Text&gt;{ private Text word = new Text(); @Override public void map(LongWritable arg0, Text value, OutputCollector&lt;IntWritable, Text&gt; output, Reporter reporter) throws IOException { String line = value.toString().concat("\n"); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(new StringBuffer(tokenizer.nextToken()).reverse().toString()); temp++; output.collect(new IntWritable(temp),word); } } } public static class ReproduceReduce extends MapReduceBase implements Reducer&lt;IntWritable, Text, IntWritable, Text&gt;{ @Override public void reduce(IntWritable arg0, Iterator&lt;Text&gt; arg1, OutputCollector&lt;IntWritable, Text&gt; arg2, Reporter arg3) throws IOException { String word = arg1.next().toString(); Text word1 = new Text(); word1.set(word); arg2.collect(arg0, word1); } } public static void main(String[] args) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setJobName("wordcount"); conf.setOutputKeyClass(IntWritable.class); conf.setOutputValueClass(Text.class); conf.setMapperClass(ReproduceMap.class); conf.setReducerClass(ReproduceReduce.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths…
answer count: 5
has answer: http://stackoverflow.com/a/27677496
has answer: http://stackoverflow.com/a/27676317
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
downvote count: 1
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/31340651
possible better answer: http://stackoverflow.com/a/27676317
has title: How to format the output being written by Mapreduce in Hadoop
upvote count: 3
has answer: http://stackoverflow.com/a/31340651
has answer: http://stackoverflow.com/a/26751710
has answer: http://stackoverflow.com/a/26751096

http://stackoverflow.com/q/26730137
type: Question
has answer: http://stackoverflow.com/a/26730597
has comment: http://stackoverflow.com/comment/42048032
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42048598
accepted answer: http://stackoverflow.com/a/26730597
tagged with: http://stackoverflow.com/tag/xlsx
has comment: http://stackoverflow.com/comment/42048786
favorite count: 0
has comment: http://stackoverflow.com/comment/42048713
tagged with: apache-poi
has body: I am trying to read xlsx file. I am using poi 3.10-FINAL. My code is FileInputStream fs = new FileInputStream("abc.xlsx"); XSSFWorkbook wb = new XSSFWorkbook(fs); row_count = 0; for (int k = 0; k &lt; wb.getNumberOfSheets(); k++) { XSSFSheet sheet = wb.getSheetAt(k); if (sheet.getLastRowNum() &gt; 0) { Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); // throws ConcurrentModificationException if (row_count == 0) { col_count = row.getLastCellNum(); //Do something } else { if (row.getCell(1).equals("XYZ")) { sheet.removeRow(row); //throws XmlValueDisconnectedException } } row_count++; } } } When I execute my code without sheet.removeRow(row), it works fine. But when I add removeRow call it throws XmlValueDisconnectedException exception. Can any one please help me why I am getting this exception. Update: I am quite surprised but now I am getting ConcurrentModificationException exception. Once it executes removeRow() and then when it returns to rowIterator.next() it throws the exception. I have mentioned location of exception in the code. The stack trace is java.util.ConcurrentModificationException at java.util.TreeMap$PrivateEntryIterator.nextEntry(Unknown Source) at java.util.TreeMap$ValueIterator.next(Unknown Source) at com.test.app.services.ExecuteImport.uploadFile(ExecuteImport.java:144) at com.test.app.controller.MyController.upload(MyController.java:271) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) Thanks.
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: XSSFSheet removeRow(row) method throws ConcurrentModificationException
linked to: http://stackoverflow.com/q/24927438

http://stackoverflow.com/comment/41948051
type: QuestionComment
has text: you are only reading file but you haven't write edited content back to file
score: 1
comment on: http://stackoverflow.com/q/26674192
type: Comment

http://stackoverflow.com/q/26736448
upvote count: 0
has answer: http://stackoverflow.com/a/26736522
favorite count: 0
type: UnansweredQuestion
has title: How to stop JOptionPane from choosing last case?
tagged with: loops
downvote count: 1
tagged with: switch-statement
tagged with: case
has answer: http://stackoverflow.com/a/26736551
tagged with: java
score: -1
type: Question
has body: so here is my case to make a long code short. Let's say, we have a JOptionPane with 3 buttons. boolean loopGameInterface = true; while(loopGameInterface){ int chooseGame = JOptionePane........ switch(chooseGame) { case 0: case 1: case 2: System.exit(0); } } So the problem is, when I click (example) second button, it goes to case 1. That's fine. But when the code inside case 1 is executed, it goes directly to case 2 and exit my program, instead of just looping the gameInterface?
has answer: http://stackoverflow.com/a/26736461
answer count: 3

http://stackoverflow.com/comment/42155318
comment on: http://stackoverflow.com/a/26782845
has text: what is supposed to be this? // **Loop through this group then for each child, set your listener for (...){ child=group.getChildAt(i); child.setOnClickListener(createClickListener(i)); }. What goes inside for statement?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42230377
score: 0
type: QuestionComment
has text: Yes, I do all the ui update on EDT. panels is a private member, and both methods are from the same class panels belongs to. The IDE says nothing, there's no exception or errors at all, it's just on the application behavior. I just tried changing to this.panels and doesnt work...
type: Comment
comment on: http://stackoverflow.com/q/26831569

http://stackoverflow.com/a/26812938
has comment: http://stackoverflow.com/comment/42201854
score: 0
accepted answer of: http://stackoverflow.com/q/26812865
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26812865
has comment: http://stackoverflow.com/comment/42197914
type: Answer
has body: The following code prints the triangle, assuming the user enters 10 for (int i = 0; i &lt; 10; i++){ for (int j = 0;j &lt; i;j++ ) System.out.print('x'); System.out.println(); } for (int i = 10; i &gt; 0; i--){ for (int j = 0; j &lt; i;j++) System.out.print('x'); System.out.println(); } In your code, you exclude the second for loop in which i is decremented.

http://stackoverflow.com/comment/42054345
type: AnswerComment
comment on: http://stackoverflow.com/a/26733758
type: Comment
has text: It could be the solution but you should suggest what was the mistake and the possible solution!
score: 1

http://stackoverflow.com/comment/42216369
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26823484
has text: possible duplicate of [What is the regex to extract all the emojis from a string?](http://stackoverflow.com/questions/24840667/what-is-the-regex-to-extract-all-the-emojis-from-a-string)
score: 0

http://stackoverflow.com/comment/42128470
has text: This would require about 16 Petabyte = around 16,400 Exabyte = 16,700,000 Terabyte = 17,200,000,000 Gigabyte. This number cannot even be displayed in (signed) 64-bit integers!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26774698
score: 0

http://stackoverflow.com/comment/42070402
comment on: http://stackoverflow.com/q/26742014
type: QuestionComment
has text: Thanks neo, I actually tried that one too by very slowly debugging the code with eclipse. Still not sure why the css selector is not working.
type: Comment
score: 0

http://stackoverflow.com/q/26828821
type: Question
has comment: http://stackoverflow.com/comment/42225057
tagged with: java
has comment: http://stackoverflow.com/comment/42225103
answer count: 1
has body: I am currently trying to get onLongClick on each item of my listview but android studio will not recognise super.onCreateContextMenu(menu, v, menuInfo); and super.onContextItemSelected(item);. When I take these out noting works at all. Inside onCreate I have registerForContextMenu(getListView()); Then below this function I have the following functions public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(mAdapter.getItem(info.position).toString()); menu.add(Menu.NONE, CONTEXT_MENU_DELETE, CONTEXT_MENU_DELETE, R.string.del_item); } public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CONTEXT_MENU_DELETE: mAdapter.remove(info.position); return true; default: return super.onContextItemSelected(item); } return true; }
score: 0
tagged with: android
tagged with: android-studio
has title: Getting OnLongClick to work in ListView Android Studio
has answer: http://stackoverflow.com/a/26828967
has comment: http://stackoverflow.com/comment/42225000
type: UnansweredQuestion

http://stackoverflow.com/comment/45630779
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26722528
has text: sorry if I am too late to the party but what I have noticed when having this problem today is that sonar actually highlights the line that would cause the first NPE not the line where you are doing the redundant null check. In my case the redundant null check was further down the code.
score: 4

http://stackoverflow.com/q/26718580
has answer: http://stackoverflow.com/a/26718589
possible better answer: http://stackoverflow.com/a/26719252
tagged with: for-loop
upvote count: 1
has answer: http://stackoverflow.com/a/26718621
downvote count: 1
accepted answer: http://stackoverflow.com/a/26718621
favorite count: 0
has answer: http://stackoverflow.com/a/26718587
has comment: http://stackoverflow.com/comment/42027325
has title: Why won't my program run what is in the loop in java?
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: loops
has body: My issue here is that I want it to print all four cities listed, but instead it will only print Toronto. public class Test { public static void main(String[] args) { String[] allowed = new String[] {"New York", "Singapore", "Paris", "Toronto"}; int index; for(index=0; index &lt; allowed.length - 1; index++); { System.out.println(allowed[index]); } } } If I run it without the "- 1" after the allowed.length, I get an out of bounds error. I tried converting it to a while loop as well, and still no luck. What am I missing regarding my loop?
type: Question
has answer: http://stackoverflow.com/a/26719252
score: 0

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/26678963

exception
tags question: http://stackoverflow.com/q/26688938
tags question: http://stackoverflow.com/q/26744338
tags question: http://stackoverflow.com/q/26770936
tags question: http://stackoverflow.com/q/26703324
tags question: http://stackoverflow.com/q/26827562
tags question: http://stackoverflow.com/q/26743131
tags question: http://stackoverflow.com/q/26690297
tags question: http://stackoverflow.com/q/26747828
tags question: http://stackoverflow.com/q/26818694
tags question: http://stackoverflow.com/q/26712836
tags question: http://stackoverflow.com/q/26787122
tags question: http://stackoverflow.com/q/26764752
tags question: http://stackoverflow.com/q/26711486
tags question: http://stackoverflow.com/q/26784036
tags question: http://stackoverflow.com/q/26689505
tags question: http://stackoverflow.com/q/26726980
tags question: http://stackoverflow.com/q/26689937
tags question: http://stackoverflow.com/q/26773042
tags question: http://stackoverflow.com/q/26807684
type: Tag
tags question: http://stackoverflow.com/q/26788263
tags question: http://stackoverflow.com/q/26827015
tags question: http://stackoverflow.com/q/26738169
tags question: http://stackoverflow.com/q/26702752
tags question: http://stackoverflow.com/q/26827244
tags question: http://stackoverflow.com/q/26750704
tags question: http://stackoverflow.com/q/26798023
tags question: http://stackoverflow.com/q/26726788
tags question: http://stackoverflow.com/q/26720795
tags question: http://stackoverflow.com/q/26694264
tags question: http://stackoverflow.com/q/26732199
tags question: http://stackoverflow.com/q/26772793
tags question: http://stackoverflow.com/q/26788912
tags question: http://stackoverflow.com/q/26775965
tags question: http://stackoverflow.com/q/26722639
tags question: http://stackoverflow.com/q/26690803
tags question: http://stackoverflow.com/q/26696569
tags question: http://stackoverflow.com/q/26744789
tags question: http://stackoverflow.com/q/26714908
tags question: http://stackoverflow.com/q/26754062
tags question: http://stackoverflow.com/q/26781990
tags question: http://stackoverflow.com/q/26756471
tags question: http://stackoverflow.com/q/26699739
tags question: http://stackoverflow.com/q/26711830
tags question: http://stackoverflow.com/q/26813616
tags question: http://stackoverflow.com/q/26818570
tags question: http://stackoverflow.com/q/26703824
tags question: http://stackoverflow.com/q/26808018
tag name: exception
tags question: http://stackoverflow.com/q/26752287
tags question: http://stackoverflow.com/q/26708481
tags question: http://stackoverflow.com/q/26720123
tags question: http://stackoverflow.com/q/26829844
tags question: http://stackoverflow.com/q/26815329
tags question: http://stackoverflow.com/q/26714911
tags question: http://stackoverflow.com/q/26823156
tags question: http://stackoverflow.com/q/26814064
tags question: http://stackoverflow.com/q/26822617
tags question: http://stackoverflow.com/q/26769419
tags question: http://stackoverflow.com/q/26724980
tags question: http://stackoverflow.com/q/26704383
tags question: http://stackoverflow.com/q/26720813

http://stackoverflow.com/comment/42177692
score: 0
type: AnswerComment
has text: Thanks for your reply. This is a composition view. The template view that is used has the form, so here what you see is just one part of the entire view. I can asure that there is a form in the final/composite view.
comment on: http://stackoverflow.com/a/26801811
type: Comment

http://stackoverflow.com/a/26760037
answers question: http://stackoverflow.com/q/26759954
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42101373
type: Answer
has body: Actually you'd often want to know if there is a random null in your list when there shouldn't be. Your first snippet will throw an exception indicating the problem, but your second will consume the error silently. You could also do something like this: for (AnyObject anyObject : anyObjectList) { if (anyObject != null) { System.out.println(anyObject.doSomething()); } else { /* something went wrong -- report error, debugging info, etc. */ } }
accepted answer of: http://stackoverflow.com/q/26759954
has comment: http://stackoverflow.com/comment/42101536
has comment: http://stackoverflow.com/comment/42101642
has comment: http://stackoverflow.com/comment/42101719
score: 4
has comment: http://stackoverflow.com/comment/42101345
upvote count: 4

http://stackoverflow.com/comment/42203077
type: Comment
type: QuestionComment
has text: the error mainly talks about a missing class, this class is in a lib jar i think you need to include `apache commons: logging` jar in your class path
score: 1
comment on: http://stackoverflow.com/q/26815942

http://stackoverflow.com/q/26705396
favorite count: 0
has answer: http://stackoverflow.com/a/26705451
accepted answer: http://stackoverflow.com/a/26705451
has comment: http://stackoverflow.com/comment/42003799
has comment: http://stackoverflow.com/comment/67714819
has comment: http://stackoverflow.com/comment/42003760
linked to: http://stackoverflow.com/q/2906958
has title: Calling a method AFTER the last constructor ends
has comment: http://stackoverflow.com/comment/42003779
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42003881
tagged with: constructor
downvote count: 0
has body: I have a question about something that maybe not be possible, but it is worth a try. I have these classes: Class A { private int x = 0; public A() { afterCreate(); } public void afterCreate() { x = 10; } public int getX() { return x; } } Class B extends A { public B() { super(); //Do something afterCreate(); } @Override public void afterCreate() { x = 20; } } Class C extends B { public C() { super(); //Do something afterCreate(); } @Override public void afterCreate() { x = 30; } } As you can see, I need to ALWAYS, automatically call afterCreate() when the constructor ends. But if I just call afterCreate() inside each constuctor, you can see that for an object created from the class C, we will call the method afterCreate() three times (one for each constructor) -- the first two calls being useless. Also, I can't call afterCreate() just in the first constructor, because afterCreate() MUST be executed after the last constructor. Class A { public A() { //Do something afterCreate(); } } Class B extends A { public B() { super(); //Doing something that I missed to process in afterCreate()! } } Class C extends B { public C() { super(); //Doing something that I missed to process in afterCreate()! } } Obviously, I can't call afterCreate() in the constructor of the class C, because if I create objects from class A or B, the method would not be called. Is there a way to ALWAYS, automatically call afterCreate() when the LAST constructor ends? Right now, thinking about the problem, maybe if I can detect that the constructor is called in a super class, I could detect whether I can call the method. Class A { public A() { //Do something if(thisIsNotCalledAsASuperClass()) afterCreate(); } } Class B extends A { public B() { super(); //Do something if(thisIsNotCalledAsASuperClass()) afterCreate(); } } Class C extends B { public C() { super(); //Do something if(thisIsNotCalledAsASuperClass()) afterCreate(); } } //Class D extends C { //etc. I don't know.... What do you think?
type: Question
has comment: http://stackoverflow.com/comment/42003997
score: 1
linked to: http://stackoverflow.com/q/7223435
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/a/26744350
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42080974
accepted answer of: http://stackoverflow.com/q/26743258
answers question: http://stackoverflow.com/q/26743258
downvote count: 0
score: 1
has body: The JSP code seems fine. If the values are not available in the Student object and should be because of the hierarchy, the problem lies in the code that populates the Student objects after the query is done. You might want to validate how a Student object is created and why the fields which belong to the User object are not set.
upvote count: 1

http://stackoverflow.com/comment/41965945
has text: This question appears to be off-topic because it is to broad too be answered here and better answers can be found by reading through the [Creating a GUI With JFC/Swing](http://docs.oracle.com/javase/tutorial/uiswing/) tutorials
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26683630

http://stackoverflow.com/q/26686037
downvote count: 1
type: Question
answer count: 2
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/41969971
favorite count: 0
has comment: http://stackoverflow.com/comment/41970002
has title: Error.java.lang.NumberFormatException
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41969983
has answer: http://stackoverflow.com/a/26686098
tagged with: java
has body: I'm trying to make a recursive program that reads and evaluates fully parenthesized arithmetic expressions. The program was already made, my task is to make the method evaluates recursively. However, I'm having a bit of difficulty doing this. I have gotten much done, but I'm now getting an error - java.lang.NumberFormatException - and I can't seem to figure out why and where it's coming from. Could someone please help me as I have been at this for a week and need some help desperately. Heres my code: package q2; // FILE: EvaluateDemonstration.java // This program reads a reads and evaluates fully parenthesized arithmetic // expressions. The purpose is to illustrate a fundamental use of stacks. import java.util.Scanner; import java.util.regex.Pattern; public class RecursiveEvaluateDemonstration { public static void main(String[ ] args) { Scanner stdin = new Scanner(System.in); String expression; double answer; System.out.println("Please type an arithmetic expression made from"); System.out.println("unsigned numbers and the operations + - * /."); System.out.println("The expression must be fully parenthesized."); do { System.out.print("Your expression: "); expression = stdin.nextLine( ); try { answer = evaluate(expression,0,0,0); System.out.println("The value is " + answer); } catch (Exception e) { System.out.println("Error." + e.toString( ) + " Help"); } } while (query(stdin, "Another string?")); System.out.println("All numbers are interesting."); } public static boolean query(Scanner input, String prompt) { String answer; System.out.print(prompt + " [Y or N]: "); answer = input.nextLine( ).toUpperCase( ); while (!answer.startsWith("Y") &amp;&amp; !answer.startsWith("N")) { System.out.print("Invalid response. Please type Y or N: "); answer = input.nextLine( ).toUpperCase( ); } return answer.startsWith("Y"); } public static double evaluate(String s, int i,int j, int charIndex) // Precondition: The string is a fully parenthesized arithmetic expression // formed from non…
has answer: http://stackoverflow.com/a/26686117

http://stackoverflow.com/a/26723216
has comment: http://stackoverflow.com/comment/42069059
type: Answer
accepted answer of: http://stackoverflow.com/q/26722875
has comment: http://stackoverflow.com/comment/42059735
has comment: http://stackoverflow.com/comment/42060077
answers question: http://stackoverflow.com/q/26722875
has body: In the following line : query.setParameter(1, nombresAmigos); nombresAmigos should be a List&lt;String&gt;, not a Map&lt;String, Amigo&gt;.
score: 0
has comment: http://stackoverflow.com/comment/42069615
has comment: http://stackoverflow.com/comment/42063215
has comment: http://stackoverflow.com/comment/42096593
type: AcceptedAnswer

http://stackoverflow.com/comment/42219210
has text: That is not the list from your `ContactList` object; thats a completely new list. You shouldn't get an error by doing it, although you wont be accessing the values you want, since its not the right list. Your `ContactList` should have an `ArrayList`, with a method to access it (if it's private)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26825139

http://stackoverflow.com/comment/42066904
type: QuestionComment
comment on: http://stackoverflow.com/q/26740362
has text: because if i delete one row then no of rows also decrease by one.it is for multiple rows deletion.
score: 0
type: Comment

http://stackoverflow.com/q/26747220
answer count: 0
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42079531
score: 0
has body: I am trying to develop this application which manages a patients and records list from a hospital using files to store the data. My program reads the patients info from patients.txt, and every patient has his own file as well... if the program doesn't find it, it creates it. Whenever I used JAVA before I relayed on BufferedReaders and the File class to read the files stored in the src folder (or the project folder created by eclipse). With Android this doesn't seem to work... What's the relative path for an app?
has comment: http://stackoverflow.com/comment/42079885
has comment: http://stackoverflow.com/comment/42079566
has title: How to put a file, create a file and read a file from an Android app?
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/42169118
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26790338
type: Comment
has text: Thanks for the reply Jeff. I tried your suggestion and I can see a slight change but essentially I have the same outcome. The weights were updated only once and the error is 2.0: 0,0,0,0.4884507325564466,0.17375282591824576,-0.9245120358699924,0.39254840143179537,0.5835401350814016,0.9597289079109588 Epoch #2207520 Error : 2.0 The only way I was able to get this to converge is by using the ActivationSigmoid with values of 1's and 0's as the input and target values, or using an ActivationSigmoid with 1's and -1's as the input and target vector with values 1's and 0's

http://stackoverflow.com/a/26699874
upvote count: 15
has body: T is effectively erased during compilation. See here: Generics were introduced to the Java language to provide tighter type checks at compile time and to support generic programming. To implement generics, the Java compiler applies type erasure to: Replace all type parameters in generic types with their bounds or Object if the type parameters are unbounded. The produced bytecode, therefore, contains only ordinary classes, interfaces, and methods. Insert type casts if necessary to preserve type safety. Generate bridge methods to preserve polymorphism in extended generic types. Type erasure ensures that no new classes are created for parameterized types; consequently, generics incur no runtime overhead. So your castToAnotherType gets T erased into ca. the following: public static Object castToAnotherType(Object param) { Object ret = null; try { ret = (Object) param; } catch (ClassCastException e) { System.out.print("Exception inside castToAnotherType()"); } return ret; } Which does obviously not produce any ClassCastException. main(...) is a different story, it results into the following: public static void main(String[] args) { try { String obj = (String) MyClass.castToAnotherType(new Object()); } catch (ClassCastException e) { System.out.print("Exception outside castToAnotherType()"); } } Which produces the ClassCastException when trying to cast Object to String. Please see the Type Erasure part of the Generics tutorial.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26699731
type: Answer
has comment: http://stackoverflow.com/comment/41994200
has comment: http://stackoverflow.com/comment/41993953
accepted answer of: http://stackoverflow.com/q/26699731
score: 15

http://stackoverflow.com/comment/42253977
has text: Pls add web.xml and the url you are trying to access to
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26823338

http://stackoverflow.com/q/26772123
score: 1
has answer: http://stackoverflow.com/a/26772265
favorite count: 0
has answer: http://stackoverflow.com/a/26772165
tagged with: input
possible better answer: http://stackoverflow.com/a/26772265
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26772165
type: Question
tagged with: arrays
has body: I need to get(key board inputs) to store Name,ID,marks of several students and store them in an array.. how can i assign inputs to the array.. here is my code so far.. i am completely new to java. this is my first assignment.. does my data get stored in my Student[] studentDetails Array? or whats the code i need to add to do that. public class Main { public static void main(String[] args){ Student s = new Student(null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Scanner sc = new Scanner(System.in); System.out.println("Enter no. of Student"); int x = sc.nextInt(); Student [] studentDetails = new Student[x]; System.out.println("enter f name"); s.setfName(sc.nextLine()); System.out.println("enter l name"); s.setlName(sc.nextLine()); System.out.println("enter regno"); s.setStuID(sc.nextLine()); System.out.println("enter project 1 marks"); s.setProjM1(sc.nextInt()); System.out.println("enter ICT 1 Marks"); s.setIctM1(sc.nextInt()); System.out.println("enter Active P 1 Marks"); s.setActP1(sc.nextInt()); System.out.println("enter Codeing assignmnt Marks "); s.setCodeAsM(sc.nextInt()); System.out.println("enter ICT2 Marks"); s.setIctM2(sc.nextInt()); System.out.println("enter Act. P 2 Marks"); s.setActP2(sc.nextInt()); System.out.println("enter ICT 3 Marks"); s.setIctM3(sc.nextInt()); System.out.println("enter Act. p 3 Marks"); s.setActP3(sc.nextInt());
answer count: 2
has title: How can i add set of information (in user defined data type) to an Array in java
downvote count: 0

http://stackoverflow.com/comment/42116033
has text: See also: http://stackoverflow.com/questions/18002896/is-closing-the-resources-always-important, http://stackoverflow.com/questions/24129088/are-resources-closed-before-or-after-the-finally
score: 0
comment on: http://stackoverflow.com/q/26767420
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26768642
score: 0
has body: I'll help you with making a method for this chunk of code (I'm not using all of it, because you'll learn more by applying it yourself) double answer1 = (-b + Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a); To create a method, you need to first determine what it's return type is (if any), and what its parameters should be. Since you are working with doubles the return type for your "work the problem" method should be a double, and since you have three variables (a, b, c) those should be included in the methods parameters. When making parameters, you have to first say what type they are, and then give them a name. If you have more than 1 parameters, you have to separate them with a comma. This is what the method should look it. private static double workTheFirstPart(double a, double b, double c) { double ans = (-b + Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a); return ans; } Just for clarity, this chunk of code will be placed outside of the main method (under the second to last curly bracket) In your main method, you should set the value of answer1 to double answer1 = workTheFirstPart(a, b, c); Because the method returns a double, you can set answer1 equal to it. Hopefully this will get you going in the right direction and hopefully I didn't make any stupid mistakes (I've been at work all day, my brain is a little fried). Good luck!
answers question: http://stackoverflow.com/q/26768027
type: Answer

http://stackoverflow.com/a/26683057
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26678518
downvote count: 0
score: 2
has body: Fixed version of the test in the question: @Tested KeyGen keyGen; @Mocked Dispatcher dispatcher; @Test public void testKey() { keyGen.verifyOtherDetails("???", null); final WarningString warning = new WarningString("The key is null or empty for user "); new Verifications() {{ Dispatcher.dispatch(warning); }}; } (Provided WarningString implements the equals method.)

http://stackoverflow.com/comment/42331482
type: QuestionComment
has text: Did you try <link href="/assets/css/bootstrap.min.css" ... ?
score: 0
comment on: http://stackoverflow.com/q/26730663
type: Comment

http://stackoverflow.com/comment/42078615
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26745364
has text: That's weird, I checked the Java item in the System Preferences before (and did it again at the moment) and under the "Update" tab it says "Your system has the recommended version of Java. {linebreak} Java 8 Update 25". Is this normal? (nothwistanding the fact that according to the linked question, if I am indeed using Java 7, things should work just fine).

http://stackoverflow.com/comment/42224463
comment on: http://stackoverflow.com/a/26827420
type: Comment
has text: @user305611156 The fact that PHP allows this particular bad practice doesn't make PHP a bad language. There are many examples of bad practice that shouldn't be used in many languages, it doesn't make them bad. I agree that this particular example is surprising, but it is an example of mis-use and doesn't make the whole language bad as a result.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26725375
upvote count: 1
answers question: http://stackoverflow.com/q/26725341
downvote count: 0
score: 1
type: Answer
has body: The reason it only prints the first word is because Scanner uses whitespace as a delimiter by default, so it only accepts the first word in your line. To accomplish what you want, use Scanner.nextLine(), like so: public static void repeat(){ System.out.println("Please input a number"); Scanner inputRepeat = new Scanner(System.in); int r = inputRepeat.nextInt(); System.out.println("Enter a sentence to repeat: "); String sentence = inputRepeat.nextLine(); for(int i = 0; i &lt;= r; i++){ System.out.println(sentence); }

http://stackoverflow.com/a/26817101
type: Answer
has body: You need to do the following: Assume max power as min to min value and create another variable to hold maxResistance. In your for loop, use if to check whatever was the last value of maxPower is greater than power generated by current resistance. If that's the case change your assumption saying this could be max and loop with next resistance value. public class Question51 { public static void main(String[] args) { double Vs = 12, V1, V2, V3, I1, I2, I3, R1 = 10, R2 = 15, R3 = 1, Rpar, PowerInR3; double maxResister = 0, maxPower = Double.MIN_VALUE; for(R3 = 1; R3 &lt;= 9; R3++) { Rpar = (R2 * R3)/(R2 + R3); I1 = Vs/(R1 + Rpar); V1 = I1 * R1; V2 = Vs - V1; I2 = V2 / R2; I3 = V2 / R3; PowerInR3 = V2 * I3; if (maxPower &lt; PowerInR3) { maxPower = PowerInR3; maxResister = R3; } System.out.println("When r3 = "+R3+" Ohms, Power in R3 = "+PowerInR3+" watts."); } System.out.println("Max Power when Resistance is " + maxResister + " ohms is " + maxPower + " watts"); } }
answers question: http://stackoverflow.com/q/26817047
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42204823
downvote count: 0
has comment: http://stackoverflow.com/comment/42204588

http://stackoverflow.com/q/26821595
has comment: http://stackoverflow.com/comment/42212897
has title: Android java math prob
has body: i have the following code. Whenever try to use numbers with decimals on my app crashes. I know is something wrong with my final result but whats wrong??? b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String f = et1.getText().toString(); int i = Integer.parseInt(f); String s = et2.getText().toString(); int j = Integer.parseInt(s); String w = et4.getText().toString(); int q = Integer.parseInt(s); int price_gold = 10; int fpa = 10; int fpol = 10; int isot = 10; int sint_ker = 10; Integer result1 = (i * price_gold) + (j * 1000) + (q * isot); result = result1 / 340; String res = result.toString(); et3.setText(res); } }
has comment: http://stackoverflow.com/comment/42212739
tagged with: android
has comment: http://stackoverflow.com/comment/42212658
has comment: http://stackoverflow.com/comment/42212745
type: AnsweredQuestion
tagged with: math
tagged with: java
accepted answer: http://stackoverflow.com/a/26821809
type: Question
has answer: http://stackoverflow.com/a/26821738
has comment: http://stackoverflow.com/comment/42212981
has comment: http://stackoverflow.com/comment/42212720
has answer: http://stackoverflow.com/a/26821809
possible better answer: http://stackoverflow.com/a/26821738
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42212673

http://stackoverflow.com/comment/42190018
type: QuestionComment
has text: Indeed it is! My mistake for omitting that.
score: 0
comment on: http://stackoverflow.com/q/26808626
type: Comment

http://stackoverflow.com/comment/42070447
has text: this code does not run directly on JVM, it runs on a weblogic 12c. So I think there should be some life trick about it.
comment on: http://stackoverflow.com/q/26737904
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26826224
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/26825650
has body: public ArrayList&lt;String&gt; solution(String s){ ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); StringBuffer sb = new StringBuffer(); String[] array = s.split(" "); for(String str:array){ sb.append(str); result.add(sb.toString()); } return result; }
type: Answer
score: -1

http://stackoverflow.com/comment/42100146
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26746886
has text: What, exactly, are you trying to do with Liquibase and HSQLDB, and how does that relate to your use of JIRA?

http://stackoverflow.com/q/26694354
type: Question
score: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41994383
upvote count: 1
tagged with: swing
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41984043
tagged with: network-programming
has body: I am sending a string message of "5" via Client 1 to the server whenever a button on the GUI window is clicked and the server receives the message and sends it to the other client, Client 2, connected to the same port as Client 1. When the button is clicked, the Client 2 does receive the string message "5", but the problem is that as soon as the button is clicked, the whole GUI window of Client 1 freezes (not being able to click on anything). The same goes for the Client 2, which does the same thing of sending a string message of "2" when the button is clicked, but the GUI window also freezes when the button is clicked. Why is the GUI windowing freeze? Code snippet: BufferedReader buffR; Socket sock = new Socket(nameHost, portNum); PrintWriter printW = new PrintWriter(sock.getOutputStream()); this.buffR = new BufferedReader(new InputStreamReader(sock.getInputStream())); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ printW.println("5"); printW.flush(); } }); Edited - Additional Code Snippet (Receiving portion): This is a runnable method that's inside a thread class along with the code snippet above. public void run() { try{ while(true){ String line = br.readLine(); int update = Integer.parseInt(line); current-= update; //int current = 0 and update is the number received from the other client, which is "5" JLabel newNumber = new JLabel(current); //Assign the newNumber JLabel with the current number jp.remove(number); //Remove the JLabel 'number' which initially shows "50" jp.revalidate(); jp.repaint(); jp.add(newNumber); //Replace the JLabel 'number' with 'newNumber' if(update == 0){ JOptionPane.showMessageDialog(jf, "Reached 0", "Message", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } } } catch (IOException ioe){ System.out.println("ioe in ChatClient.run: " + ioe.getMessage()); } }
tagged with: java
has answer: http://stackoverflow.com/a/26694367
tagged with: user-interface
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41984675
has comment: http://stackoverflow.com/comment/41984687
has comment: http://stackoverflow.com/comment/41984026
has title: Why does my GUI window freeze whenever ActionListener is performed?
has comment: http://stackoverflow.com/comment/41984679
favorite count: 0
has comment: http://stackoverflow.com/comment/41986272

http://stackoverflow.com/q/26704675
favorite count: 0
has answer: http://stackoverflow.com/a/26704899
has title: How to check how many numbers in array are under 499?
possible better answer: http://stackoverflow.com/a/26704723
downvote count: 0
has body: I am reading a course in Java and I have solved the essay and everything is working, but one thing. I want to get how many random numbers are in each of the intervals. You can see what I mean by looking at my code below where I have inserted [amount] where I want the number of random numbers. I do not seem to get the right logic. Can anyone help me? public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("How many random numbers from 0 to 999? "); int amount = in.nextInt(); int[] numbers = new int[amount]; System.out.print("Here is the random numbers: "); for (int i = 0; i &lt; numbers.length; i++) { numbers[i] = (int) Math.floor(Math.random()*1000); System.out.print(numbers[i] + " "); } System.out.println(""); System.out.print("These [amount] numbers are from 0 to 499: "); for (int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &lt;= 499) { int[] numbersLow = Arrays.copyOf(numbers, numbers.length); System.out.print(numbersLow[i] + " "); } } System.out.println(""); System.out.print("These[amount] numbers are from 500 to 999: "); for (int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &gt;= 500) { int[] numbersHigh = Arrays.copyOf(numbers, numbers.length); System.out.print(numbersHigh[i] + " "); } } }
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26704776
type: Question
has comment: http://stackoverflow.com/comment/42002436
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26704723
answer count: 3
upvote count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26704899

http://stackoverflow.com/comment/42009959
type: Comment
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26708816

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/26771632
tags question: http://stackoverflow.com/q/26807549

http://stackoverflow.com/q/26716110
has title: Validate Pojo's in OSGi
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26757618
favorite count: 0
tagged with: osgi
tagged with: maven
has comment: http://stackoverflow.com/comment/42022453
type: AnsweredQuestion
score: 2
upvote count: 2
has body: I would validate my anootated pojos (JSR 303) with the HibernateValidator in my OSGi. The unit Tests works fine but on the OSGi it doesn't work. Here's my Validator Method: public static void validate(Object o) throws ValidationException { ValidatorFactory factory = Validation.byDefaultProvider().providerResolver(new OSGiServiceDiscoverer()).configure() .buildValidatorFactory(); Validator validator = factory.getValidator(); Set&lt;ConstraintViolation&lt;Object&gt;&gt; validatorResult = null; if (o instanceof MessageContentsList) { MessageContentsList messageList = (MessageContentsList) o; validatorResult = validator.validate(messageList.get(0)); } else { validatorResult = validator.validate(o); } if (!validatorResult.isEmpty()) { StringBuffer sb = new StringBuffer(); for (ConstraintViolation&lt;Object&gt; v : validatorResult) { sb.append(v.getPropertyPath() + " " + v.getMessage() + ", "); } String msg = sb.toString().substring(0, sb.toString().length() - 1); throw new ValidationException(msg); } } And here the Discoverer: public class OSGiServiceDiscoverer implements ValidationProviderResolver { @Override public List&lt;ValidationProvider&lt;?&gt;&gt; getValidationProviders() { List&lt;ValidationProvider&lt;?&gt;&gt; providers = new ArrayList&lt;ValidationProvider&lt;?&gt;&gt;(1); providers.add(new HibernateValidator()); return providers; } } In the pom I've added the following imports for the OSGi: javax.validation, javax.validation.bootstrap, javax.validation.constraints, javax.validation.spi, org.hibernate.validator, Has someone a idea what I'm doing wrong? Thx
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26757618
has comment: http://stackoverflow.com/comment/42022586
has comment: http://stackoverflow.com/comment/42093006

http://stackoverflow.com/comment/42210447
score: 0
type: Comment
has text: Thank you, it helped me a lot, the program using your method works perfectly with all the random examples I could imagined, especially for me, because I am beginner, and using something new in the process.
type: AnswerComment
comment on: http://stackoverflow.com/a/26818044

http://stackoverflow.com/a/26708596
has comment: http://stackoverflow.com/comment/42009285
has comment: http://stackoverflow.com/comment/42009395
type: Answer
has comment: http://stackoverflow.com/comment/42009340
has body: from your above it continuously going to print the iteration so use below code. so use below code public class mytest1 { String path, keyword; public static void main(String args[]){ exec_script("normal"); } public static void exec_script(String exec_path){ for (int i=0; i&lt;10; i++){ if (i==4){ exec_path = "spl"; } switch (exec_path){ case "spl": spl_case(); break; case "normal": System.out.println("normal print"); break; case "call_action_path": System.out.println("call action key word now"); break; } return; } } public static void spl_case(){ System.out.println("inside function splcase now"); exec_script("call_action_path"); } }
downvote count: 2
answers question: http://stackoverflow.com/q/26708463
upvote count: 0
score: -2

http://stackoverflow.com/a/26690331
type: Answer
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26690258
has body: Make a parent project which has both projects as modules. Example from http://books.sonatype.com/mvnex-book/reference/multimodule-sect-simple-parent.html: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.sonatype.mavenbook.multi simple-parent pom 1.0 Multi Chapter Simple Parent Project simple-weather simple-webapp ....
answers question: http://stackoverflow.com/q/26690258
has comment: http://stackoverflow.com/comment/41977863
has comment: http://stackoverflow.com/comment/41977703
type: AcceptedAnswer
upvote count: 2

state
tag name: state
type: Tag
tags question: http://stackoverflow.com/q/26821189

http://stackoverflow.com/comment/41986780
score: 1
has text: Ok, then this is worth investigating =)
type: Comment
comment on: http://stackoverflow.com/q/26695869
type: QuestionComment

arraylist
tags question: http://stackoverflow.com/q/26713387
tags question: http://stackoverflow.com/q/26744372
tags question: http://stackoverflow.com/q/26809537
tags question: http://stackoverflow.com/q/26786284
tags question: http://stackoverflow.com/q/26756255
tags question: http://stackoverflow.com/q/26784439
tags question: http://stackoverflow.com/q/26707862
tags question: http://stackoverflow.com/q/26737018
tags question: http://stackoverflow.com/q/26791568
tags question: http://stackoverflow.com/q/26785588
tags question: http://stackoverflow.com/q/26706579
tags question: http://stackoverflow.com/q/26685069
tags question: http://stackoverflow.com/q/26795838
tags question: http://stackoverflow.com/q/26725229
tags question: http://stackoverflow.com/q/26704376
tags question: http://stackoverflow.com/q/26682197
tags question: http://stackoverflow.com/q/26738984
tags question: http://stackoverflow.com/q/26750994
tags question: http://stackoverflow.com/q/26801416
tags question: http://stackoverflow.com/q/26760086
tags question: http://stackoverflow.com/q/26721911
tags question: http://stackoverflow.com/q/26811084
tags question: http://stackoverflow.com/q/26759606
tags question: http://stackoverflow.com/q/26795485
tags question: http://stackoverflow.com/q/26717422
tags question: http://stackoverflow.com/q/26741726
tags question: http://stackoverflow.com/q/26830305
tags question: http://stackoverflow.com/q/26701358
tags question: http://stackoverflow.com/q/26686361
tags question: http://stackoverflow.com/q/26761317
tags question: http://stackoverflow.com/q/26757512
tags question: http://stackoverflow.com/q/26726868
tags question: http://stackoverflow.com/q/26811548
tags question: http://stackoverflow.com/q/26698888
tags question: http://stackoverflow.com/q/26806589
tags question: http://stackoverflow.com/q/26797822
tags question: http://stackoverflow.com/q/26743457
tags question: http://stackoverflow.com/q/26825139
tags question: http://stackoverflow.com/q/26770604
tags question: http://stackoverflow.com/q/26763761
tags question: http://stackoverflow.com/q/26756627
tags question: http://stackoverflow.com/q/26814673
tags question: http://stackoverflow.com/q/26681902
tags question: http://stackoverflow.com/q/26748668
tags question: http://stackoverflow.com/q/26773124
tags question: http://stackoverflow.com/q/26772033
tags question: http://stackoverflow.com/q/26821857
tags question: http://stackoverflow.com/q/26738386
tags question: http://stackoverflow.com/q/26810814
tags question: http://stackoverflow.com/q/26692079
tags question: http://stackoverflow.com/q/26790324
tags question: http://stackoverflow.com/q/26823076
tags question: http://stackoverflow.com/q/26790685
tags question: http://stackoverflow.com/q/26748956
tags question: http://stackoverflow.com/q/26724781
tags question: http://stackoverflow.com/q/26728892
tags question: http://stackoverflow.com/q/26755866
tags question: http://stackoverflow.com/q/26830153
tags question: http://stackoverflow.com/q/26705580
tags question: http://stackoverflow.com/q/26766997
tags question: http://stackoverflow.com/q/26824236
tags question: http://stackoverflow.com/q/26723393
tags question: http://stackoverflow.com/q/26683052
tags question: http://stackoverflow.com/q/26770671
tags question: http://stackoverflow.com/q/26812384
tags question: http://stackoverflow.com/q/26676210
tags question: http://stackoverflow.com/q/26770147
tags question: http://stackoverflow.com/q/26727004
tags question: http://stackoverflow.com/q/26686089
tags question: http://stackoverflow.com/q/26807051
tags question: http://stackoverflow.com/q/26812537
tags question: http://stackoverflow.com/q/26683168
tags question: http://stackoverflow.com/q/26686581
tags question: http://stackoverflow.com/q/26750916
tags question: http://stackoverflow.com/q/26785989
tags question: http://stackoverflow.com/q/26768302
tags question: http://stackoverflow.com/q/26760093
tags question: http://stackoverflow.com/q/26689443
tags question: http://stackoverflow.com/q/26756360
tags question: http://stackoverflow.com/q/26674747

http://stackoverflow.com/comment/42019577
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26714535
has text: By the way: This could have been a comment!

http://stackoverflow.com/comment/41957591
comment on: http://stackoverflow.com/q/26679200
score: 0
type: Comment
has text: it points the last node to the 1st node and thats what we do in the circular linked list . The last node have the reference of the first one
type: QuestionComment

http://stackoverflow.com/q/26776904
has comment: http://stackoverflow.com/comment/42132456
type: Question
has answer: http://stackoverflow.com/a/26777153
tagged with: java
has comment: http://stackoverflow.com/comment/42135618
tagged with: concurrency
has comment: http://stackoverflow.com/comment/42132123
score: 0
has title: How to handle concurrent sql updates, given database structure can change at runtime
tagged with: sql
answer count: 1
has body: I am developing spring mvc application For now I am using innodb mysql but I have to develop the application to support other databases also. Can any one please suggest me how to handle concurrent sql update on single record. Suppose two users are trying to update same record then how to handle such scenario. Note: My database structure is dependent on some configuration (It can change at runtime) and my spring controller is singleton in nature. Thanks. Update: Just for reference I am going to implement version like https://stackoverflow.com/a/3618445/3898076).
accepted answer: http://stackoverflow.com/a/26777153
has comment: http://stackoverflow.com/comment/42135328
linked to: http://stackoverflow.com/q/3616321
type: AnsweredQuestion
tagged with: mysql

http://stackoverflow.com/comment/42190616
score: 0
comment on: http://stackoverflow.com/q/26808965
type: Comment
type: QuestionComment
has text: Can you Please run the same Insert query in DB first and see if it works? This way you will know if something wrong with your query or it's the java code and later find solution.

http://stackoverflow.com/comment/41949046
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26674146
has text: I take it you're using JBoss 7.1 community - it is horribly outdated. Did you try upgrading the version of Weld in it? Perhaps you're running into a bug which has already been fixed. You could as an alternative try to run this on JBoss Wildfly, just to see if it makes a difference.

http://stackoverflow.com/q/26817633
tagged with: java
tagged with: lwjgl
has body: I'm right now trying to mix LWJGL and Swing so I can have Swing's GUI and LWJGLS Graphics... But it doesn't work, Thanks in advance. Code : /** * */ public static TSudioQE TSudio; private static final long serialVersionUID = -8495077485468477943L; public static void main(String[] args) { try { TSudioQE tsudio = new TSudioQE(); } catch (LWJGLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public TSudioQE() throws LWJGLException { setTitle("TSudio Quall Engine 1X"); JPanel p = new JPanel(); Canvas c = new Canvas(); Display.create(); Display.setParent(c); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // set the color of the quad (R,G,B,A) GL11.glColor3f(0.5f, 0.5f, 1.0f); // draw quad GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(100, 100); GL11.glVertex2f(100 + 200, 100); GL11.glVertex2f(100 + 200, 100 + 200); GL11.glVertex2f(100, 100 + 200); GL11.glEnd(); add(p); setSize(800, 460); setExtendedState(JFrame.MAXIMIZED_BOTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } @Override public void windowOpened(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowClosing(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowClosed(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowIconified(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowDeiconified(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowActivated(WindowEvent e) { // TODO Auto-generated method stub } @Override public void windowDeactivated(WindowEvent e) { // TODO Auto-generated method stub } I get the following error: org.lwjgl.LWJGLException: Parent.isDisplayable() must be true at org.lwjgl.opengl.Display.createWindow(Display.java:301) at org.lwjgl.opengl.Display.setParent(Display.java:451) at qq.application.TSudioQE.&lt;init&gt;(TSudioQE.java:47) at qq.application.TSudioQE.main(TSudioQE.java:33) Anyone who know …
has comment: http://stackoverflow.com/comment/42205779
type: Question
accepted answer: http://stackoverflow.com/a/26851848
downvote count: 0
has title: Trying to mix Swing and LWJGL
linked to: http://stackoverflow.com/q/3988788
answer count: 1
favorite count: 0
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26851848
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/42049960
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26729885
has text: I think maven is skipping some files like handle and listener classes while building war file. Any reason why ?

http://stackoverflow.com/q/26828282
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42227072
has answer: http://stackoverflow.com/a/26832131
tagged with: audio
tagged with: java
has comment: http://stackoverflow.com/comment/42224519
has comment: http://stackoverflow.com/comment/42224847
has body: I initialize the AudioInputStream like this: dataLineInfo = new DataLine.Info(TargetDataLine.class, getAudioFormat()) ; targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo); targetDataLine.open(getAudioFormat()); targetDataLine.start(); That works fine and I can hear the Audio Input of the Microphone. If I try to change the Audio Input to another device I only hear noise. I tried to solve this problem for a week now and I really don't have a clue anymore why I can't hear the other audio input device... I would be very proud about any help! Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); for (int cnt = 0; cnt &lt; mixerInfo.length; cnt++) { Mixer currentMixer = AudioSystem.getMixer(mixerInfo[cnt]); if (mixerInfo[cnt].getName() == combo1.getSelectedItem().toString()) { System.out.println("Gewählter Input gefunden"); if (targetDataLine.isRunning()) { targetDataLine.stop(); } targetDataLine.flush(); if (targetDataLine.isOpen()) { targetDataLine.close(); } dataLineInfo = new DataLine.Info(TargetDataLine.class, getAudioFormat()); try { targetDataLine = (TargetDataLine) currentMixer.getLine(dataLineInfo); targetDataLine.open(getAudioFormat()); targetDataLine.start(); } catch(LineUnavailableException e1) { e1.printStackTrace(); } } } For complete code, go to github
type: Question
score: 2
downvote count: 0
has title: Why do I get only hear noise after changing the audio input in java?
favorite count: 0
tagged with: microphone
answer count: 1
upvote count: 2

http://stackoverflow.com/comment/42162472
type: Comment
type: QuestionComment
has text: The thing is @AndrewT. without that, the System.out.println(Roomcarpet); is not being called and therefore not being displayed..
comment on: http://stackoverflow.com/q/26793599
score: 0

http://stackoverflow.com/a/26757592
accepted answer of: http://stackoverflow.com/q/26756456
type: Answer
has body: I could not test it but if I understand what you want to do, because my English is not very good, this is a simple ejmplo could be improved but I think that is what you want //varible class; float deltaYourExc = -1f; float deltaYourTime = 5f; . if ( Intersector . overlaps ( Object . getBoundingCircle (), myWorld . getGround ()) || (deltaYourExc &lt;= deltaYourTime &amp;&amp; deltaYourExc != -1)) { batcher . draw ( DownpAni . getKeyFrame ( runTime ), Object . getX (), Object . getY (), Object . getWidth (), Object . getHeight ()); //delta is delta in render deltaYourExc += delta; if(deltaYourExc &gt;= deltaYourTime){ deltaYourExc = -1f } }else{ batcher . draw ( JumpAni . getKeyFrame ( runTime ), Object . getX (), Object . getY (), Object . getWidth (), Object . getHeight ()); }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26756456
score: 0

http://stackoverflow.com/comment/41950866
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26674747
score: 0
has text: What is wrong with you? I don't want to concatenate the arraylists I want to merge them into one arraylist with fields from both arraylists.

http://stackoverflow.com/q/26737840
favorite count: 0
has title: ojdbc14.jar for Oracle 12c supported?
type: UnansweredQuestion
tagged with: oracle-database
score: 3
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42061748
has answer: http://stackoverflow.com/a/26737952
upvote count: 3
has body: We have application developed in portlet Factory 5.1 which is using Oracle 9i. we are using ojdbc14.jar for that. we are upgrading the Oracle from 9i to 12c. is this ojdbc.jar supported for Oracle 12c as well? i believe it is compatible. Any Idea?
answer count: 1
tagged with: oracle12c

http://stackoverflow.com/a/26780199
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26780114
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/42138140
answers question: http://stackoverflow.com/q/26780114
upvote count: 4
has body: I would do it like this, in just one line: String[] words = str.replaceAll(".*\\[|\\].*", "").split(", "); The first replaceAll() call strips off the leading and trailing wrapper, and the split() breaks up what's left into separate words.

http://stackoverflow.com/comment/119798547
has text: @cassiomolin Thanks for the brilliant explanation. I'm using your example and almost everything works fine. I've got one question though: How would I have an endpoint that is free to all, but for authorized users, returns different data. If I add `@Secured` to the method and call it without a token, I get a 401, if I remove `@Secured`, I can't get the user information using `securityContext.getUserPrincipal()`. Any suggestions?
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/45814178

http://stackoverflow.com/comment/42222288
score: 0
has text: Hi Mad, thanks, I overlooked that one. So fond with using toString(). But I already modified the code and still having the same error. Could it be that its not possible in java?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26826464

http://stackoverflow.com/comment/42087148
score: 0
type: Comment
type: QuestionComment
has text: You haven't really said what doesn't work. Is your jar packaged with Spring Boot? Does it have the`PropertiesLauncher` as a main (your second example suggests this)?
comment on: http://stackoverflow.com/q/26743299

http://stackoverflow.com/q/26725306
has comment: http://stackoverflow.com/comment/42040203
has answer: http://stackoverflow.com/a/40171410
has answer: http://stackoverflow.com/a/36796286
has answer: http://stackoverflow.com/a/43842498
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/32418834
upvote count: 25
tagged with: java
has answer: http://stackoverflow.com/a/51865282
has answer: http://stackoverflow.com/a/41737428
has answer: http://stackoverflow.com/a/73974636
has answer: http://stackoverflow.com/a/43464987
has answer: http://stackoverflow.com/a/40006504
has answer: http://stackoverflow.com/a/26726045
possible better answer: http://stackoverflow.com/a/32418834
has comment: http://stackoverflow.com/comment/42040221
has answer: http://stackoverflow.com/a/37186866
answer count: 16
has answer: http://stackoverflow.com/a/30887423
has body: I search some page in stackoverflow to solve this problem, did follow some true answer but not working. I am new in spring , sorry. here is my dispatcher-servlet <?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> <context:component-scan base-package="controller" /> <mvc:annotation-driven /> indexController </beans> < -- line 52 here... Here is my web.xml <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/applicationContext.xml <listener- class>org.springframework.web.context.ContextLoaderListener</listener-class> dispatcher <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet- class> 2 dispatcher *.htm 30 redirect.jsp And my ApplicationContext <?xml version='1.0' encoding='UTF-8' ?> <!-- was: <?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:p="http://www.springframework.org/schema/p" 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://w…
has comment: http://stackoverflow.com/comment/42040238
score: 25
has comment: http://stackoverflow.com/comment/42039915
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35174952
has title: Springs Element 'beans' cannot have character [children], because the type's content type is element-only
downvote count: 0
accepted answer: http://stackoverflow.com/a/26726045
has answer: http://stackoverflow.com/a/50806055
has answer: http://stackoverflow.com/a/74910382
favorite count: 0
has comment: http://stackoverflow.com/comment/42040863
type: Question
has comment: http://stackoverflow.com/comment/42040143
has answer: http://stackoverflow.com/a/63826871

http://stackoverflow.com/comment/99740107
type: AnswerComment
has text: You may wish to write Map<String, Object> result = mapper.convertValue(jsonNode, new TypeReference<Map<String, Object>>(){}); to avoid warning of unchecked assignment from Map to Map<String, Object>.
type: Comment
score: 6
comment on: http://stackoverflow.com/a/28167365

http://stackoverflow.com/a/26787116
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26787062
answers question: http://stackoverflow.com/q/26787062
type: Answer
has body: You're looking for a process called refactoring. http://wiki.netbeans.org/Refactoring
score: 4

http://stackoverflow.com/a/26730899
has comment: http://stackoverflow.com/comment/42049760
score: 5
answers question: http://stackoverflow.com/q/26730881
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/42049672
has body: Both onClick and actionPerformed are callback methods, which means they are called by the Android OS, which passes them their arguments.
downvote count: 0

http://stackoverflow.com/a/26779102
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26778969
has body: it's because you are using two fors. Thus, this adds in the map the values: 1 - London 1 - Berlin 1 - Paris 2 - London 2 - Berlin 2 - Paris 3 - London 3 - Berlin 3 - Paris The TreeMap only remembers the last value you put in for each index, therefor Paris for all of them. If you know you have corresponding elements in mIds and mCustomClass [same length], just use one for and simply use mapB.put(mIds[i], mCustomClass[i]). For a more general approach, if you have corresponding items in the two arrays (or collections), you should consider creating a better object, having 2 fields (id and class) and simply write your own Comparator for that object, that only takes into account the ID.
accepted answer of: http://stackoverflow.com/q/26778969

http://stackoverflow.com/q/26813449
favorite count: 0
has comment: http://stackoverflow.com/comment/42198796
accepted answer: http://stackoverflow.com/a/26813460
possible better answer: http://stackoverflow.com/a/26813741
has body: My problem is in the add method. I think I know what I want it to do but I can't figure out what type of loop I should use to look through the list. As you can see I started to make a if else loop but I couldn't figure out what I should use as the counter. I'm pretty sure I have the right logic in dealing with the add but I feel like I'm not quite there yet. I was thinking of using compareTo in some fashion. import java.util.*; public class OrderedLinkedList&lt;E extends Comparable&lt;E&gt;&gt; { private Node topNode; private class Node { private E data; private Node nextNode; public Node(E data) { this.data = data; nextNode = null; } } public OrderedLinkedList() { topNode = null; } public boolean empty() { if(topNode == null) return true; return false; } public String toString() { String myString = ""; Node nextNode = topNode; while(nextNode != null) { myString = topNode + " -&gt; " + nextNode; nextNode = topNode.nextNode; } return myString; } public void add(E data) { Node myNode = new Node(data); Node priorNode = topNode; Node currentNode = topNode; if(___) { priorNode = currentNode; currentNode = currentNode.nextNode; } else { priorNode.nextNode = myNode; myNode.nextNode = currentNode; } } }
has comment: http://stackoverflow.com/comment/42198780
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
upvote count: 1
downvote count: 1
has title: Confused about choosing a loop to iterate a linked list
type: Question
has answer: http://stackoverflow.com/a/26813460
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42198772
has answer: http://stackoverflow.com/a/26813741

http://stackoverflow.com/q/26735291
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/42057363
answer count: 1
has answer: http://stackoverflow.com/a/26736832
tagged with: multidimensional-array
has body: After identifying that elements in a specific column of a multidimensional array are not numbers I'm looking at swapping two columns of this multidimensional array. Basically I would like to swap the contents of column 4 with those in column 6 after determining whether elements in column 6 are numbers or not so if elements in column 6 are not numbers then create new array and start inserting old array contents in new array but once the column gets to the 4th column of the old array it places this element in the 6th column of the new array and vice versa. Below is my attempt regarding the above. I've been able to successfully identify if the elements in my column 6 are numbers or not. I now have doubts regarding the logic behind swapping the elements in column 4 with those in 6. //!&lt; public String[][] sortedByDateUsageStatsData(String[][] unsortedUsageStatsData) { System.out.println("\nbtnUsageStats - sortedByDateUsageStatsData(String[][] unsortedUsageStatsData)"); for (int row = 0; row &lt; unsortedUsageStatsData.length; row++) { for (int col = 0; col &lt; 7; col++) { //System.out.println("unsortedUsageStatsData[" + row + "][" + col + "] =&gt; " + unsortedUsageStatsData[row][col]); } // Check if content in return code column i.e. column 6 is number or a string. // If a string then swap column 4 content with column 6 and pass this array with swapped columns as the final array if(!isNumericString(unsortedUsageStatsData[0][6])) { //System.out.println("unsortedUsageStatsData[0][6] is NOT a number i.e. " + unsortedUsageStatsData[0][6]); break; } System.out.println("\n"); } System.out.println("\nExited for loop as unsortedUsageStatsData[0][6] is NOT a number\n"); sortedUsageStatsData = new String[unsortedUsageStatsData.length][7]; for (int row = 0; row &lt; unsortedUsageStatsData.length; row++) { for (int col = 0; col &lt; 7; col++) { //System.out.println("\nBefore swap unsortedUsageStatsData[" + row + "][" + col + "] =&gt; " + unsortedUsageStatsData[row][col]); sorted…
type: UnansweredQuestion
has title: Multidimensional array column swap

http://stackoverflow.com/comment/42091880
type: Comment
has text: I think I have something shorter / quicker (no array access -> no bounds checks)
comment on: http://stackoverflow.com/a/26711576
score: 0
type: AnswerComment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/26677322
tags question: http://stackoverflow.com/q/26677098
tags question: http://stackoverflow.com/q/26818654
tags question: http://stackoverflow.com/q/26673581
tags question: http://stackoverflow.com/q/26726083
tags question: http://stackoverflow.com/q/26695190
tags question: http://stackoverflow.com/q/26827367
type: Tag

http://stackoverflow.com/comment/42068794
type: QuestionComment
comment on: http://stackoverflow.com/q/26718522
score: 0
type: Comment
has text: Thanks Tom, it took me a while to actually get this. So (and excuse me if i'm wrong), what I think you are saying is that their code could start a new thread and finish. The security manager gets set back to the allow all, and then the new, potentially malicious thread may still be alive and cause problems. Is that correct? If so, yes - that's something I hadn't thought of and I didn't quite understand it before, that's worrying and thank you for pointing it out!

http://stackoverflow.com/q/26826813
has answer: http://stackoverflow.com/a/26826908
accepted answer: http://stackoverflow.com/a/26826908
answer count: 2
tagged with: lan
linked to: http://stackoverflow.com/q/21349796
has answer: http://stackoverflow.com/a/26826841
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/42221656
type: AnsweredQuestion
upvote count: 0
has body: I am trying to create a program which could send files to another computer on LAN, there are 10 computers in this LAN so I want to send files to the specific one. how can I do that?
has title: JAVA file sending system
tagged with: java
possible better answer: http://stackoverflow.com/a/26826841
downvote count: 3
has comment: http://stackoverflow.com/comment/42221652
type: Question

http://stackoverflow.com/a/26679680
has comment: http://stackoverflow.com/comment/41960772
type: AcceptedAnswer
downvote count: 0
has body: You need to start your database with the --replSet rsName option, and then run rs.initiate(). After that you will see a rs.oplog collection in the local database. What you are describing is commonly referred to as "tailing the oplog", which is based on using a Tailable Cursor on a capped collection (the MongoDB oplog in this case). The mechanics are relatively simple, there are numerous oplog tailing examples out there written in Java, here are a few: Event Streaming with MongoDB TailableCursorExample Wordnik mongo-admin-utils IncrementalBackupUtil
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41958207
score: 1
answers question: http://stackoverflow.com/q/26678753
accepted answer of: http://stackoverflow.com/q/26678753

http://stackoverflow.com/a/42816535
has body: Hi hope this will help you You have to remove scrollbars attribute from your view
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/26830686
type: Answer
downvote count: 1

http://stackoverflow.com/a/26757677
has comment: http://stackoverflow.com/comment/42342487
answers question: http://stackoverflow.com/q/26753568
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42228094
has comment: http://stackoverflow.com/comment/42368225
has body: I've solved problem, by recreating app from scratch, only difference is that I've used web.xml from from tmplate instead of mine. What is different on web.xml now:
has comment: http://stackoverflow.com/comment/42220755
has comment: http://stackoverflow.com/comment/42162848
accepted answer of: http://stackoverflow.com/q/26753568

http://stackoverflow.com/a/30631659
has comment: http://stackoverflow.com/comment/106236780
downvote count: 0
score: 17
has comment: http://stackoverflow.com/comment/58354325
has body: although late, hope this help. from official page of ActiveAndroid in github: "This is because ActiveAndroid only generates the schema if there is no existing database file. In order to "regenerate" the schema after creating a new model, the easiest way is to uninstall the app from the emulator and allow it to be fully re-installed. This is because this clears the database file and triggers ActiveAndroid to recreate the tables based on the annotated models in the project."
has comment: http://stackoverflow.com/comment/58786056
type: AcceptedAnswer
upvote count: 17
answers question: http://stackoverflow.com/q/26724637
type: Answer
accepted answer of: http://stackoverflow.com/q/26724637

http://stackoverflow.com/q/26775286
type: UnansweredQuestion
tagged with: android
tagged with: android-edittext
answer count: 0
tagged with: java
type: Question
tagged with: android-layout
has title: Keyboard reopen for no reason
has body: The main activity of my application have a classique search button in the ABS When i touch it it expand an EditView and open the keyboard Then you tap some search words, valid, it open a new search activity without finishing the main activity after you've done your search you touch back and return to main activity Here the edittext is retracted and the keyboard hidden, BUT it open itself for no reason !! In the menu.xml file &lt;item android:id="@+id/action_search" android:actionLayout="@layout/view_menu_search" android:icon="@drawable/search" android:orderInCategory="100" android:showAsAction="always|collapseActionView" android:title="recherche"/&gt; The view_menu_search.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;EditText xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:cursorVisible="true" android:hint="@string/search_hint" android:imeOptions="actionSearch" android:inputType="text" android:textColor="@android:color/white" android:textColorHint="@android:color/white" android:textCursorDrawable="@null" /&gt; In the manifest.xml &lt;!-- Main --&gt; &lt;activity android:name=".ui.activity.ActivityMain" android:screenOrientation="portrait" android:windowSoftInputMode="adjustNothing|stateAlwaysHidden" &gt; &lt;/activity&gt; In MainActivity.java : @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); getSupportMenuInflater().inflate(R.menu.menu_main, menu); mSearchEdit = (EditText) menu.findItem(R.id.action_search).getActionView(); // search menuitem final MenuItem searchItem = menu.findItem(R.id.action_search); searchItem.setOnActionExpandListener(new OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { // Do something when collapsed closeKeyboardFocus(); return true; // Return true to collapse action view } @Override public boolean onMenuItemActionExpand(MenuItem item) { if (mSearchEdit.requestFocus()) { getWin…
tagged with: android-view
has comment: http://stackoverflow.com/comment/42130096
score: 0
has comment: http://stackoverflow.com/comment/42129909

http://stackoverflow.com/a/26756718
has body: What you could use is ProgressMonitorDialog: it has possibility to cancel the work and show your progress. ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell()); try { dialog.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Tracing", 100); while(!monitor.isCanceled()) { Display.getDefault().readAndDispatch(); // Do your work here } } }); } catch (InvocationTargetException | InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } This example would probably needs to be adjusted for your requirements and TraceData.getTraceData(true); implementation. Probably you wouldn't use while cycle but rather checking time to time if dialog is cancelled. I think that the main problem you have there is the part where you put Thread to sleep. Since you are executing it in the UI thread, you are actually putting the UI Thread to sleep. That is why neither cancel button, nor other part, where you want to update your UI in asynchExec is working. I'd suggest you to create a Job. This will create another non-UI Thread, which can be used for checking, if monitor is cancelled or updating some state variables or whatever.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42216523
accepted answer of: http://stackoverflow.com/q/26756068
upvote count: 2
answers question: http://stackoverflow.com/q/26756068
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42256693

http://stackoverflow.com/comment/42199855
type: Comment
has text: You don't need the DFS() method. Search always starts from a particular vertice, for example from the first vertice in a graph: dfs(0)
type: AnswerComment
comment on: http://stackoverflow.com/a/26813974
score: 0

http://stackoverflow.com/q/26684648
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26691385
upvote count: 1
answer count: 1
downvote count: 0
tagged with: teradata
favorite count: 0
tagged with: jdbc
has title: Teradata-jdbc: What's the point of using Fastload if java has memory limitations?
accepted answer: http://stackoverflow.com/a/26691385
score: 1
tagged with: java
has body: Here is the link to a sample jdbc Fastload program from the teradata website : http://developer.teradata.com/doc/connectivity/jdbc/reference/current/samp/T20205JD.java.txt It inserts only one row so I modified it to insert 500K rows by replacing the following code : pstmt.setInt(1, 1); pstmt.setString(2, strBuf); pstmt.addBatch(); batchCount++; with : for (int i = 0; i &lt; 500000 ; i ++ ) { pstmt.setInt(1, i); pstmt.setString(2, strBuf); pstmt.addBatch(); batchCount++; } It of course failed because java was out of memory. So Fastloads jdbc fails to upload EVEN 500K rows of very simple data . . because the method addBatch() throws outOfMemory exception at some point. But I read that Fastload was able to upload millions of rows ! ! ! However I could not find any real example anywhere . How to overcome outOfMemory java exception ? Can anybody show an example with jdbc and Fastload (NOT FastloadCSV!) to upload let's say 1M rows ? PS : 1) xmx increase of heap space defeats the purpose, because every additional addBatch() methods executes slower, and additional heap has limitations ( usually 4 g ) 2) I do not need FastloadCSV , because it does not support text qualifiers until ttu 14 and has other issues
type: Question

http://stackoverflow.com/a/26692970
answers question: http://stackoverflow.com/q/26675368
has body: You should put the required jar (this missing one) file as a module into JBOSS_HOME/modules/com/is2/log4j/portalCompras/main and define a module.xml for it.
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41968134
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26684969
has text: @HridayamBakshi Right, my mistake... you need to wrap it in an InputStreamReader first... I'll fix my answer in a second. Edit: Should be fixed now.

http://stackoverflow.com/comment/42229852
type: AnswerComment
has text: @wilkers: `"this specific code was set up for example,..."` -- an example that we currently can't run or test since it is not compilable nor runnable. `"i dont need to set up a MCVE,"` -- that is your opinion, one which I disagree with. `"and your comments are not helping."` -- There is no need to be rude. I am only trying to help you either solve your problem or ask a better question, but no more. As per your wishes, I am gone.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26831393

http://stackoverflow.com/comment/42207453
has text: um, your `randomHuman` is **not** a constructor but a static factory **method**. There's a big difference between constructors and methods.
score: 0
comment on: http://stackoverflow.com/q/26818784
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26716002
score: 0
tagged with: split
tagged with: arrays
has title: How to split scanner input into (Number) (String With Spaces) (Number)
has answer: http://stackoverflow.com/a/26716084
answer count: 3
has body: Put very simply, the program I'm currently working on requires me to split my scanner input (For example: 2 Ham and Cheese 5.5). It's supposed to read in a grocery order and split it into three arrays . I'm supposed to use string.split and be able to split this input into three pieces, regardless of spaces in my middle string. Example Input #1: 2 Apples 0.9 Example Output #1: 2 Apples 0.9 Example Input #2: 2 More Apples 0.9 Example Output #2: 2 More Apples 0.9 How do I achieve that? Whenever I use string.split to split wherever there is a space, it splits "more" and "apples" when I only need it to split between a number and a string. Thank you.
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26716139
has answer: http://stackoverflow.com/a/26716111
tagged with: java
type: Question

keystore
tags question: http://stackoverflow.com/q/26709265
tags question: http://stackoverflow.com/q/26766609
tag name: keystore
tags question: http://stackoverflow.com/q/26745387
tags question: http://stackoverflow.com/q/26698263
tags question: http://stackoverflow.com/q/26673740
tags question: http://stackoverflow.com/q/26770537
type: Tag
tags question: http://stackoverflow.com/q/26711731

http://stackoverflow.com/a/26705166
score: 1
has comment: http://stackoverflow.com/comment/42004197
accepted answer of: http://stackoverflow.com/q/26704904
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26704904
has comment: http://stackoverflow.com/comment/42004223
has comment: http://stackoverflow.com/comment/42003697
has comment: http://stackoverflow.com/comment/42003601
type: Answer
has body: you're not that far away public static Map&lt;String, Set&lt;String&gt;&gt; reverseMapping(Map&lt;String, String&gt; mapping) { // slight change in the next line Map &lt;String, Set&lt;String&gt;&gt; remap = new HashMap&lt;String, Set&lt;String&gt;&gt;(); for (String name : mapping.keySet()) { String color = mapping.get(name); // Until here its ok, see comment below } // added the return return remap; } Now you have to check if your remap already contains a Set with the key color. if so add name to it. If not you need to create a new Set, add name to it, and put the new set into the remap Hope this helps
upvote count: 1

http://stackoverflow.com/comment/42201004
type: Comment
type: QuestionComment
score: 0
has text: Because your `B.Inner(B)` got changed to `B.Inner(B, B)`.
comment on: http://stackoverflow.com/q/26814865

http://stackoverflow.com/q/26789615
tagged with: xsd-validation
tagged with: xsd
tagged with: spring-ws
tagged with: java
has title: Replace XML MessageFormatter in Spring PayloadValidatingInterceptor
upvote count: 1
has answer: http://stackoverflow.com/a/26892632
type: Question
has body: I have banged my head against the wall for a couple of days on this one. We are using Spring web services 2.1.3.RELEASE and I have added a simple subclass of PayloadValidatingInterceptor to capture XSD schema validation errors. Configuration: classpath:/xsd/requestName.xsd XsdValidationInterceptor overrides handleRequestValidationErrors: @Override protected boolean handleRequestValidationErrors( MessageContext messageContext, SAXParseException[] errors) throws TransformerException { if ( getAddValidationErrorDetail() ) { messageContext.setProperty(MessageContextConstants.KEY_SCHEMA_ERRORS, errors); } return true; } So far so good. This issue is the format of the messages that come back from the Xerces parser. Problem is, I want the field name and line/column numbers for where the error occurred without having to dig it out of a long String that is different for various errors. Seems like it should be simple but Spring does not seem to make this easy. And once the error appears at the handleRequestValidationErrors routine, the exception messages have been formatted already. Specifically I would like to either replace the XMLErrorReporter or the MessageFormatter that the XMLErrorReporter uses in the schema validator that Spring creates. Xerces provides a standard property for replacing the error reporter; however, Spring does not make this easy. It uses a hard-coded JAXP factory called Jaxp13ValidatorFactory to create an XMLValidator object that essentially wraps creation of a Xerces validator at each request handling. XMLValidator does not allow setting of properties on the validator implementations it creates. I have looked at custom configuration of Xerces as well as other possible hacks, and at this point the only thing I can think of is to override the handleRequest routine in the XsdValidationInterceptor to create my own validators that I can configure as needed. Anybody have any better ideas? This is the same question asked here, but unfortunately not answered:…
downvote count: 0
answer count: 1
score: 1
linked to: http://stackoverflow.com/q/130960
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41978242
type: AnswerComment
score: 0
type: Comment
has text: thanks for the answer, i changed the snippet, can you see updates?
comment on: http://stackoverflow.com/a/26690878

http://stackoverflow.com/q/26720992
has comment: http://stackoverflow.com/comment/42032022
has comment: http://stackoverflow.com/comment/42032759
type: Question
has answer: http://stackoverflow.com/a/26721214
score: 3
has comment: http://stackoverflow.com/comment/42032240
upvote count: 5
has comment: http://stackoverflow.com/comment/42032186
linked to: http://stackoverflow.com/q/13102045
answer count: 3
has answer: http://stackoverflow.com/a/26721276
favorite count: 0
type: UnansweredQuestion
has body: I have created a program as part of my computing work for checking stock and it works fine however, after the user has gone through the program once checking stock of one item, they are asked if they would like to check stock of another item which is where the same line is printed twice and I can't figure out why?. This is the code: import java.util.*; public class stock { public static void main(String[] args) { //initialising the scanners Scanner stock = new Scanner(System.in); Scanner levels = new Scanner(System.in); Scanner bar = new Scanner(System.in); Scanner choice = new Scanner(System.in); //initialising the string variables String chocolate; String chocolate2; String change; String choiceb; //initialising the integer variables int mars = 200; int twix = 200; int bounty = 200; int doubled = 200; int galaxy = 200; int change2; int counter = 1; int a = 1; //asking the user what chocolate bar they want to check stock of System.out.println("Enter the chocolate bar to check stock of: Mars, Twix, Bounty, Double and Galaxy"); System.out.println("***********************************"); chocolate = stock.nextLine(); System.out.println("***********************************"); //depending on the users choice, this switch statement outputs the appropriate stock level of the bar entered switch (chocolate.toLowerCase()) { case ("mars"): System.out.println("There is currenty " + mars + " in stock"); break; case ("twix"): System.out.println("There is currenty " + twix + " in stock"); break; case ("bounty"): System.out.println("There is currenty " + bounty + " in stock"); break; case ("double"): System.out.println("There is currenty " + doubled + " in stock"); break; case ("galaxy"): System.out.println("There is currenty " + galaxy + " in stock"); break; default: System.out.println("Your an idiot, try again"); chocolate = stock.nextLine(); } //the user is then asked if they want to change stock level of any of the chocolate bars System.out.println("Do you want to change stock …
has title: Why is this line printed twice?
has answer: http://stackoverflow.com/a/26721275
has comment: http://stackoverflow.com/comment/42032208
has comment: http://stackoverflow.com/comment/42032303
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/42075750
type: QuestionComment
comment on: http://stackoverflow.com/q/26744914
has text: That's broad, you might want to rephrase
score: 0
type: Comment

http://stackoverflow.com/q/26767585
type: Question
tagged with: recursion
tagged with: java
tagged with: int
score: 0
answer count: 1
tagged with: string
has body: hello i worked on a recursive method to convert from int to string fully manual way, and i wanna know if that recursive method is efficient or not, and if you could help me to improve the code. Im new to algorithms so don't blame me if something looks like ugly... I've search on the internet but never looked for something like that : public class IntToString { public static String intToString(int number) { return intToString(number, "", false); } private static String intToString(int number, String answer, boolean isNegative) { if (number &lt; 0 &amp;&amp; isNegative == false) { isNegative = true; number = -number; } if (number == 0) if (isNegative) return "-" + answer; else return answer; System.out.println(number); return intToString(number / 10, answer = number % 10 + answer, isNegative); } // test public static void main(String[] args) { String ans = intToString(-324234); System.out.println(ans); } }
has title: Recursive manual way to convert int to string (without anything like an array, a list, or parsing stuff) for positive and negative numbers
has comment: http://stackoverflow.com/comment/42116250
has comment: http://stackoverflow.com/comment/42116289
linked to: http://stackoverflow.com/q/11032015
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42116139
has answer: http://stackoverflow.com/a/26768150
accepted answer: http://stackoverflow.com/a/26768150

http://stackoverflow.com/q/26743505
score: 1
has title: JPA NOT IN statement
tagged with: java
tagged with: mysql
type: Question
has body: I have a app that uses MySQL, JPA with EclipseLink. I'm trying to get from the DB the collection of User flagged as "ACTIVE" and that are not already in a List already loaded in the application. That is my method: public List&lt;User&gt; findAllButUsers(List&lt;User&gt; users) { List&lt;User&gt; list = null; Query query = em.createQuery("SELECT u FROM User u WHERE u NOT IN :users AND u.status = :status"); query.setParameter("status", "ACTIVE"); query.setParameter("users", users); list = query.getResultList(); return list; } And the Log from server gives me that: Fine: SELECT iduser, create_time, email, name, password, salt, status FROM user WHERE ((iduser NOT IN (?)) AND (status = ?)) bind =&gt; [com.wa.gp.jpa.entities.User[ iduser=2 ], ACTIVE] From the bind => [com.wa.gp.jpa.entities.User[ iduser=2 ], ACTIVE] shows me that instead of binding the id it passes the value from User.toString method thus resulting in a Collection that includes the users passed. I thought it would work just sending the object to JPA and it would figure out the iduser by itself. I don't know if it is a expected behavior, looks to me it is. How can I just make that query without having to change the valor from tostring in User? Do I have to instead of giving the List of Users just pass a List of the Ids? If that is the case I just became said. Thanks
tagged with: jpa
downvote count: 0
tagged with: eclipselink
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/26767906
answers question: http://stackoverflow.com/q/26767782
downvote count: 0
has comment: http://stackoverflow.com/comment/42117116
type: Answer
has body: It uses a ServletOutputStream from the Javadoc, Provides an output stream for sending binary data to the client. A ServletOutputStream object is normally retrieved via the ServletResponse.getOutputStream() method. If you look at System.out you can see that it's a PrintStream which is a different implementation of OutputStream.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42117067

opencmis
tags question: http://stackoverflow.com/q/26700632
type: Tag
tag name: opencmis

http://stackoverflow.com/q/26703630
downvote count: 0
answer count: 1
tagged with: aop
favorite count: 0
has answer: http://stackoverflow.com/a/26837548
has body: My Class: @Aspect public class ServiceAspect { @Before("execution(public * com.test.server.support.service.*.Client.*(..))") public void before(JoinPoint joinPoint) { System.out.println("...."); } } spring-config.xml Content Only: &lt;context:annotation-config/&gt; spring-servlet.xml: &lt;mvc:annotation-driven/&gt; &lt;mvc:default-servlet-handler/&gt; &lt;context:component-scan base-package="com.test.client.support"&gt; &lt;context:include-filter type="aspectj" expression="com.test.client.support.aspect.ServiceAspect"/&gt; &lt;/context:component-scan&gt; &lt;context:component-scan base-package="com.test.manager"/&gt; &lt;aop:aspectj-autoproxy proxy-target-class="true"/&gt; I hope in this way can then xxx.Client each class the following method call, the connection is automatically created. When the current operation of the project, AOP no response. However, if theBefore ("execution (public * com.test.server.support.service.*.Client.*(..))") IntoPointcut ("@within (org.springframework.stereotype.Controller)") , you can enter before method Note: Client class is automatically generated Thrift IDL.
type: UnansweredQuestion
has title: Spring AOP: How to intercept inner class?
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/42016798
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42041809
has comment: http://stackoverflow.com/comment/42239668
has comment: http://stackoverflow.com/comment/42056988
type: Question

http://stackoverflow.com/a/26682990
downvote count: 0
has body: You were on the right track with creating a new Document, parsing the parts and add their nodes to the new ones. Your approach failed because you tried to append a whole document to another one which is not possible. You could try something like this: public org.w3c.dom.Document concatXmlDocuments(String rootElementName, InputStream... xmlInputStreams) throws ParserConfigurationException, SAXException, IOException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); org.w3c.dom.Document result = builder.newDocument(); org.w3c.dom.Element rootElement = result.createElement(rootElementName); result.appendChild(rootElement); for(InputStream is : xmlInputStreams) { org.w3c.dom.Document document = builder.parse(is); org.w3c.dom.Element root = document.getDocumentElement(); NodeList childNodes = root.getChildNodes(); for(int i = 0; i < childNodes.getLength(); i++) { Node importNode = result.importNode(childNodes.item(i), true); rootElement.appendChild(importNode); } } return result; } The code above copies all nodes found under the root element of each document. Of course you can choose to selectively copy only the nodes you are interested in. The resulting document will reflect all the nodes from both documents. Test @Test public void concatXmlDocuments() throws ParserConfigurationException, SAXException, IOException, TransformerException { try ( InputStream doc1 = new ByteArrayInputStream(( " \r\n" + " doc1 value \r\n" + " ").getBytes(StandardCharsets.UTF_8)); InputStream doc2 = new ByteArrayInputStream(( " \r\n" + " doc2 value \r\n" + " ").getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream docR = new ByteArrayOutputStream(); ) { org.w3c.dom.Document result = concatXmlDocuments("headerTag", doc1, doc2); TransformerFactory trf = TransformerFactory.newInstance(); Transformer tr = trf.newTransformer(); tr.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(result); StreamResult sr = new StreamResult(docR); t…
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41967351
accepted answer of: http://stackoverflow.com/q/26681471
answers question: http://stackoverflow.com/q/26681471
has comment: http://stackoverflow.com/comment/41975297
has comment: http://stackoverflow.com/comment/41967688
type: AcceptedAnswer

http://stackoverflow.com/comment/41977116
score: 0
type: Comment
type: QuestionComment
has text: @mad There it is. I thought the other would run, sorry.
comment on: http://stackoverflow.com/q/26685753

http://stackoverflow.com/comment/42088304
comment on: http://stackoverflow.com/q/26752443
type: Comment
has text: How can i initialize this TextArea before the constructor?
score: 0
type: QuestionComment

gradle
tags question: http://stackoverflow.com/q/26754311
tags question: http://stackoverflow.com/q/26817902
tags question: http://stackoverflow.com/q/26733968
tags question: http://stackoverflow.com/q/26829417
tags question: http://stackoverflow.com/q/26774312
tags question: http://stackoverflow.com/q/26790116
tags question: http://stackoverflow.com/q/26712092
tags question: http://stackoverflow.com/q/26731044
tags question: http://stackoverflow.com/q/26830686
tags question: http://stackoverflow.com/q/26757788
tags question: http://stackoverflow.com/q/26689027
type: Tag
tags question: http://stackoverflow.com/q/26690157
tags question: http://stackoverflow.com/q/26773292
tags question: http://stackoverflow.com/q/26748915
tags question: http://stackoverflow.com/q/26707403
tags question: http://stackoverflow.com/q/26699386
tags question: http://stackoverflow.com/q/26782289
tags question: http://stackoverflow.com/q/26830295
tags question: http://stackoverflow.com/q/26745541
tags question: http://stackoverflow.com/q/26722993
tags question: http://stackoverflow.com/q/26827580
tag name: gradle
tags question: http://stackoverflow.com/q/26805760
tags question: http://stackoverflow.com/q/26805614
tags question: http://stackoverflow.com/q/26802394
tags question: http://stackoverflow.com/q/26714263
tags question: http://stackoverflow.com/q/26677075
tags question: http://stackoverflow.com/q/26677915
tags question: http://stackoverflow.com/q/26730423
tags question: http://stackoverflow.com/q/26760101
tags question: http://stackoverflow.com/q/26707648
tags question: http://stackoverflow.com/q/26690817
tags question: http://stackoverflow.com/q/26682656
tags question: http://stackoverflow.com/q/26724001
tags question: http://stackoverflow.com/q/26824761
tags question: http://stackoverflow.com/q/26770190

http://stackoverflow.com/q/26774847
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26774886
favorite count: 0
has comment: http://stackoverflow.com/comment/42134567
has comment: http://stackoverflow.com/comment/42128607
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42163769
has title: Seperate date part and time part from SimpleDateFormat pattern
has body: In my UI application, I allow user to specify the Date format as per his choice which I use the same in further processing to format the dates. I want to separate the date part and time part from the pattern that is specified by the user. e.g. user specifies dd-MMM-yyyy HH:mm:ss then I would like to divide the date part i.e. dd-MMM-yyyy and time part i.e. HH:mm:ss. I know I can use SimpleDateFormat.toPattern() method which gives me entire format and then can do string manipulation. But I want to avoid that since user may give some ridiculous pattern such as yyyy:HH:ss:dd MMM-mm. In such case it would be very difficult to differentiate what represents date part and what is time part. Is there a standard java API method which does this? I checked the API but couldn't find it. Is there a third-party API which provides solution to this?
has comment: http://stackoverflow.com/comment/42131316
has comment: http://stackoverflow.com/comment/42130079
has comment: http://stackoverflow.com/comment/42135768
tagged with: java
has comment: http://stackoverflow.com/comment/42129158
type: Question
tagged with: simpledateformat
has comment: http://stackoverflow.com/comment/42138710
has comment: http://stackoverflow.com/comment/42140524
has comment: http://stackoverflow.com/comment/42128702
has comment: http://stackoverflow.com/comment/42167974
score: 0
has comment: http://stackoverflow.com/comment/42137823
upvote count: 1

hadoop
tags question: http://stackoverflow.com/q/26794633
tags question: http://stackoverflow.com/q/26829941
tags question: http://stackoverflow.com/q/26675414
tags question: http://stackoverflow.com/q/26685752
tags question: http://stackoverflow.com/q/26690129
tags question: http://stackoverflow.com/q/26727423
tags question: http://stackoverflow.com/q/26716168
tags question: http://stackoverflow.com/q/26793847
tag name: hadoop
tags question: http://stackoverflow.com/q/26681959
tags question: http://stackoverflow.com/q/26804669
tags question: http://stackoverflow.com/q/26779520
tags question: http://stackoverflow.com/q/26720499
tags question: http://stackoverflow.com/q/26807877
type: Tag
tags question: http://stackoverflow.com/q/26707114
tags question: http://stackoverflow.com/q/26743656
tags question: http://stackoverflow.com/q/26820745
tags question: http://stackoverflow.com/q/26711305
tags question: http://stackoverflow.com/q/26819626
tags question: http://stackoverflow.com/q/26723526
tags question: http://stackoverflow.com/q/26784812
tags question: http://stackoverflow.com/q/26748811
tags question: http://stackoverflow.com/q/26803026
tags question: http://stackoverflow.com/q/26763681
tags question: http://stackoverflow.com/q/26820230
tags question: http://stackoverflow.com/q/26821652
tags question: http://stackoverflow.com/q/26743762
tags question: http://stackoverflow.com/q/26747113
tags question: http://stackoverflow.com/q/26728504
tags question: http://stackoverflow.com/q/26820891
tags question: http://stackoverflow.com/q/26775512
tags question: http://stackoverflow.com/q/26775696
tags question: http://stackoverflow.com/q/26825926
tags question: http://stackoverflow.com/q/26773469
tags question: http://stackoverflow.com/q/26724228
tags question: http://stackoverflow.com/q/26783574
tags question: http://stackoverflow.com/q/26756430
tags question: http://stackoverflow.com/q/26700910
tags question: http://stackoverflow.com/q/26807547
tags question: http://stackoverflow.com/q/26758181
tags question: http://stackoverflow.com/q/26819605
tags question: http://stackoverflow.com/q/26707676
tags question: http://stackoverflow.com/q/26751098
tags question: http://stackoverflow.com/q/26804606
tags question: http://stackoverflow.com/q/26695749
tags question: http://stackoverflow.com/q/26719946
tags question: http://stackoverflow.com/q/26825570
tags question: http://stackoverflow.com/q/26767009
tags question: http://stackoverflow.com/q/26769412
tags question: http://stackoverflow.com/q/26720603

substring
tags question: http://stackoverflow.com/q/26711101
tags question: http://stackoverflow.com/q/26818614
type: Tag
tags question: http://stackoverflow.com/q/26703332
tags question: http://stackoverflow.com/q/26821792
tags question: http://stackoverflow.com/q/26749709
tags question: http://stackoverflow.com/q/26779497
tag name: substring
tags question: http://stackoverflow.com/q/26749560

http://stackoverflow.com/a/26716657
type: Answer
answers question: http://stackoverflow.com/q/26716458
has body: You need to use Spring input tag instead of HTML input tag. First define the namespace: &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt; Then use Spring input tag: &lt;form:input type="hidden" id="categoryId" path="categoryId" value="&lt;c:outvalue="${category.categoryId}"/&gt;" /&gt;
score: 0

http://stackoverflow.com/a/26808499
accepted answer of: http://stackoverflow.com/q/26725316
type: Answer
upvote count: 1
score: 1
has body: The basic idea is to use a custom SecurityContextRepository which discards user details that are saved in the http session. For a full example and a working project please take a look at my answer to a similar question here: Spring Security logoff a user while runtime
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26725316

http://stackoverflow.com/comment/41976154
type: QuestionComment
type: Comment
has text: @BoristheSpider wait a bit.
comment on: http://stackoverflow.com/q/26689550
score: 0

http://stackoverflow.com/q/26748668
has comment: http://stackoverflow.com/comment/42082212
type: AnsweredQuestion
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/42082168
type: Question
has comment: http://stackoverflow.com/comment/42082247
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42081892
tagged with: arraylist
score: 0
has body: I have two dimensional arrayList, and I want to replace the that is set in the program. The problem is, if i replace the value of arrayList by "ONE", it will work, if I replace it by another value bigger than one, the program enters into a loop. I am using the following syntax: arrayList.get(index).set(index2,VALUE) Basically this shouldn't be happening, cause I am not changing anything within the loops, or? My Questions is WHY? and How to fix it? the code that is (i assume) producing the problems is: if(mark.get(index1).get(index2) == 1 &amp;&amp; mark.get(i-1).get(j) != 1){ // Replace the value mark.get(i-1).set(j,1); flag = true; } EDIT: I removed my code, cause it gave the impression I wanted help with the code, i had posted it so that you know what I was talking about. thanks
has comment: http://stackoverflow.com/comment/42082166
has title: Replacing value of a two dimensional java ArrayList
has comment: http://stackoverflow.com/comment/42082195
accepted answer: http://stackoverflow.com/a/26748949
answer count: 1
has comment: http://stackoverflow.com/comment/42082085
has answer: http://stackoverflow.com/a/26748949

http://stackoverflow.com/comment/65587342
score: 0
type: AnswerComment
has text: @MarkusA. Can you help me with this http://stackoverflow.com/questions/39120828/how-to-draw-a-line-to-perfectly-align-top-of-a-text .Great answer by the way.
type: Comment
comment on: http://stackoverflow.com/a/26745653

http://stackoverflow.com/comment/42221002
type: QuestionComment
comment on: http://stackoverflow.com/q/26826437
has text: possible duplicate of [Android: Getting list of all files of a specific type](http://stackoverflow.com/questions/11015833/android-getting-list-of-all-files-of-a-specific-type)
score: 0
type: Comment

http://stackoverflow.com/q/26764423
tagged with: return
has answer: http://stackoverflow.com/a/26764566
downvote count: 5
has comment: http://stackoverflow.com/comment/42109881
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26764460
score: -5
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/42109782
has body: I've made a method that would take a string and an int and would return an int. I want to know why it isn't working. (NumSLHorizontal cannot be resolved to a variable) Here's the relevant part of the code for (int x = 1; x &lt;= H; x++) { System.out.println("Introduza os " + V + " valores das rua " + x); String RuaTemp = input.next(); Confirmador(RuaTemp, V); } System.out.println(NumSLHorizontal); input.close(); } public static int Confirmador (String RuaTemp, int V) { int NumSLHorizontal = 0; for (int z = 0; z &lt; V; z++) { char firstLetter = RuaTemp.charAt(z); if (firstLetter == '-') { NumSLHorizontal++; } } return NumSLHorizontal;
has comment: http://stackoverflow.com/comment/42109800
has answer: http://stackoverflow.com/a/26764461
favorite count: 0
tagged with: int
has title: Why is my method not returning an int?
has comment: http://stackoverflow.com/comment/42109766
answer count: 4
has answer: http://stackoverflow.com/a/26764529
upvote count: 0

http://stackoverflow.com/comment/42163702
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26794315
type: QuestionComment
has text: You put 300 ints onto a single line?

http://stackoverflow.com/a/33701729
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26816710
score: 1
has body: You will need to convert the .py file to .exe use Py2Exe. You can download it and follow the instructions to convert it.

http://stackoverflow.com/a/26795686
has comment: http://stackoverflow.com/comment/42186340
answers question: http://stackoverflow.com/q/26795483
has comment: http://stackoverflow.com/comment/42185582
type: Answer
has comment: http://stackoverflow.com/comment/42186112
downvote count: 0
has comment: http://stackoverflow.com/comment/42185170
has comment: http://stackoverflow.com/comment/42186203
has body: Since you're using SwingNode, your application actually uses JavaFX. JavaFX has a web browser component, you can read more about it here: Overview of the JavaFX WebView Component Here's a short example how to use it: WebView browser = new WebView(); WebEngine webEngine = browser.getEngine(); webEngine.load(url); url can be an address like "http://example.com" or it can point to a file or resource like: Paths.get("testPage.html").toURI().toURL(); If you have the HTML content as a String, you can load it like this: String htmlContent = "&lt;html&gt;....&lt;/html&gt;"; browser.getEngine().loadContent(htmlContent); If you want to insert images in the htmlContent, you can do it like this: URL url = Main.class.getResource("haha.jpg"); // haha.jpg is next to Main class String text = "&lt;html&gt;&lt;img src=\"" + url + "\" width=\"104\" height=\"142\" &gt; &lt;/html&gt;"; Or if you want to insert an image pointing to a fixed file on your computer, create the url like this: URL url = new File("C:/images/haha.jpg").toURI().toURL(); Or: URL url = Paths.get("C:/images/haha.jpg").toUri().toURL();
has comment: http://stackoverflow.com/comment/42186149
score: 1
has comment: http://stackoverflow.com/comment/42191737
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26795483

http://stackoverflow.com/comment/42092783
score: 0
type: Comment
type: QuestionComment
has text: I am not sure that I got it, but I think you need a new Map with the values of the first as keys and the keys of the first as values (list)...
comment on: http://stackoverflow.com/q/26754814

http://stackoverflow.com/comment/42060944
type: QuestionComment
has text: It's quite a common approach to terminate SSL at a load balancer or reverse proxy. You _might_ even get better performance that way. It would certainly be easy to scale as they'll be pretty lightweight and you can horizontally scale independently at any tier.
comment on: http://stackoverflow.com/q/26737284
score: 0
type: Comment

http://stackoverflow.com/a/26764389
has body: The easiest way to create an action that is disabled at startup is to use the platform’s New Action Wizard to create your action, and to create one that depends on a "context" -- this is, on finding a specific object in the global lookup. If no object is available in the lookup, as at startup, then the action will be disabled. The menu and toolbar graphic elements are bundled together with your action via the annotations. This means that enabled/disabled state of your context-aware action will automatically affect the icons in the menu and toolbar as well. This article by Geertjan Wielenga has a walkthrough on creating a context-aware action: http://netbeans.dzone.com/how-to-make-context-sensitive-actions When you want to enable your action, you will add the object on which the action depends into the global lookup, which will cause the action (and its graphic elements) to be enabled. This entry in the platform’s Developer FAQ has some examples of how to add an object to the global context: http://wiki.netbeans.org/DevFaqAddGlobalContext If you need to create an action that depends on a more complex set of conditions there is some discussion, as well as a code sample illustrating how to do this, in this platform developer list thread: http://forums.netbeans.org/ptopic55295.html The grayed-out versions of the icons that are shown when your action is disabled are created automatically by the platform. You only have to provide the "normal" non-grayed-out images. As for the icons of different sizes, it’s a matter of filename convention. If your annotation declares the icon with @ActionRegistration(iconBase = "image.png”), then you will provide a 16x16 image called “image.png” and a 24x24 version called “image24.png”. The platform will find and use the appropriate size in the menu and toolbar.
answers question: http://stackoverflow.com/q/26678213
has comment: http://stackoverflow.com/comment/93417936
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26678213
type: Answer
has comment: http://stackoverflow.com/comment/42132635

http://stackoverflow.com/q/26802482
type: UnansweredQuestion
has title: Static to non static method
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/42178380
has body: I am trying to move from a static main() to a non static method called paintComponent(), but the problem I am having is I can not move from Static to Non static in the way which I have. The class is a follows, where hunter and hunted are external classes: import javax.swing.JFrame; import java.awt.Graphics; public class Main extends JFrame{ //Public class: Available for all other classes to refer to private static final long serialVersionUID = -4511248732627763442L; public static void main(String[] args){ frame(); repaint(); move(); //Passes to the method move() in the class Main() } public static JFrame frame(){ JFrame frame = new JFrame("Hunter VS Hunted"); //Sets the window title frame.setExtendedState(JFrame.MAXIMIZED_BOTH); //Sets the size of the window frame.setVisible(true); //Says to display the window frame.setResizable(false); //Sets it so the screen cannot be adjusted frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Closes the window when the x is pushed System.out.println("Frame works."); return frame; } public void paintComponent(Graphics g){ super.paintComponents(g); //Assigns a graphics value to g, so that it can be passed to other methods Hunted.paint(g); Hunter.paint(g); System.out.println("Main.paintComponent works."); } public static void move(){ Hunter.move(); //Passes to move() in the Hunter class Hunted.move(); //Passes to move() in the Hunter class } } Bear in mind I am a beginner, so please try to keep it simple!
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42178326
has comment: http://stackoverflow.com/comment/42178257
has answer: http://stackoverflow.com/a/26802533
has answer: http://stackoverflow.com/a/26803222
score: 0
tagged with: paint
has comment: http://stackoverflow.com/comment/42180022

http://stackoverflow.com/q/26724764
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/26724780
tagged with: console
tagged with: token
accepted answer: http://stackoverflow.com/a/26730245
possible better answer: http://stackoverflow.com/a/26724780
has title: How to use Java Scanner console to input tokens from a String
has body: I have an assignment that asks for a form of input that I'm not familiar with. It requires that the input be one string and them we must pull an int and double from that string. I can't figure out how to do this with the required input statement "console.nextDouble()" and "console.nextInt()". I included the relevant part of the instructions below and the code that I wrote. Any insight on how this is supposed to be written would be helpful. Instructions: To get the maximum of 5 points on this part of the assignment, your program must accept input as 4 tokens and verify that the input is in an appropriate format. The first token will be either "amount" or "years" (without the quotes). If the first token is "amount", the next is the amount of the loan and should be read in using console.nextDouble(). If the first token is "years", the next token is the number of years and should be read in with console.nextInt(). If the first token was "amount", the third token should be "years" and the number of years is read in as the fourth token using console.nextInt(). If the first token was "years", the third token should be "amount" and the amount should be read in with console.nextDouble(). Any other tokens are considered invalid input. public static void main(String[] args) { final Scanner console = new Scanner(System.in); System.out.println("Project 2 written by KC"); System.out.println(); System.out.println("Enter the loan amount and loan duration in years,\nfor example amount 3000 years 2"); String input = console.nextLine(); String[] parts = input.split(" "); String part1 = parts[0]; String part2 = parts[1]; String part3= parts[2]; String part4 = parts[3]; if (part1.equals("amount")) { double amount = console.nextDouble(part2); int years = console.nextInt(part4); } else if (part1.equalsIgnoreCase("years")){ int years = console.nextInt(part2); double amount = console.nextDouble(part4); } int years= console.nextInt(); double rate = loanRate(amount); System.out.println("Loan …
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26730245
type: Question

http://stackoverflow.com/q/26707229
has answer: http://stackoverflow.com/a/26708015
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42007860
favorite count: 0
has comment: http://stackoverflow.com/comment/42007077
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42007070
tagged with: linked-list
has body: What do the following snippets of code result in? Suppose x is a linked-list link a. x.setNext( x.getNext().getNext() ); b. t.setNext (x.getNext()); x.setNext (t); c. x.setNext(t); t.setNext(x.getNext());
has comment: http://stackoverflow.com/comment/42007099
tagged with: java
downvote count: 3
has title: Linked List code samples

http://stackoverflow.com/a/26757174
has comment: http://stackoverflow.com/comment/42097235
score: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26756785
has comment: http://stackoverflow.com/comment/42149501
has comment: http://stackoverflow.com/comment/42197987
has comment: http://stackoverflow.com/comment/42100521
downvote count: 1
has body: Assuming you're talking about Google Cloud Endpoints, it's simply a service to provide a REST API to your application — they do not provide storage. In the case of Java, you would write your business logic as normal, then annotate your classes to expose them in your REST API. Cloud Endpoints will generate your client libraries (Android, iOS, Javascript) for you to call your API methods remotely. How you store your data is up to your application - i.e. what you implement in Java. That could be Cloud SQL, Datastore, or something else running on a Compute Engine instance.
has comment: http://stackoverflow.com/comment/42153025

http://stackoverflow.com/comment/42249784
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26826299
has text: "the **minimum** guesses" for any number is always 1.

http://stackoverflow.com/q/26757440
upvote count: 1
has answer: http://stackoverflow.com/a/26757736
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42096820
downvote count: 2
tagged with: dst
has comment: http://stackoverflow.com/comment/42096664
has comment: http://stackoverflow.com/comment/42096771
has body: How and where to update JDK 1.6, Daylight Saving Time properties ? Kindly provide me a solution for both windows and linux platforms.
type: UnansweredQuestion
has title: Updating Day Light Saving time properties for JDK 1.6
has comment: http://stackoverflow.com/comment/42096694
has comment: http://stackoverflow.com/comment/42096884
tagged with: java
score: -1
type: Question

http://stackoverflow.com/q/26775624
has comment: http://stackoverflow.com/comment/42130051
has comment: http://stackoverflow.com/comment/42130272
downvote count: 0
tagged with: layout-manager
possible better answer: http://stackoverflow.com/a/26776033
has answer: http://stackoverflow.com/a/26776033
has comment: http://stackoverflow.com/comment/42130052
has body: I would like to keep a panel I have created using an absolute layout in the center of my window even when the window is resized (if possible). I've come across a couple of suggestions here and [here][2] but no dice! Below is my sample code, any ideas or suggestions? I have no problems centered a single component like a JLable but I want to center a panel with many components! import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.BorderFactory; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.border.Border; import javax.swing.JLabel; public class TestPanel extends JFrame { private JLabel lblSetupTitle; private Border compoundBorder, outlineColorBorder, outlineBorder; private JTextArea txtrManageData; private JPanel childPanel; public TestPanel() { setBackground(Color.white); outlineColorBorder = BorderFactory.createLineBorder(Color.gray); outlineBorder = BorderFactory.createEmptyBorder(20, 20, 20, 20); compoundBorder = BorderFactory.createCompoundBorder(outlineColorBorder, outlineBorder); lblSetupTitle = new JLabel("Setup"); lblSetupTitle.setBounds(443, 288, 44, 23); txtrManageData = new JTextArea("Text Area Text"); txtrManageData.setBounds(393, 322, 142, 61); childPanel = new JPanel(); childPanel.setLocation(89, 38); childPanel.setSize(921, 452); childPanel.setBorder(compoundBorder); setupGUIElements(); setupPanel(); } private void setupGUIElements() { txtrManageData.setBackground(null); txtrManageData.setLineWrap(true); txtrManageData.setWrapStyleWord(true); } private void setupPanel() { getContentPane().setLayout(new GridBagLayout()); // set layout of parent panel to GridBagLayout childPanel.setLayout(null); // set layout of child panel to AbsoluteLayout childPanel.add(lblSetupTitle); childPanel.add(txtrManageData); getContentPane().add(childPanel, new GridBagConstraints()); this.setSize(1020, 500); } public static void ma…
score: 1
has answer: http://stackoverflow.com/a/26776307
favorite count: 0
has comment: http://stackoverflow.com/comment/42130318
accepted answer: http://stackoverflow.com/a/26776307
upvote count: 1
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: null-layout-manager
tagged with: java
has comment: http://stackoverflow.com/comment/42130431
has comment: http://stackoverflow.com/comment/42130292
has title: Center panel when window resized
type: Question
tagged with: gridbaglayout
answer count: 2
linked to: http://stackoverflow.com/q/5621338

http://stackoverflow.com/a/78720233
has comment: http://stackoverflow.com/comment/138795837
score: 0
has body: public String loadSheetInDatabase(String inputFile) throws ClassNotFoundException, SQLException { try { XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(inputFile)); // Get first sheet from the workbook XSSFSheet sheet = wb.getSheetAt(0); Row row; Cell cell; // Iterate through each rows from first sheet Iterator < Row > rowIterator = sheet.iterator(); Boolean parsedHeaders = false; List < String > headers = new ArrayList < String > (); List < String > rowValues = null; while (rowIterator.hasNext()) { row = rowIterator.next(); if (parsedHeaders) { rowValues = new ArrayList <String> (); } // System.out.println ("Row No.: " + row.getRowNum ()); // For each row, iterate through each columns Iterator < Cell > cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); if (!parsedHeaders) { headers.add(cell.getStringCellValue()); } else { rowValues.add(cell.getStringCellValue()); } } if(!parsedHeaders){ parsedHeaders = true; }else{ String rowValuesString = ""; for(String fieldValue : rowValues){ rowValuesString += fieldValue + " "; } System.out.println(rowValuesString); InsertRowInDB(headers, rowValues); System.out.println(""); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return "success"; } public void InsertRowInDB(List<String> headers, List<String> values) throws SQLException, ClassNotFoundException { Class.forName("org.postgresql.Driver"); System.out.println("connected"); Connection conn = DriverManager.getConnection("jdbc:postgresql:postgres", "postgres", "sridevi"); String insertColumns = ""; String preparedStatementClause = ""; for(int i = 0; i < headers.size(); i++){ String fieldValue = headers.get(i); insertColumns += fieldValue; preparedStatementClause += "?"; if(i <= (headers.size() - 1)){ insertColumns += ", "; preparedStatementClause += ", "; } } String query = String.format( "Insert into excel(%s) values(%s)" , insertColumns, preparedStatementClause); P…
type: Answer
answers question: http://stackoverflow.com/q/26709945

http://stackoverflow.com/q/26739083
has comment: http://stackoverflow.com/comment/42064010
answer count: 5
linked to: http://stackoverflow.com/q/2137755
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26739169
duplicate of: http://stackoverflow.com/q/2137755
has answer: http://stackoverflow.com/a/26739195
has comment: http://stackoverflow.com/comment/42064050
tagged with: java
linked to: http://stackoverflow.com/q/409784
tagged with: loops
has answer: http://stackoverflow.com/a/26739183
type: Question
has answer: http://stackoverflow.com/a/26740179
tagged with: arrays
score: 0
has title: How do I reverse my array to print out the array in reverse?
has answer: http://stackoverflow.com/a/26739172
has body: public class BubbleSort { public static void main(String []args) { int[] values = {45, 67, 12, 34, 25, 39}; int pass, comparison, temp; String results = ""; for (pass = 1; pass &lt;= values.length - 1; pass++) { for (comparison = 1; comparison &lt;= values.length - pass; comparison++) { if (values[comparison - 1] &gt; values[comparison]) { temp = values[comparison - 1]; values[comparison - 1] = values[comparison]; values[comparison] = temp; } } } for (int i = 0; i &lt; values.length; i++){ results += values[i] + "\n"; } System.out.print(results); } } That's my code. It prints out: 12 25 34 39 45 67 How do I reverse it so it prints out: 67 45 39 34 25 12 Also, how do I just print the array out normally like: 45 67 12 34 25 39 I'm stuck on how to print them out.

http://stackoverflow.com/a/26848623
downvote count: 0
answers question: http://stackoverflow.com/q/26716246
type: Answer
has comment: http://stackoverflow.com/comment/42284191
has body: If I translate your query to Java language, what you are trying to do is getting value of coutry directly out of employee. In Java you would get a compile error though. Such thing automatically does not work neither in Java, nor in Hibernate or plain SQL. There is no direct link between employee and country, but there is a sequence of links employee -> address -> country. To fix this in Java way, one could maitain a secondary reference to country directly from employee. Then calling employee.getAddress().getCountry() and employee.getCountry() would be equal. To achieve this in hibernate, you would need to add new field country to Employee and map it as a non-modifiable many-to-many relationship with entity Country, using entity Address to map the relationship. This would only reduce 2 hibernate joins to one, it could not be applied recurrently to more than 2 joins. If this solution is OK for you, I can provide you with example syntax.
score: 1
has comment: http://stackoverflow.com/comment/44042385
upvote count: 1

http://stackoverflow.com/q/26769419
has body: When I try to compile the following java code I get the above error. Here is the Java code. import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.security.KeyStore; import java.security.MessageDigest; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; public class InstallCert { public static void main(String[] args) throws Exception { String host; int port; char[] passphrase; if ((args.length == 1) || (args.length == 2)) { String[] c = args[0].split(":"); host = c[0]; port = (c.length == 1) ? 443 : Integer.parseInt(c[1]); String p = (args.length == 1) ? "changeit" : args[1]; passphrase = p.toCharArray(); } else { System.out.println("Usage: java InstallCert &lt;host&gt;[:port] [passphrase]"); return; } File file = new File("jssecacerts"); if (file.isFile() == false) { char SEP = File.separatorChar; File dir = new File(System.getProperty("java.home") + SEP + "lib" + SEP + "security"); file = new File(dir, "jssecacerts"); if (file.isFile() == false) { file = new File(dir, "cacerts"); } } System.out.println("Loading KeyStore " + file + "..."); InputStream in = new FileInputStream(file); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(in, passphrase); in.close(); SSLContext context = SSLContext.getInstance("TLS"); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0]; SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); context.init(null,…
score: 0
answer count: 1
tagged with: exception
type: UnansweredQuestion
has title: How to correct the unknow host exception error
has comment: http://stackoverflow.com/comment/42135972
has comment: http://stackoverflow.com/comment/42120574
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26779153

http://stackoverflow.com/q/26764260
downvote count: 0
answer count: 0
type: Question
has body: After adding Google OAuth2 API v. 2 (listed as "preferred") from Google API loader (right click on Project -> Google -> Add Google APIs...) in Eclipse, my servlet fails with following traceback: java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at com.some.my.backend.MyServlet.myMethod(MyServlet.java:268) and so on. Everything compiles OK and "Run on Server" otherwise works normally. I assume something is broken with the way Eclipse deploys the web app to Tomcat. I also tried to download the Google client zip by hand, unpacked it and added all the jars to the Java Build Path from Project Properties. The result was the same. I am trying to compile the Checker class of this article. Isn't adding Google APIs supposed to be as simple as described above? What am I doing wrong?
score: 1
tagged with: java
tagged with: eclipse
tagged with: google-oauth
upvote count: 1
has title: ClassNotFound Exception while trying to use Google OAuth API on Eclipse & Tomcat
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26785027
has title: PayPal REST API returning error code 500 for payment verification
type: Question
has body: I have a problem with the Paypal REST API and the verification of a mobile (Android) payment. Tried to follow this guide: https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ There are 5 different steps to reach verification: Your app makes a successful payment with a PayPal Mobile SDK. Your app sends data about the payment to your server Your server can store the payment id value in a database. From your server, use the payment id value to look up the payment details with the REST API. You verify the payment details, as described below. Now I am stuck at point 4. I have no problem getting the access token from "api.sandbox.paypal.com/v1/oauth2/token" but when I am trying to look up the payment with "api.sandbox.paypal.com/v1/payments/payment/" I get an HTTP response code: 500. private static String getPaymentVerification(String paymentId, String accessToken) { try { System.out.println("Verify Payment."); URL url = new URL("https://api.sandbox.paypal.com/v1/payments/payment/"+ paymentId); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setRequestMethod("GET"); uc.setDoOutput(true); uc.setRequestProperty("Content-Type", "application/json"); uc.setRequestProperty("Authorization", "Bearer "+accessToken); DataOutputStream wr = new DataOutputStream(uc.getOutputStream()); wr.flush(); wr.close(); InputStream is = uc.getInputStream(); This is the code of the method till exception occurs. I am using mobile Paypal SDK 2.3.3.
upvote count: 1
tagged with: paypal
has comment: http://stackoverflow.com/comment/42192592
tagged with: java
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: rest
has comment: http://stackoverflow.com/comment/42281753
score: 1
favorite count: 0

http://stackoverflow.com/a/26747611
has body: It looks like you somehow have slf4j configured as the implementation of java.util.logging and then a different slf4j is on the classpath, or something like that. Here are some docs on how java.util.logging gets configured: http://docs.oracle.com/javase/7/docs/api/java/util/logging/LogManager.html I might check environment variables (JAVA_OPTS ? SBT_OPTS ?) and maybe poke around for mentions of slf4j in some file in JAVA_HOME. Just a guess really...
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26726085

http://stackoverflow.com/a/26761692
has body: Moving a robot in Karel/Becker can only move a single step at a time. By design, of course. From the documentation. If you wish to move 6 spaces forward, you will need to do a for loop: for(int i = 0; i &lt; 6; i++) { robot.move(); } Or call robot.move() 6 times: robot.move(); robot.move(); robot.move(); robot.move(); robot.move(); robot.move(); Alternatively, can create a method to move it multiple times. void customMove(int move) { for(int i = 0; i &lt; move; i++) { robot.move(); } } Then a call of customMove(6); will move Karel forwards 6 times. Obviously, to avoid breaking Karel, you should check if it's clear before moving, but this is a conceptual design for movement.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26761530
answers question: http://stackoverflow.com/q/26761530
score: 0
type: Answer

http://stackoverflow.com/comment/42154181
comment on: http://stackoverflow.com/q/26787911
has text: Exactly, when the button is pressed I want that the list will be created step by step. When the first result (the first element of the list) is ready, I want it to see it in the table. But now it does not happen that. When the button is pressed, nothing happens since everything is taken from the web. After 30 seconds I see the whole list complete. Of corse the order is not needed.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41997405
type: QuestionComment
comment on: http://stackoverflow.com/q/26701934
has text: Hint: "async" vs. sync/blocking
score: 0
type: Comment

http://stackoverflow.com/q/26781457
possible better answer: http://stackoverflow.com/a/41068853
has comment: http://stackoverflow.com/comment/42192385
tagged with: algorithm
has title: Efficiently calculate the number of equal-value-pairs in array with O(nlogn) time O(1) space
tagged with: java
has answer: http://stackoverflow.com/a/41068853
tagged with: duplicates
has comment: http://stackoverflow.com/comment/42140523
has comment: http://stackoverflow.com/comment/42160975
type: Question
favorite count: 0
score: 0
has body: Given an array of int values: {4, 2, 6, 5, 4, 4, 5} the index of qualified pairs are {0, 4} {0, 5} {4, 5} {3, 6} the 2nd index should be greater than the 1st index. So the correct result is 4. Please note worst-case time complexity is O(nlogn), worst-case space complexity is O(1). Naive solution: two loops, but O(n^2). My solution: quick sort the array, then become {2, 4, 4, 4, 5, 5, 6}, calculate the number of element if it appears more than once: e.g.: the number of 4 is 3, count+=3*2/2=3, the number of 5 is 2, count+=2*1/2=1. Problem of my solution: worst-case can have O(n^2), but it requires O(1) space, so i didn't choose merge sort. Could anyone help give a good solution? Thank you.
has comment: http://stackoverflow.com/comment/42165704
answer count: 3
has comment: http://stackoverflow.com/comment/42165568
has answer: http://stackoverflow.com/a/26781841
upvote count: 1
has answer: http://stackoverflow.com/a/62904587
downvote count: 1
accepted answer: http://stackoverflow.com/a/26781841
type: AnsweredQuestion

http://stackoverflow.com/comment/41994108
has text: @almasshaikh this method is called inside the class for the custom tag Select, in the method `doStartTag(...)`.
comment on: http://stackoverflow.com/q/26699753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26702297
has comment: http://stackoverflow.com/comment/42007332
has comment: http://stackoverflow.com/comment/42044163
has comment: http://stackoverflow.com/comment/42045218
has comment: http://stackoverflow.com/comment/42043099
has comment: http://stackoverflow.com/comment/42045321
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26700315
has comment: http://stackoverflow.com/comment/41998973
has comment: http://stackoverflow.com/comment/42044089
has body: My sources -- show() show(int timeout) hide() isShowing() onTouchEvent() All notes are in the code public class ViewImageVideoFragment extends Fragment { private int position = 0; private MediaController mMediaController; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMediaController = new MediaController(getActivity()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { if (savedInstanceState != null) { position = savedInstanceState.getInt("position"); } v = inflater.inflate(R.layout.fragment_video_view, parent, false); mVideoView = (VideoView) v.findViewById(R.id.fragmentVideoView); mVideoView.setVideoPath(videoPath); mVideoView.setMediaController(mMediaController); mVideoView.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent motionEvent) { if (mVideoView.isPlaying()) { mVideoView.pause(); /* Ok, so now you want to use that show(), preferrably without the int timeout I didn't add it in myself but you should be able to handle it yourself */ return true; } else /* I changed it to else, change it to if else if you have something specific you want to deal with */ { /* I would use that hide method I linked here, then start the video, I assume you know how to play the video yourself */ } return false; } }); mVideoView.seekTo(position); mVideoView.start(); } @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); if (mVideoView != null) { savedInstanceState.putInt("position", mVideoView.getCurrentPosition()); } mVideoView.pause(); } } I provided the other methods because, depending on how you may continue, they may or may not prevent future questions.
has comment: http://stackoverflow.com/comment/42045309
has comment: http://stackoverflow.com/comment/42045293
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42031735
has text: Are these six distinct methods, or six distinct tests? Once you throw *one* exception, you're done unless you retry the method - and you'll keep getting the same exception unless you vary your input.
score: 1
comment on: http://stackoverflow.com/q/26720795
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43160069
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26826357
has text: @RavindraBairagi you should still be able to accept answers to a question you asked. If I understand [this post](http://meta.stackexchange.com/a/5235) correctly this works by clicking the check-mark under the vote-counter.

http://stackoverflow.com/a/26735420
has body: The following code snippet shows the entire configuration process: ConfigurationDBRef dbConfig = new ConfigurationDBRef(); dbConfig.setDriverManagerConnection("org.postgresql.Driver", "jdbc:postgresql://localhost:5432/database_name", "user", "password"); Configuration engineConfig = new Configuration(); engineConfig.addDatabaseReference("database_alias", dbConfig); esperEngine = EPServiceProviderManager.getDefaultProvider(engineConfig); And that's it. esperEngine will be your engine instance prepared to communicate with database_name with database_alias as the query statemet alias (used in the query's FROM clause) You can install a query in Esper's instance in the following manner: String statement = "SELECT datastream.column1, rel.column2" + "FROM Datastream.Measure AS datastream, " + "sql:database_alias ['SELECT column2 " + "FROM \"SchemaX\".\"TableY\" ] AS rel"; //Install this query in the engine EPStatement queryEngineObject = esperEngine.getEPAdministrator().createEPL(statement); //Associate a Listener to this query MyQueryListener listener = new MyQueryListener(); //that implements UpdateListener Interface queryEngineObject.addListener(listener);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26735044
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26735044
type: Answer
has comment: http://stackoverflow.com/comment/47265212

http://stackoverflow.com/q/26674192
has title: How to save a in-application edited txt file in java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41948007
possible better answer: http://stackoverflow.com/a/26674608
tagged with: java
tagged with: save
tagged with: file
has comment: http://stackoverflow.com/comment/41948051
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41947956
has body: I'm stuck on how to save a file in a text editor i'm creating.Here's my code if you can help me import java.awt.*; import java.awt.event.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import javax.swing.*; import javax.swing.border.*; public class test1 { public static void main ( String[] args ) { JButton b1 = new JButton("Press to read a file"); JPanel middlePanel = new JPanel (); middlePanel.setBorder ( new TitledBorder ( new EtchedBorder (), "Text Reading Box" ) ); // create the middle panel components final JTextArea display = new JTextArea ( 16, 58 ); display.setEditable ( false); JScrollPane scroll = new JScrollPane ( display ); scroll.setVerticalScrollBarPolicy ( ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ); //Add Text area in to middle panel middlePanel.add ( scroll ); // My code JFrame frame = new JFrame ("Text Reader 0.4 Beta"); frame.add ( middlePanel ); frame.add(b1, BorderLayout.NORTH); frame.pack (); frame.setLocationRelativeTo ( null ); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible ( true ); frame.setLayout(new BorderLayout()); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(null); File f = chooser.getSelectedFile(); String filename = f.getAbsolutePath(); try { FileReader reader = new FileReader(filename); BufferedReader br = new BufferedReader(reader); display.read(br, null); br.close(); display.requestFocus(); } catch(Exception error) { System.err.println("Could'nt read a file"); } } }); } }
has answer: http://stackoverflow.com/a/26674608
has comment: http://stackoverflow.com/comment/41948080
has comment: http://stackoverflow.com/comment/41948072
has answer: http://stackoverflow.com/a/26674367
accepted answer: http://stackoverflow.com/a/26674367

http://stackoverflow.com/q/26824761
tagged with: java
tagged with: gradle
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/64521637
has answer: http://stackoverflow.com/a/39888666
downvote count: 0
has body: When I try running gradle test, I get the following output: $ gradle test :ro:compileJava UP-TO-DATE :ro:processResources UP-TO-DATE :ro:classes UP-TO-DATE :ro:jar :compileJava :processResources UP-TO-DATE :classes :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test ro.idea.ToggleTest &gt; testIsAd FAILED java.lang.NoClassDefFoundError at ToggleTest.java:13 Caused by: java.lang.ClassNotFoundException at ToggleTest.java:13 ro.idea.ToggleTest &gt; testToggle FAILED java.lang.NoClassDefFoundError at ToggleTest.java:13 2 tests completed, 2 failed :test FAILED So I want to check my classpath to see whether my classpath is wrong or not. My question is: How can I list the classpath at test time with a Gradle task?
has answer: http://stackoverflow.com/a/70768152
upvote count: 28
has answer: http://stackoverflow.com/a/71312206
tagged with: groovy
has answer: http://stackoverflow.com/a/26825979
answer count: 7
favorite count: 0
score: 28
has answer: http://stackoverflow.com/a/70801630
type: UnansweredQuestion
has title: How to list classpath for tests in Gradle
has answer: http://stackoverflow.com/a/61561802

http://stackoverflow.com/q/26815954
has body: Does anybody knows how can I create sub folders under the WEB-INF/lib and make it visible for Eclipse? I have a lot of jars what I should put under the lib and I want to separate them with sub folders (like WEB-INF/lib/spring/anyjars, WEB-INF/lib/hibernate/hibernatefolders/anyjars). In Eclipse it automatically adds any jars to web app libraries which is under WEB-INF/lib, but it does not do the same with jars in subfolder. Please help me to solve my "sorting" issue
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
downvote count: 0
favorite count: 0
has title: Using subfolders in lib in a dynamic Java web project in Eclipse

http://stackoverflow.com/a/26795380
accepted answer of: http://stackoverflow.com/q/26795311
upvote count: 2
answers question: http://stackoverflow.com/q/26795311
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Looks like you don't have the selenium-android-driver jar. But the Android driver has been replaced by selendriod. Instead you should do: WebDriver driver = new RemoteWebDriver(DesiredCapabilities.android());
type: Answer

http://stackoverflow.com/comment/42012140
type: Comment
has text: @OM No, since each server thread sends the message to a single client. The first thread, servicing the first client, didn't send "12", since count wasn't two when it was evaluated. If the first client will send additional input to the server, the server thread's `String line = br.readLine()` call would stop blocking, and the code that checks count and sends "12" will be reached again.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26709920

http://stackoverflow.com/comment/42039942
type: AnswerComment
comment on: http://stackoverflow.com/a/26724321
type: Comment
has text: Okay, gotcha. So, that would store the database in the same directory as the Java files, correct?
score: 0

http://stackoverflow.com/q/26821519
tagged with: java
has body: I've been reading Norman Maurer's presentation on Netty best practices and had a question about using direct buffers versus heap buffers. One slide recommends "always use direct ByteBuffer when writing to SocketChannel," but another encourages using heap buffers when using MessageToByteEncoder. I don't think I quite get the nuances in the second slide; in the MessageToByteEncoder case, why does using heap buffers "save extra byte copies?" Thanks!
has answer: http://stackoverflow.com/a/26821646
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26821646
has title: Buffer types for MessageToByteEncoder in Netty
score: 0
linked to: http://stackoverflow.com/q/5670862
tagged with: netty
type: AnsweredQuestion

http://stackoverflow.com/q/26683777
type: Question
tagged with: java
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/41966517
downvote count: 0
has title: log4j FileAppender not writing in Linux
has comment: http://stackoverflow.com/comment/42075565
favorite count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/41966084
tagged with: fileappender
has body: In a standalone application I'm using log4j for logging and have configured it with the following properties file: # Root logger option log4j.rootLogger=WARN, file, stdout log4j.logger.com.tr = INFO # Direct log messages to a log file log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=log4j.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # 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 In Windows this works as expected, producing a log4j.log file in the current working directory. When I run the application in Linux, it reports no error but does not generate the log file. The logger outputs to console just fine. I tried programatically changing the File property from a relative path to an absolute path and that changed nothing. I've also verified that if I supply an invalid file name the tool reports an error saying the file cannot be generated. So I'm baffled as to why no error is being reported and no file is being generated. I've searched my hard disk for the file to verify it's not being generated elsewhere, and it's not. Any help here would be much appreciated.
has comment: http://stackoverflow.com/comment/128447660
tagged with: log4j
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42075526
has comment: http://stackoverflow.com/comment/42033679
tagged with: logging

http://stackoverflow.com/comment/79114285
type: Comment
comment on: http://stackoverflow.com/a/39104056
score: 2
type: AnswerComment
has text: This is changing the android.support.v7.widget.AppCompatCheckBox color also

http://stackoverflow.com/q/26704201
answer count: 2
accepted answer: http://stackoverflow.com/a/26704338
favorite count: 0
has comment: http://stackoverflow.com/comment/87942229
possible better answer: http://stackoverflow.com/a/50464183
has answer: http://stackoverflow.com/a/50464183
has comment: http://stackoverflow.com/comment/94435451
tagged with: linked-list
tagged with: shuffle
has title: Shuffling a singly linked list using up to log N extra memory and N log N time
has body: I am trying to shuffle a linked list by recursively, breaking it into two lists and then merging them to ensure a random shuffle. The two problems I face are: While I run the program, there is an infinite loop at line 56 where I tell the program to shuffle the first list. I am unable to figure out how to add a dummy variable in case the lengths of list 1 and list 2 vary to ensure randomness in shuffling. PS - I found it through internet search that the length of 2 lists should be same to ensure randomness but I do not know the logic behind it. Also, please let me know if there is a better way of doing it than I am trying. Thanks in advance! public class LinkedListShuffle { static public class LinkedList&lt;E&gt; // static nested class { private int N = 0; private Node first = null; public class Node { E elem; Node next; } public boolean isEmpty() { return N == 0; } public void push (E elem) { Node oldfirst = first; first = new Node(); first.elem = elem; first.next = oldfirst; N++; } public E pop() { E elem = first.elem; first = first.next; N--; return elem; } public int size () { return N; } } public static void shuffle(LinkedList l) { if (l.size() == 1) return; LinkedList.Node current = l.first; LinkedList l1 = new LinkedList(); LinkedList l2 = new LinkedList(); while (! l.isEmpty()) { l1.push(l.pop()); if (! l.isEmpty()) l2.push(l.pop()); } shuffle(l1); shuffle(l2); /*------------------------------------------ * if (l2.size() &lt; l1.size()) * introduce a dummy node to ensure the * randomness in the process of shuffling -----------------------------------------*/ merge(l, l1, l2); /*----------------------------------------------- * remove the dummy variable * ----------------------------------------------*/ } public static void merge (LinkedList l, LinkedList l1, LinkedList l2) { while (l1.size() != 0 &amp;&amp; l2.size() != 0) { double chance = StdRandom.uniform(1); if (chance &lt; 0.5) l.push(l1.pop()); else l.push(l2.pop()); } if (! l1.isEmpty()) while (! l1.is…
upvote count: 1
has answer: http://stackoverflow.com/a/26704338
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/26712230
type: AnsweredQuestion
score: 1
has body: I want to implement a program where there is: A MySQLConnection class that handles the database connection A Screen class for the GUI that takes input to be stored in the DB Main class I want to call the MySQLConnection object created in the main method from the Screen class. What I have attempted so far - erroneously- is as follows. Pointers to resolve this problem are greatly appreciated. Thanks in advance! Main Class: public class Main { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { //Start main screen Screen start = new Screen(); start.setVisible(true); //create db connection **MySQLConnection sqlConn = new MySQLConnection(); Connection con=sqlConn.connectToDatabase();** } catch (Exception e) { e.printStackTrace(); } } }); MySQL Connection class: public class MySQLConnection { public Connection connectToDatabase() {//connect to db } public void addToDatabase(String tableName, ArrayList&lt;String&gt; columns, ArrayList&lt;String&gt; values) {//add a row to table in db} public void closeConnection() {//close db connection} } AddScreen class: public class Screen extends JFrame{ ArrayList&lt;String&gt; mainValues= new ArrayList&lt;String&gt;(); //Create GUI public Screen(){ ... ArrayList&lt;String&gt; mainValues= new ArrayList&lt;String&gt;(); String mainId = mainI.getText(); String mainName = mainN.getText(); mainValues.add(mainId); mainValues.add(mainName); } public void saveToDatabase() { String[] mainColumns= {"mid", "mname"}; **con.addToDatabase("main_category", mainColumns, mainValues);** } }
favorite count: 0
type: Question
answer count: 2
tagged with: jdbc
upvote count: 1
possible better answer: http://stackoverflow.com/a/26712358
has answer: http://stackoverflow.com/a/26712358
has answer: http://stackoverflow.com/a/26712898
accepted answer: http://stackoverflow.com/a/26712898
tagged with: java
tagged with: mysql
downvote count: 0
has title: Accessing a database connection object from another class

http://stackoverflow.com/q/26714086
has body: I have a Maven multi module/profile project whose test resources are apparently not being applied when running the test module. These resources define which data base the aplication will work (one is my create.sql script file): DROP DATABASE IF EXISTS "${db.name}"; CREATE DATABASE "${db.name}" WITH TEMPLATE = template0 OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default CONNECTION LIMIT = -1; The 'project' structure is: project/ pom.xml //packing: pom | +-- core/ pom.xml //packing: war | +-- module-a/ pom.xml //packing: jar | +-- module-b/ pom.xml //packing: jar | +-- test/ pom.xml //packing: jar +-- ** src/test/resources/create.sql ** The root 'project' pom is defined as: <?xml ... maven-4.0.0.xsd"> pom core module-a module-b test org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 The 'core' definition is the war application itself: <?xml ... maven-4.0.0.xsd"> 4.0.0 war dev-a dev-a **<db.name>db</db.name>** true true ... module-a 1.0-SNAPSHOT dev-b dev-b **<db.name>db</db.name>** true ... module-b 1.0-SNAPSHOT test-a test-a **<db.name>db_test</db.name>** <selenium.context>http://127.0.0.1:9999/${profileName}</selenium.context> ... module-a 1.0-SNAPSHOT test-b test-b **<db.name>db_test</db.name>** <selenium.context>http://127.0.0.1:9999/${profileName}</selenium.context> ... module-b 1.0-SNAPSHOT ${profileName}##${app.version}.${maven.build.timestamp} maven-war-plugin 2.5 true false false <addDefaultImplementationEntries>true</addDefaultImplementationEntries> <Implementation-Version>${project.artifactId}#${maven.build.timestamp}</Implementation-Version> src/main/resources true **/* src/test/resources true **/* The module definitions are quite simple and similar (module-b is supressed): <?xml ... maven-4.0.0.xsd"> 4.0.0 module-a 1.0-SNAPSHOT jar And finally my test module, a jar module that encapsultes some cucumber tests and sql script files: <?xml ... maven-4.0.0.xsd"> 4.0.0 jar ... module-a 1.0-SNAPSHOT ... module-b 1.0-SNAPSHOT ... core 1.0-SNAPSHOT…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26912877
answer count: 1
tagged with: postgresql
score: 0
type: UnansweredQuestion
has title: Maven testResources not being applied in a multi module/profile project
tagged with: intellij-13
tagged with: maven

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/26794181
tags question: http://stackoverflow.com/q/26749830
type: Tag

http://stackoverflow.com/comment/42082748
score: 1
comment on: http://stackoverflow.com/a/26748979
type: AnswerComment
has text: `ArrayList<T>` doesn't have that constructor. What you're thinking of is `Arrays.asList(T...)` :)
type: Comment

http://stackoverflow.com/comment/42101509
has text: Why don't you just parse the file after you created it from the inputstream ? Just create a FileInputStream on the file.
comment on: http://stackoverflow.com/q/26756467
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26789205
has title: Alphabetize strings (without using compareTo Method)
has comment: http://stackoverflow.com/comment/42154792
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42154684
tagged with: java
possible better answer: http://stackoverflow.com/a/37466405
type: Question
has answer: http://stackoverflow.com/a/26789294
accepted answer: http://stackoverflow.com/a/26789294
tagged with: compareto
has comment: http://stackoverflow.com/comment/42155144
has body: I'm trying to sort an array of strings without using compareTo(), but I am getting stuck on my while loop. Is there a way to alphabetically sort strings without using compareTo() or Arrays.sort()? public class mycode { public static void main(String[ ] args) { String[ ] ar = {"hello", "java", "elephant", "array"}; mycode.display(ar); mycode.bubbleSort(ar); mycode.display(ar); } static void display(String[] ar) { System.out.println("***********************"); for(int i = 0; i &lt; ar.length; i++) { System.out.println(ar[i]); } System.out.println("***********************"); } static void bubbleSort(String[] ar) { int theFollower; for(int currStart = 1; currStart &lt; ar.length; currStart++) { theFollower = currStart; while(theFollower != 0 &amp;&amp; ar[theFollower] &lt; ar[theFollower - 1]) //this is where my problem is { String swap = ar[theFollower]; ar[theFollower] = ar[theFollower - 1]; ar[theFollower - 1] = swap; theFollower--; } } } } Alphabetization is my goal, so my output would be the following *********************** hello java elephant array *********************** *********************** array elephant hello java *********************** I added this method using the idea that was suggested, but I am unsure what I would put in place to run through the index of the string int alphabetize(String a, String b) { String A = a.toLowerCase(); String B = b.toLowerCase(); if (A &lt; B) { return -1; } else if (A &gt; B) { return 1; } else { } }
tagged with: sorting
has comment: http://stackoverflow.com/comment/42154712
has answer: http://stackoverflow.com/a/26789261
has comment: http://stackoverflow.com/comment/42155013
score: 0
has comment: http://stackoverflow.com/comment/42154651
answer count: 3
tagged with: while-loop
has answer: http://stackoverflow.com/a/37466405
tagged with: string

http://stackoverflow.com/comment/42156449
has text: Thank you very much, i just have a final question. Do i have to use if (list.get(index) == null) or can i not just use if (list(index) == null)?
score: 0
comment on: http://stackoverflow.com/a/26789632
type: AnswerComment
type: Comment

http://stackoverflow.com/a/65586348
has body: Using custom implementation as @Predrag Maric suggest is clearly the right answer for this question. However, I find doing detach in Service layer is much better as normally it knows that the entity should be detached or not. Just wire it with @PersistenceContext in Service. @Service class ConsumerServiceImpl { @PersistenceContext private EntityManager entityManager ... entityManager.detach(en)
type: Answer
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/26795436
downvote count: 0

http://stackoverflow.com/comment/42191935
comment on: http://stackoverflow.com/q/26809635
type: Comment
type: QuestionComment
has text: What output? I don't see any. Also, the lack of consistent indentation makes it harder to read.
score: 2

http://stackoverflow.com/q/26689929
answer count: 9
has answer: http://stackoverflow.com/a/26690501
has comment: http://stackoverflow.com/comment/41976819
has answer: http://stackoverflow.com/a/26689965
type: AnsweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/63322608
has comment: http://stackoverflow.com/comment/41976828
tagged with: java
has answer: http://stackoverflow.com/a/26691276
has answer: http://stackoverflow.com/a/51183406
possible better answer: http://stackoverflow.com/a/26689965
upvote count: 10
type: Question
tagged with: pow
accepted answer: http://stackoverflow.com/a/26691276
has comment: http://stackoverflow.com/comment/41976706
has answer: http://stackoverflow.com/a/51644510
score: 10
has answer: http://stackoverflow.com/a/26690031
has title: Power function using recursion
has answer: http://stackoverflow.com/a/36996864
has body: I have to write a power method in Java. It receives two ints and it doesn't matter if they are positive or negative numbers. It should have complexity of O(logN). It also must use recursion. My current code gets two numbers but the result I keep outputting is zero, and I can't figure out why. import java.util.Scanner; public class Powers { public static void main(String[] args) { float a; float n; float res; Scanner in = new Scanner(System.in); System.out.print("Enter int a "); a = in.nextFloat(); System.out.print("Enter int n "); n = in.nextFloat(); res = powers.pow(a, n); System.out.print(res); } public static float pow(float a, float n) { float result = 0; if (n == 0) { return 1; } else if (n &lt; 0) { result = result * pow(a, n + 1); } else if (n &gt; 0) { result = result * pow(a, n - 1); } return result; } }
has comment: http://stackoverflow.com/comment/41976730
downvote count: 0
has comment: http://stackoverflow.com/comment/41976983
has answer: http://stackoverflow.com/a/59098043
favorite count: 0

http://stackoverflow.com/q/26682265
has answer: http://stackoverflow.com/a/26682325
tagged with: java
score: -1
has title: Issues With SQL update statement in JDBC
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/26682724
upvote count: 0
has comment: http://stackoverflow.com/comment/41963496
favorite count: 0
has comment: http://stackoverflow.com/comment/41963238
tagged with: jdbc
has body: code throws java.sql.SQLDataException: Invalid character string format for type INTEGER each time i run , i don't seem to know what the problem is private void update(){ connection(); try{ String sqldb = "update votersInfo set votersName = ? , age = ?,state = ? where votersId =?" ; prep = conn.prepareStatement(sqldb); //int intA = Integer.parseInt(jTextField1.getText()); prep.setInt(1, Integer.parseInt(jTextField1.getText())); prep.setString(2, jTextField2.getText()); prep.setInt(3, Integer.parseInt(jTextField3.getText())); prep.setString(4, jTextField4.getText()); int a = prep.executeUpdate(); if (a&gt;0){ JOptionPane.showMessageDialog(rootPane, "Sucessful"); } } catch(Exception e){ // System.err.println(e.printStackTrace()); e.printStackTrace(); } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26682724
has comment: http://stackoverflow.com/comment/41963225
possible better answer: http://stackoverflow.com/a/26682325
downvote count: 1
type: Question

http://stackoverflow.com/comment/42093720
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26755690
has text: Write method like `getStatus(boolean status)` and return different enum value depending on `status` value

http://stackoverflow.com/comment/42218493
comment on: http://stackoverflow.com/q/26824638
type: Comment
has text: My Code looks a little irritated now (Tray Class) . My first idea was like you say check frame and switch state. But i had many problems with that thats why i do here a workaround. First i was simply switching it but the JFrame was going flashing like off on off on off on
type: QuestionComment
score: 0

http://stackoverflow.com/q/26686456
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: replaceall
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26686970
has title: How to Perform Regular Expression in JTextArea of Swing
tagged with: regex
upvote count: 2
tagged with: java
answer count: 1
tagged with: jtextarea
has body: I want to Replace all Matched words with given Regular Expression.I wrote code for that.But,It just replace it but that particular action was not performed.When I select the Regular Expression then I click on Replace All,It will replace with particular action,not replace with the given String/Character. For example My input is "\n",Matched String/Character replace with New line Action,not replace new Line Character.Please check it and help me.Thank you. My Code: public class RegularExp extends javax.swing.JFrame { JTextArea text; int i=0; UndoManager undoManager = new UndoManager(); public RegularExp() { initComponents(); text = new JTextArea(); replace.setEnabled(false); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); open = new javax.swing.JMenuItem(); replace = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); fileMenu.setText("File"); open.setText("Open"); open.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openActionPerformed(evt); } }); fileMenu.add(open); replace.setText("Replace"); replace.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceActionPerformed(evt); } }); fileMenu.add(replace); jMenuBar1.add(fileMenu); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addCompone…
has answer: http://stackoverflow.com/a/26686970

http://stackoverflow.com/comment/41983540
has text: Sorry should've mentioned this is a JSP. Outside of <% %> is HTML. Out is the browser.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26694107
score: 0

http://stackoverflow.com/q/26686361
answer count: 2
accepted answer: http://stackoverflow.com/a/26686386
tagged with: return
has title: How to stop the method from returning null once finished going through the ArrayList?
type: AnsweredQuestion
tagged with: oop
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/26686386
type: Question
possible better answer: http://stackoverflow.com/a/26686390
has body: I'm having a problem with my code, where I go through an ArrayList and get currentVehicle and return it to display in a GUI interface. I'm having issues when reaching the end of the ArrayList and it begins to return 'null'. As it returns 'null' I can't go back to previous vehicles, as the currentVehicle value is now assigned as 'null'. I have tried using while loops to restart the loop, else, and else if loops and using lastIndexOf and isEmpty to check the ArrayList and attempt to get it to re-loop. Below is the code for the ArrayList in which I'm searching for the next vehicle in the list, and where I believe the fix may exist. Showroom.java public Vehicle nextVehicle() { Vehicle nV = null; try { if (currentVehicle &lt; vehicleArray.size()) { nV = vehicleArray.get(currentVehicle++); } } catch(Exception e) { System.out.println("No more vehicles listed"); } return nV; } GUIMain is where the output is happening and I'm printing to a JPanel TextArea GUIMain.java public void actionPerformed(ActionEvent e) { if(e.getSource() == nextButt) { log.setText(null); log.append("" + s.nextVehicle()); } } log.setText(null); clears the JPanel textbox for the next Vehicle to be displayed and log.append("" + s.nextVehicle()); prints the currentVehicle onto the JPanel TextArea. Any help would be greatly appreciated. If any other code is needed or a SSCCE is required I'll go ahead and get it done.
has answer: http://stackoverflow.com/a/26686390
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/42009299
score: 0
comment on: http://stackoverflow.com/q/26681429
type: Comment
type: QuestionComment
has text: @SiKing - I only want to make some temporary script for a small web test. I don't want to become a QA automation developer. That is why. Please give me +1. I got a -1 for no reason. I am a beginner. I can't get everything right.

http://stackoverflow.com/comment/42027467
type: Comment
type: QuestionComment
score: 0
has text: public class list_view_comments{} is my adapter only example create i send drawable android image bue i need send array from json url image in my adapter how to change drawable to string url?
comment on: http://stackoverflow.com/q/26718336

http://stackoverflow.com/comment/41987821
type: QuestionComment
comment on: http://stackoverflow.com/q/26696482
has text: ... you could get the information that you need from one of the answers that have been provided for you.
score: 0
type: Comment

http://stackoverflow.com/comment/55110969
score: 1
has text: I'm just looking through questions without an answer. This seems to be solved... Please create an answer yourself and mark it as accepted. Otherwise this question will remain on the "questions without an answer" list for ever, thx!
comment on: http://stackoverflow.com/q/26790924
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42144731
has text: Why are you using `mHandler.post(this)` in the runnable? Try to avoid this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26783038
score: 0

http://stackoverflow.com/q/26808687
type: AnsweredQuestion
tagged with: command-line
score: 1
tagged with: java
upvote count: 1
has body: I'm a relatively new programmer and I'm using Java to build a hangman game. My questions mainly have to do with what I will call "timing and/or events"(if you feel there is a better description please let me know). When my application starts execution a few things happen: 1) It displays a greeting message("Welcome to Java Hangman..."), 2) it calls startgame(), one of the things that startgame() does is calls drawman(o), this display an empty gallows, 3) if you are winning(which of course you would be since the game just started), a questions is displayed for the user to try and answer(all of this code is bellow). My questions/what I would like to do is: 1) have the greeting message "flash"(appear and disappear) every 2 seconds, WHILE the empty gallows(manZero()) is being "built" on the screen, 2) to "build" the empty gallows, either start at the "top" or "bottom" and display a different "pieces"(String) of the gallows every 2 seconds until complete, 3) once the last piece of the gallows if "built", greeting message stops "flashing" and then user is prompted with the first question. End result: game begins, greeting message "flashes", while gallows is being "built", after last piece of gallows is added, greeting stops "flashing" and question is posed. Described another way, output would look something like this: //application begins execution System.out.println("Welcome to Java Hangman...");// greet flashes every two seconds // meanwhile the gallows is being built below greet public void manZero() { System.out.println("_____"); // 2 sec after that this string appears("last piece") System.out.println("| |"); // 2 seconds after that this string appears System.out.println("| "); // 2 seconds after that this string appears System.out.println("| "); // 2 seconds later this string appears System.out.println("| "); // first this string appears When the "last piece" appears in the output, greeting stops flashing, the empty gallows(manZero()) is intact, and the first question…
type: Question
has answer: http://stackoverflow.com/a/26809084
has answer: http://stackoverflow.com/a/26808833
answer count: 2
downvote count: 0
tagged with: events
possible better answer: http://stackoverflow.com/a/26808833
favorite count: 0
tagged with: command
accepted answer: http://stackoverflow.com/a/26809084
has title: Java, Timing, Events

http://stackoverflow.com/comment/52326388
type: QuestionComment
comment on: http://stackoverflow.com/q/26808725
has text: Can u paste your layout xml code here?
score: 0
type: Comment

http://stackoverflow.com/a/26700360
score: 1
answers question: http://stackoverflow.com/q/26700265
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41994762
has body: You could use the Random class. like this: Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(14); and then do a switch on randomInt according to your array. http://www.javapractices.com/topic/TopicAction.do?Id=62
has comment: http://stackoverflow.com/comment/41994885
downvote count: 0

http://stackoverflow.com/comment/42230195
comment on: http://stackoverflow.com/a/26831708
type: Comment
has text: Also, there's some weird weird stuff happening: I tried to just delegate neutralMode() to queryPatternMode(), so I print panels size on neutralMode() and then call queryPatternMode() and print panels size again. And the collections size is still different! first zero and then 20! The method scope is the only thing defining the collections visible size!
type: AnswerComment
score: 0

http://stackoverflow.com/a/26772203
downvote count: 0
answers question: http://stackoverflow.com/q/26772158
type: Answer
has comment: http://stackoverflow.com/comment/42124157
upvote count: 1
score: 1
has body: Try to change below code: List&lt;String&gt; items = Arrays.asList(Pricing.split(",")); List&lt;String&gt; r = new ArrayList&lt;String&gt;(); for(int j=0;j&lt;items.size();j++) { r.add(items.get(i)); } via List&lt;String&gt; items = Arrays.asList(Pricing.split(",")); List&lt;String&gt; r = new ArrayList&lt;String&gt;(); for(int j=0;j&lt;items.size();j++) { r.add(items.get(j)); } because u use i instead of j.

http://stackoverflow.com/q/26703765
tagged with: box2d
has title: Can't Run html libgdx with libgdx-utils
has answer: http://stackoverflow.com/a/26705442
type: AnsweredQuestion
downvote count: 0
type: Question
score: 1
accepted answer: http://stackoverflow.com/a/26705442
favorite count: 0
upvote count: 1
has body: Im trying to compile my libgdx game, its working for android and desktop, but not HTML GWT. Im using Intellij / Gradle for the project. I just added the libgdx-utils extension lib found here which seems to be causing the error: https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions The error i get when attempting this gradle command ./gradlew html:dist is: :html:compileGwt Compiling module com.xx.xx.GdxDefinition Validating units: [ERROR] Errors in 'file:/xx/xx/xx/screens/GameScreen.java' [ERROR] Line 66: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module? [ERROR] Aborting compile due to errors in some input files :html:compileGwt FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':html:compileGwt'. &gt; Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 My Gradle file looks like this: buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.5' classpath 'com.android.tools.build:gradle:0.13+' classpath 'org.robovm:robovm-gradle-plugin:1.0.0-alpha-04' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appName = 'xxx-xxx' gdxVersion = '1.4.1' roboVMVersion = '1.0.0-alpha-04' box2DLightsVersion = '1.2' ashleyVersion = '1.3.1' aiVersion = '1.4.0' } repositories { mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/releases/" } } } project(":desktop") { apply plugin: "java" dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" } } project(":android") { apply plugi…
answer count: 1
tagged with: gwt
tagged with: libgdx
tagged with: java

http://stackoverflow.com/comment/42051575
comment on: http://stackoverflow.com/a/26731184
type: AnswerComment
has text: @David ten Hove can you also help me with this question: Do I have to change this.addMouseListener(new MouseAdapter) to cp.addMouseListener(new MouseAdapter)?
score: 0
type: Comment

http://stackoverflow.com/q/26800981
downvote count: 0
tagged with: blobstore
has comment: http://stackoverflow.com/comment/42183905
tagged with: google-app-engine
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42188412
type: Question
tagged with: gwt
has body: I'm trying to write a simple Google gwt Java-application running on AppEngine. I've created a jsp Upload form to upload a *.csv File: <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %> <%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %> <% BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); %> Upload Test <form action="<%= blobstoreService.createUploadUrl("/HelloWorld/ImportHandlerServlet") %>" method="post" enctype="multipart/form-data"> On the server side I wrote a new servlet that should convert the uploaded CSV file to an associated array using openCSV: import au.com.bytecode.opencsv.CSVReader; public class ImportHandlerServlet extends HttpServlet { private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { PrintWriter out = resp.getWriter(); Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(req); List<BlobKey> bkList = blobs.get("importCSV"); BlobKey blobKey = bkList.get(0); BlobstoreInputStream blobStream = new BlobstoreInputStream(blobKey); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(blobStream)); //Print out first line to check if BufferedReader is empty out.println(bufferedReader.readLine()); //New CSVReader object reading from bufferedReader CSVReader csvReader = new CSVReader(bufferedReader); //Add csv-Fields to two-dimensional array List<String[]> rows = csvReader.readAll(); String output[][] = rows.toArray(new String[rows.size()][]); out.println(output.length); } } If I upload a file the bufferedReader prints out the first line of the it. Therefore the bufferedReader isn't empty but the Array doesn't contain any values. Does anyone see a possible solution?
has comment: http://stackoverflow.com/comment/42190279
score: 1
has comment: http://stackoverflow.com/comment/42188634
tagged with: java
has title: Upload and parse csv in Google App Engine using blobstore
upvote count: 1

http://stackoverflow.com/a/26825520
accepted answer of: http://stackoverflow.com/q/26825480
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26825480
has comment: http://stackoverflow.com/comment/42219565
type: AcceptedAnswer
downvote count: 0
has body: The existing observer will not be removed. You can see this in the source code of Observable. The objects created are different, despite having the same type. They are both added to the vector of observers.

http://stackoverflow.com/a/26778238
type: Answer
has body: This is the solution: private void replaceScene(String resource, IControlledScreen controller) { try { controller.setApp(this); FXMLLoader loader = new FXMLLoader(getClass().getResource(resource)); loader.setController(controller); Pane screen = (Pane) loader.load(); stage.getScene().setRoot(screen); } catch (Exception e) { System.out.println("Cannot load resource " + resource); System.out.println(e.getMessage()); } }
upvote count: 2
answers question: http://stackoverflow.com/q/26768497
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42134833

http://stackoverflow.com/a/26682019
has body: I took Blaze Tama's advice and in my onClick Method: builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent menu = new Intent(context, MyOtherActivity.class); context.startActivity(menu); ((Activity) context).finish(); } }); It works! :D I hope this helps someone coming around this problem.
accepted answer of: http://stackoverflow.com/q/26681762
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26681762
score: 2

http://stackoverflow.com/q/26829688
has comment: http://stackoverflow.com/comment/42226710
has answer: http://stackoverflow.com/a/26830341
has comment: http://stackoverflow.com/comment/42226880
type: Question
has comment: http://stackoverflow.com/comment/42227041
has title: How to set multiple default source folders in Eclipse IDE for Java?
score: 4
has comment: http://stackoverflow.com/comment/42227096
has body: Using the following panel, I'm able to set a default source folder for new projects. I'd like to be able to have multiple default source folders created when I create a new project. Is there some particular format for specifying multiple folders? I've tried spaces, semicolons, brackets with no luck. Or, is there another panel for specifying multiple default folders for new projects?
answer count: 1
linked to: http://stackoverflow.com/q/513697
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42226836
upvote count: 4
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42048713
score: 0
has text: Then you have your answer, you are attempting to delete while you are iterating through the collection. You can't do that.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26730137

http://stackoverflow.com/comment/42128010
type: QuestionComment
comment on: http://stackoverflow.com/q/26757099
has text: Thanks for the link but I couldn't find a solution there.
score: 0
type: Comment

http://stackoverflow.com/q/26771054
tagged with: algorithm
has title: Algorithm to Model Averages
tagged with: math
tagged with: java
score: 0
answer count: 1
has body: I'm trying to build an algorithm that finds the ideal value from scattered points. Basically I have data like: Point 4.9 - value 200 Point 5.3 - value 940 Point 5.9 - value 640 Point 13.7 - value 300 And I need to build a mathematical curve (based on velocity and incline) that will approximate the highest point of this set as 5.5 with a value of 980. Any thoughts? Thanks so much!
has comment: http://stackoverflow.com/comment/42153672
type: UnansweredQuestion
tagged with: curve-fitting
tagged with: php
has answer: http://stackoverflow.com/a/26771483
type: Question

http://stackoverflow.com/q/26818307
has body: I have run into a hard to solve problem in Streams API. Well, it is solvable but not elegantly within a single call from what I can tell. Below, taking a stream of FeatureContentWeight objects, I want to group by feature and content and obtain maximum weights per Feature and Content. I get the values from the Map at the very end since I have no need for maintaining a Map. The problem is, I only want groups that have more than 3 items in them. So I want the maximum weights per feature and content for Feature,Content pairs that have exceeded a given count. In SQL this would just be a simple HAVING clause. In Streams API it doesn't look trivial but I have only been at Streams API for a few days now. Any ideas appreciated. Below is my approach, List&lt;FeatureContentWeight&gt; nearestNeighbors = neighborPostings .stream() .collect( groupingBy( p -&gt; FeatureContent.Create(p.getFeatureId(), p.getContentId()), collectingAndThen(maxBy(comparingDouble(FeatureContentWeight::getWeight)),Optional::get))).values();
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/26818308
score: 7
has answer: http://stackoverflow.com/a/32247897
has answer: http://stackoverflow.com/a/26818308
tagged with: stream
answer count: 3
upvote count: 7
tagged with: java-8
tagged with: java
has answer: http://stackoverflow.com/a/47331008
accepted answer: http://stackoverflow.com/a/32247897
has title: Java 8 Streams API HAVING clause equivalent in a GroupingBy?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/42814931
has text: Not too sure why that is, however have you tried echoing the path variable in a shell (command prompt). For instance `echo %JAVA_HOME%` does it spit out the right thing. Also even though your %JAVA_HOME% is set you still need to ensure the actual %PATH% system var includes the Java directory and also the ./bin directory for the version of Java you're using.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26801562

http://stackoverflow.com/comment/42116187
type: AnswerComment
has text: Posted code doesn't read `tw`. If you do somewhere, add a test for empty.
comment on: http://stackoverflow.com/a/26767251
type: Comment
score: 0

http://stackoverflow.com/q/26755755
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42094219
has comment: http://stackoverflow.com/comment/42094069
favorite count: 0
accepted answer: http://stackoverflow.com/a/26756111
possible better answer: http://stackoverflow.com/a/26756162
has comment: http://stackoverflow.com/comment/42093861
has answer: http://stackoverflow.com/a/26756162
has title: How to call Enum individual methods?
has comment: http://stackoverflow.com/comment/42093844
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/26756111
tagged with: enums
has comment: http://stackoverflow.com/comment/42094020
upvote count: 5
has comment: http://stackoverflow.com/comment/42094009
has body: I have an enum that might look like the one below. My goal is to have an enum with some common methods (I enforced this by adding an abstract method) and some "enum value individual" methods. The following code compiles: public enum MyEnum { VALUE { @Override public void syso() { System.out.println("VALUE syso"); } }, SPECIAL_VALUE { @Override public void syso() { System.out.println("SPECIAL_VALUE syso"); } public void sayHello() { System.out.println("Hello"); } }; public abstract void syso(); public static void main(String... args) { MyEnum.VALUE.syso(); MyEnum.SPECIAL_VALUE.syso(); } } Running this results in the following being printed: VALUE syso SPECIAL_VALUE syso However trying to call sayHello(), which I defined in SPECIAL_VALUE, does not work. Adding the following to the main method, does not compile anymore: public static void main(String... args) { MyEnum.SPECIAL_VALUE.sayHello(); // does not work } Why is that? It seems perfectly fine to me, but the method cannot be found. Is there any way to invoke this method? Maybe via reflection? I would like to avoid making this method abstract as well, because it does not make sense for any other enum values. I also cannot extend this enum and add this special method, while inheriting the common ones. I would also like to avoid adding some kind of singleton class to "simulate" this. Is it anyhow possible to run this? If not, what would be my best alternative?

http://stackoverflow.com/a/26747512
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26747426
downvote count: 0
has body: A simple and clean way: public static boolean allEqual(E[] array, E element) { for(E e : array) { if(e != element) { return false; } } return true; }

http://stackoverflow.com/a/26825682
score: -2
downvote count: 3
has comment: http://stackoverflow.com/comment/42220270
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42220574
has body: String string = "Bob Bakes Brownies"; List&lt;String&gt; list = Arrays.asList(string.split(" "));
has comment: http://stackoverflow.com/comment/42220137
answers question: http://stackoverflow.com/q/26825650

http://stackoverflow.com/q/26720071
tagged with: for-loop
answer count: 3
has answer: http://stackoverflow.com/a/46339432
accepted answer: http://stackoverflow.com/a/26720141
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
possible better answer: http://stackoverflow.com/a/26721635
has body: I'm bit lost here. I have a for loop which increases a value, something like this: int nu01 = 10000; int level = 0; int increase = 35000; for (int i = 0; i &lt; 100; i++) { nu01 = nu01 + increase; level++; System.out.println(nu01); if (level &gt; 50) { increase = 45000; } This works fine, but I need sum of all numbers from loop as total: loop: 10,20,30,40,50,70,90,120.... total:10,30,60,100,150,220,310,430... I tried: int total; total=nu01 + nu01; //or nu01 + nu01 + increase; But I get strange sums. So I need loop which increase numbers and sum of all those numbers. I hope this makes sense. Thanks.
has answer: http://stackoverflow.com/a/26721635
tagged with: sum
has answer: http://stackoverflow.com/a/26720141
has title: Java for loop (sum of numbers + total)
score: 0

http://stackoverflow.com/q/26794488
possible better answer: http://stackoverflow.com/a/26794639
has comment: http://stackoverflow.com/comment/42164278
upvote count: 2
has answer: http://stackoverflow.com/a/26794639
score: 0
downvote count: 2
answer count: 3
accepted answer: http://stackoverflow.com/a/26794812
has body: For my Intro CS class we have to create a program that finds a certain number, in this case, an address. The address falls within 1000 and 9999 and has to meet the following criteria: All four digits are different The digit in the thousands place is three times the digit in the tens place The number is odd The sum of the digits is 27 So far, I've been able to generate the range of numbers and narrow out the odd ones, but the rest is pretty confusing. Suggestions? for (int i = 1000; i &lt;= 9999; i++) { if (i % 2 == 1) System.out.print(i); else System.out.println(); }
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42163669
tagged with: java
tagged with: loops
linked to: http://stackoverflow.com/q/26556048
has answer: http://stackoverflow.com/a/26794637
has comment: http://stackoverflow.com/comment/42163764
has comment: http://stackoverflow.com/comment/42163728
tagged with: for-loop
duplicate of: http://stackoverflow.com/q/26556048
has title: Brute Force: Find Digits
has answer: http://stackoverflow.com/a/26794812
type: Question
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/a/26811809
type: Answer
answers question: http://stackoverflow.com/q/26811771
has body: The == operator is of lower precedence than +, so + gets execute first. "str1==str2" + str1 yields "str1==str2Haseeb". Then == executes, and "str1==str2Haseeb" is not the same object as "Haseeb" (str2), so false is printed. You can add parentheses to clarify the desired order of operations. System.out.println("str1==str2 " + (str1==str2) ); This should print str1==str2 false.
score: 12
upvote count: 12
downvote count: 0

http://stackoverflow.com/a/26729228
answers question: http://stackoverflow.com/q/26728628
downvote count: 0
type: Answer
has body: Ended up having to just run the code to see how the savefile is being produced. Seeing that NoSuchElement exception is coming from the second read from the file (input.nextInt()) pointed to the problem. If you don't beat the existing the streak (including getting TAILS as your first flip), you aren't prompted for a name. This makes the savefile read \n 1 \n Scanner by default ignore whitespace. You don't check if there is available input (hasNext methods). When you call the next() or nextInt() when there is no input you get NoSuchElement. Why is this happening from the save? Line by line: bestName = input.next(); &lt;-- This is getting the "1" since there is a name saved best = input.nextInt(); &lt;-- since the 1 was already read, so there's nothing to get That second input with the savefile after getting an initial TAILS, is causing your crash. Two solutions, make sure you are getting and saving the bestName in the else at the end of your main, or be more careful in reading the savefile. (edit) In general when using Scanner (or just about anything API that has a the hasNext()/next() style), it's best to call and check hasNext() before each next(). This will ensure you have something to get from the next(). Even if you don't think there is a possible reason for there not to be something there, having something like if(!foo.hasNext) { System.out.println("foo should really have something here, but hasNext says it doesn't); System.exit(); } will stop your code in its tracks if there is a problem, and give you a stop to add some debug statements to see what's going on.
upvote count: 1
score: 1

http://stackoverflow.com/a/26834184
has comment: http://stackoverflow.com/comment/42255926
downvote count: 0
has comment: http://stackoverflow.com/comment/42262266
answers question: http://stackoverflow.com/q/26829908
type: Answer
has comment: http://stackoverflow.com/comment/42262212
has body: You cannot do it in appengine-web.xml settings. Instead, you should instruct your servlet, which processes this request, to set the correct headers on a response when it returns an image, telling the browser that this image is cacheable.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42261402

http://stackoverflow.com/a/26827159
has body: I stored the Ids of the images which are shown by clicking the onClick() in an int-array, so I created something like a workaround to deal with that issue. My onClick() looks like this now: public void showPictureZoomDialog(View view) { int singlePicValue400 = 0; switch (view.getId()) { case R.id.picture_imgvw_pic1: singlePicValue400 = currentPicSite.getPicValues400()[0]; break; case R.id.picture_imgvw_pic2: singlePicValue400 = currentPicSite.getPicValues400()[1]; break; case R.id.picture_imgvw_pic3: singlePicValue400 = currentPicSite.getPicValues400()[2]; break; case R.id.picture_imgvw_pic4: singlePicValue400 = currentPicSite.getPicValues400()[3]; break; case R.id.picture_imgvw_pic5: singlePicValue400 = currentPicSite.getPicValues400()[4]; break; case R.id.picture_imgvw_pic6: singlePicValue400 = currentPicSite.getPicValues400()[5]; break; case R.id.picture_imgvw_pic7: singlePicValue400 = currentPicSite.getPicValues400()[6]; break; case R.id.picture_imgvw_pic8: singlePicValue400 = currentPicSite.getPicValues400()[7]; break; case R.id.picture_imgvw_pic9: singlePicValue400 = currentPicSite.getPicValues400()[8]; break; case R.id.picture_imgvw_pic10: singlePicValue400 = currentPicSite.getPicValues400()[9]; break; } Intent intent = new Intent(this, PictureZoomDialog.class); intent.putExtra("PICID", singlePicValue400); startActivity(intent); } I get the Id of the image I want to display via the Intent: public class PictureZoomDialog extends Activity { private ImageView mDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture_zoom_dialog); mDialog = (ImageView)findViewById(R.id.pictureactivity_imgvw_pic1); mDialog.setClickable(true); mDialog.setImageResource(getIntent().getIntExtra("PICID",-1)); mDialog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); } } Thx a lot guys for getting me in the right direction!
score: 0
answers question: http://stackoverflow.com/q/26823436
type: Answer

http://stackoverflow.com/a/45310257
score: 32
has comment: http://stackoverflow.com/comment/91445270
answers question: http://stackoverflow.com/q/26684562
has comment: http://stackoverflow.com/comment/85546014
downvote count: 0
has comment: http://stackoverflow.com/comment/85529886
has body: I have a feeling that most answers here overcomplicate the simple problem. If you already understand how the map works that should be fairly easy to grasp. There are cases where we can end up with unwanted nested structures when using map(), the flatMap() method is designed to overcome this by avoiding wrapping. Examples: 1 List&lt;List&lt;Integer&gt;&gt; result = Stream.of(Arrays.asList(1), Arrays.asList(2, 3)) .collect(Collectors.toList()); We can avoid having nested lists by using flatMap: List&lt;Integer&gt; result = Stream.of(Arrays.asList(1), Arrays.asList(2, 3)) .flatMap(i -&gt; i.stream()) .collect(Collectors.toList()); 2 Optional&lt;Optional&lt;String&gt;&gt; result = Optional.of(42) .map(id -&gt; findById(id)); Optional&lt;String&gt; result = Optional.of(42) .flatMap(id -&gt; findById(id)); where: private Optional&lt;String&gt; findById(Integer id)
type: Answer
upvote count: 32

http://stackoverflow.com/q/26755494
accepted answer: http://stackoverflow.com/a/26756349
type: Question
upvote count: 1
answer count: 1
tagged with: hazelcast
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/26756349
favorite count: 0
has body: Please note: if the cache systems mentioned in this question work so completely differently from one another that an answer to this question is nearly-impossible, then I would simplify this question down to anything that is just JCache (JSR107) compliant. The major players in the distributed cache game, for Java at least, are EhCache, Hazelcast and Infinispan. First of all, my understanding of a distributed cache is that it is a cache that lives inside a running JVM process, but that is constantly synchronizing its in-memory contents across other multiple JVM processes running elsewhere. Hence Process 1 (P1) is running on Machine 1 (M1), P2 is running on M2 and P3 is running on M3. An instance of the same distributed cache is running on all 3 processes, but they somehow all know about each other and are able to keep their caches synchronized with one another. I believe EhCache accomplishes this inter-process synchrony via JGroups. Not sure what the others are using. Furthermore, my understanding is that these configurations are limiting because, for each node/instance/process, you have to configure it and tell it about the other nodes/instances/processes in the system, so they can all sync their caches with one another. Something like this: &lt;cacheConfig&gt; &lt;peers&gt; &lt;instance uri="myapp01:12345" /&gt; &lt;instance uri="myapp02:12345" /&gt; &lt;instance uri="myapp03:12345" /&gt; &lt;/peers&gt; &lt;/cacheConfig&gt; So to begin with, if anything I have stated is incorrect or is mislead, please begin by correcting me! Assuming I'm more or less on track, then I'm confused how distributed caches could possibly work in an elastic/cloud environment where nodes are regulated by auto-scalers. One minute, load is peaking and there are 50 VMs serving your app. Hence, you would need 50 "peer instances" defined in your config. Then the next minute, load dwindles to a crawl and you only need 2 or 3 load balanced nodes. Since the number of "peer instances" is always chan…
tagged with: infinispan
tagged with: ehcache
downvote count: 0
has title: How do JCache compliant distributed caches work when your app is deployed to a cloud?
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26713536
linked to: http://stackoverflow.com/q/25424118
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42017964
has answer: http://stackoverflow.com/a/31471793
has body: getting the below exception in hibernate log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at com.javatpoint.mypackage.StoreData.main(StoreData.java:13) Caused by: org.dom4j.DocumentException: Connection refused: connect Nested exception: Connection refused: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) ... 2 more Hibernate config <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> create com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/platinum admin admin org.hibernate.dialect.MySQLDialect <mapping resource="employee.hbm.xml" /> </hibernate-configuration> Any suggestion?
has comment: http://stackoverflow.com/comment/42044851
has comment: http://stackoverflow.com/comment/42018024
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42018218
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42044160
has title: Could not parse configuration: hibernate.cfg.xml error
answer count: 2
has answer: http://stackoverflow.com/a/30589460
downvote count: 0

http://stackoverflow.com/comment/42125300
type: AnswerComment
has text: Try to change rlp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); to WRAP_CONTENT
type: Comment
comment on: http://stackoverflow.com/a/26772215
score: 1

http://stackoverflow.com/comment/42063969
has text: @AHungerArtist No I dont want the empty values
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26738386

http://stackoverflow.com/comment/42150126
has text: Is there any formal definition of "all short date formats" for any locale, even the US English locale? I mean, yes, we can think of several, but there are probably very few which are recommended by publishing style guides. As @PawełDyda points out, the Unicode CLDR is probably the only official source.
score: 0
comment on: http://stackoverflow.com/q/26782600
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42014813
has text: Were you in the same directory in cmd where the file was, when you executed the javac comment?
comment on: http://stackoverflow.com/a/26711451
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42136666
comment on: http://stackoverflow.com/q/26779273
type: Comment
type: QuestionComment
has text: @AvinashKumarPankaj how To do that ? sorry I'm beginner.
score: 0

http://stackoverflow.com/q/26770447
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42121472
tagged with: java
type: Question
has title: Output Error in RainFall Program in java
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/26770479
has comment: http://stackoverflow.com/comment/42121217
score: 0
has body: I wrote a program about calculating the average of raining in a year and give me the highest and the lowest amount but I am getting an error and I couldn't fix it. This is my main code : ` public class Rainfall { //field private double [] rain; public void Rainfall (double [] array) { rain = new double [array.length] ; for (int i=0; i &lt; array.length ; i++) rain [i] = array [i]; } //Methods public double getTotal() { double total = 0; for ( double r : rain) total +=r; return total; } public double getAverage () { double a = getTotal () / rain.length; return a; } public double getHighest () { double highest = rain [0]; for (int i=0 ; i &lt; rain.length; i++) { if (rain [i] &gt; highest) ; highest = rain [i]; } return highest; } public double getLowest () { double lowest = rain [0]; for ( int i=0; i &lt;rain.length; i++) { if (rain [i] &lt; lowest) ; lowest = rain [i]; } return lowest; } } ` and this is the demo : ` import java.util.Scanner; import java.text.DecimalFormat; public class RainFallDemo { public static void main (String [] args ) throws NullPointerException { final int year1 = 12; double [] rains = new double [year1]; getData (rains) ; Rainfall rainfallData = new Rainfall (); DecimalFormat values = new DecimalFormat ("#0.00") ; System.out.println("The total rain is" + values.format(rainfallData.getTotal())); System.out.println("The average is " + values.format (rainfallData.getAverage())); System.out.println("The highest rain is " + values.format (rainfallData.getHighest())); System.out.println("The lowest is " + values.format (rainfallData.getLowest())); } public static void getData (double [] array) { Scanner keyboard = new Scanner (System.in) ; for ( int i=0 ; i &lt; array.length; i++) { System.out.println ("what was the amont of rain for month " + (i + 1) + "?"); array [i] = keyboard.nextDouble (); while (array[i] &lt; 0 ) { System.out.print ( " Invalid input. You entered a negative number. Enter a" + "value that is greater than zero"); array [i] = k…

http://stackoverflow.com/q/26789009
accepted answer: http://stackoverflow.com/a/26789548
favorite count: 0
tagged with: doubly-linked-list
has answer: http://stackoverflow.com/a/26789548
type: AnsweredQuestion
downvote count: 0
has body: I implemented doubly linked lists using nodes in Java. My code for the Node and linked list classes are below. Any suggestions for improving the design and/or running times of the operations? public class Node implements Comparable&lt;Node&gt;{ Node next; Node previous; Object element; int index; public Node(Object element){ this.element = element; this.next = null; this.previous = null; } public Node(Object element, Node next, Node previous){ this.element = element; this.next = next; this.previous = previous; } public Node(Object element, Node next, Node previous, int index){ this.element = element; this.next = next; this.previous = previous; this.index = index; } //Getter Method public Node get_next(){ return this.next; } //For comparable class public int compareTo(Node x){ if (this.element.equals(x.element)){ return 0; } else return 1; } public boolean compare_index(int index){ if (this.index == index){ return true; } else return false; } } public class Mylinkedlists{ Node first_node; Node last_node; int size = 0; //Constructors public Mylinkedlists(Object element){ Node temp = new Node(element, last_node,first_node,0); first_node = new Node (null,temp,null); last_node = new Node(null,null,temp); size+=1; } public Mylinkedlists(){ first_node = new Node (null,last_node,null); last_node = new Node(null,null,first_node); } //Returns size of Node public int size(){ return size; } //Adds element to end of linked list public void add(Object element){ Node to_add = new Node(element); Node temp = last_node.previous; size+=1; //Pointer changes last_node.previous.next = to_add; last_node.previous = to_add; to_add.previous = temp; to_add.next = last_node; to_add.index = size-1; } //Inserts Element after node public void insert(Object add_after, Object element_to_add) throws NotFoundException{ Node current = first_node.next; Node insert_after = new Node(add_after); Node to_add = new Node(element_to_add); //find the node while (current.compareTo(insert_after) != 0){ current =…
score: 1
tagged with: java
type: Question
tagged with: implementation
tagged with: coding-efficiency
upvote count: 1
answer count: 1
has title: Efficiency of Doubly linked list implementation in java

http://stackoverflow.com/comment/42168939
has text: Could you post the stacktrace? It looks like an error in your Java code, possibly related to Spring-MVC.
score: 0
comment on: http://stackoverflow.com/q/26797277
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42202927
comment on: http://stackoverflow.com/q/26815995
type: QuestionComment
score: 2
has text: @BoristheSpider we could strap a rocket to one; that never ends badly ;)
type: Comment

http://stackoverflow.com/q/26717079
type: UnansweredQuestion
tagged with: double
has answer: http://stackoverflow.com/a/26717150
score: -5
has title: Converting from formatted string to double and vice versa
tagged with: java
has comment: http://stackoverflow.com/comment/42024328
has body: I need to convert formatted strings to double and vice versa. $40.00 will be 40.00 ( and vice versa ) $80,000.00 will be 80000.00 ( and vice versa ) So far I can format the string, by taking out the dollar symbol and commas, but I can't convert double back to the formatted string with the dollar symbol and commas in the right place.
has answer: http://stackoverflow.com/a/26717145
downvote count: 5
type: Question
has comment: http://stackoverflow.com/comment/42024226
answer count: 2
upvote count: 0
tagged with: string
tagged with: currency
linked to: http://stackoverflow.com/q/3075743
favorite count: 0
has comment: http://stackoverflow.com/comment/42024232

http://stackoverflow.com/a/26766462
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26741563
answers question: http://stackoverflow.com/q/26741563
type: Answer
has comment: http://stackoverflow.com/comment/68851814
has body: Seems this was the issue <?xml version="1.0" encoding="UTF-8"?> <class-loader delegate="true"/> Keep a copy of the generated servlet class' java code. ADMIN ADMIN USER USER Should be like this <?xml version="1.0" encoding="UTF-8"?> <class-loader delegate="true"/> Keep a copy of the generated servlet class' java code. ADMIN ADMIN USER USER I had the nested in the so that there were essentially no Roles for the app, causing the HTTP 403 errors. I hope this helps others in the future with similiar issues.

http://stackoverflow.com/comment/42114783
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26766843
has text: @ElliottFrisch it's library from official site. http://jdbc.postgresql.org/download.html

http://stackoverflow.com/comment/42206477
has text: @JBNizet I didn't all code since I am using reactivision integrated with processing, so you need to have fiducials printed and several libraries installed to compile the whole code. It is not fair to post all the chunks of code here
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26817914
type: Comment

http://stackoverflow.com/a/26779599
answers question: http://stackoverflow.com/q/26779497
has comment: http://stackoverflow.com/comment/42143966
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42143566
has body: consider using the following RegExp: (href|src)='"['"] Pattern p = Pattern.compile("(href|src)=['\"]([^'\"]['\"]+)"); Matcher m = p.matcher(desc); if (m.matches) { // grab all the groups and use what you need. } further reading: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

http://stackoverflow.com/q/26817783
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42205820
has title: Eclipse won't start up with Java installed already
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42205822
tagged with: java
has body: I have JDK installed, however when I try to install Eclipse standard edition I get: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse." Is it because my JDK is outdated?
tagged with: eclipse
has answer: http://stackoverflow.com/a/26817804

http://stackoverflow.com/a/26714033
has comment: http://stackoverflow.com/comment/42018532
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42018527
answers question: http://stackoverflow.com/q/26713980
has body: Try something like... private static int getInt(Object obj) { if (obj instanceof String) { return Integer.parseInt((String) obj); } else if(obj instanceof Integer){ return (Integer) obj; } else{ return 0; // or else whatever you want } }

http://stackoverflow.com/comment/42174954
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26800589
type: Comment
has text: Can't we create an object this way?

http://stackoverflow.com/comment/42165568
has text: Okay, it is a requirement instead of an observation
comment on: http://stackoverflow.com/q/26781457
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26765097
type: Answer
answers question: http://stackoverflow.com/q/26765020
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/42189201
has body: Use the trim() method, because your variable result probably contains an space, like " success": if (result.trim().equals("success")) { ... ... you could complement with toLowerCase() method, to prevent the handle of capitalized letters like " Success": if (result.trim().toLowerCase().equals("success")) { ... ... or try using indexOf() method for example: if (result.indexOf("success") &gt; 0) { ... ...
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42181112
has comment: http://stackoverflow.com/comment/42188764
accepted answer of: http://stackoverflow.com/q/26765020

http://stackoverflow.com/q/26673780
type: Question
score: 0
has title: How to improve the regex performance in java
has comment: http://stackoverflow.com/comment/140108162
linked to: http://stackoverflow.com/q/764247
favorite count: 0
has answer: http://stackoverflow.com/a/26674792
has answer: http://stackoverflow.com/a/26673873
tagged with: regex
answer count: 4
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26674085
accepted answer: http://stackoverflow.com/a/26674792
type: AnsweredQuestion
tagged with: performance
has body: I have this code to convert the whole text that is before "=" to uppercase Matcher m = Pattern.compile("((?:^|\n).*?=)").matcher(conteudo); while (m.find()) { conteudo = conteudo.replaceFirst(m.group(1), m.group(1).toUpperCase()); } But when the string is too large, it becomes very slow, I want to find a faster way to do that. Any sugestions? EDIT I haven't explained right. I have a text like this field=value field2=value2 field3=value3 And I want to convert each line like this FIELD=value FIELD2=value2 FIELD3=value3
tagged with: java
has comment: http://stackoverflow.com/comment/140153309
possible better answer: http://stackoverflow.com/a/26673855
has answer: http://stackoverflow.com/a/26673855

http://stackoverflow.com/comment/42228435
has text: Can you post your php or json content
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26830817
score: 0

http://stackoverflow.com/comment/42197007
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26812399
has text: I'm guessing you're making a `new Word(racer)` instead of a `new Word("racer")`.
score: 10

http://stackoverflow.com/q/26801246
type: Question
has title: JVM smart memory pool resizing
has body: A while ago I came about this article explaining how modern JVM have an option to automatically configure the size of the different memory pools. I'm now trying to pinpoint this again, but cannot find the article or other hints to this option. How to configure the JVM to smart optimize the size of the memory pools? Thanks Can't find the blog post (was an nice analysis of the feature), but I found this: https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html Going to try -XX:+UseAdaptiveSizePolicy together with: -XX:GCTimeRatio=nnn -XX:MaxGCPauseMillis=nnn
has answer: http://stackoverflow.com/a/26841825
answer count: 1
downvote count: 0
score: 1
tagged with: jvm
favorite count: 0
tagged with: garbage-collection
accepted answer: http://stackoverflow.com/a/26841825
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42170142
comment on: http://stackoverflow.com/a/26776696
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your answer, just one more thing, how can I realize calling Mahout in a loop, since it is normally used for DAGs?

http://stackoverflow.com/a/26717502
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26690910
answers question: http://stackoverflow.com/q/26690910
score: 1
has body: Such an error reports that you are trying to register pass an non servlet class as a servlet one, meaning here that obviousely com.example.testbattle.ServerSide does not implement javax.servlet.Servlet or extend a subclass of it. If com.example.testbattle.ServerSide is intended to be your Servlet application entry point then go ahead an implement the mentioned interface and all its derived methods (onService...).
upvote count: 1

http://stackoverflow.com/comment/41996760
has text: In addition to the above, I also found other additional features on fasterxml site -to allow serialization of "empty" POJOs (no properties to serialize) (without this setting, an exception is thrown in those cases) `mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);` -to write java.util.Date, Calendar as number (timestamp): `mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);`
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26700267

http://stackoverflow.com/q/26784938
tagged with: java
has title: Dynamically injecting JasperReports font file into webapp
has answer: http://stackoverflow.com/a/27405748
type: Question
tagged with: jasper-reports
has body: We have a WebService that receives a name of a report and its parameters, and calls a JRPdfExporter. Since the reports can be added at runtime by the users, we need a way to dynamically add the Jasper jar font file into the classpath, so that any new fonts added by the users can be added to Jasper classpath. We are using this code to try and inject the new jar into the classpath but with no success URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", new Class[]{URL.class}); method.setAccessible(true); method.invoke(sysloader, new Object[] {u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } The error I'm getting is net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts/fontsfamily1415192514231.xml Any ideas on how I can do this? Or is there a better alternative?
score: 0
accepted answer: http://stackoverflow.com/a/27405748
answer count: 1
type: AnsweredQuestion
tagged with: fonts

http://stackoverflow.com/q/26811919
has answer: http://stackoverflow.com/a/26918003
has title: No signature token Java CXF Client
upvote count: 2
tagged with: wcf
has body: I'm trying to buil a Java client with Apache-CXF-2.7.11 that communicates with .NET WCF services. My Java client code is following, the client were autogenerating whith the IDE, only the credentials i've copied from the CXF docs. public static void main(String args[]) throws java.lang.Exception { URL wsdlURL = Reportes.WSDL_LOCATION; if (args.length &gt; 0 &amp;&amp; args[0] != null &amp;&amp; !"".equals(args[0])) { File wsdlFile = new File(args[0]); try { if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURI().toURL(); } else { wsdlURL = new URL(args[0]); } } catch (MalformedURLException e) { e.printStackTrace(); } } Reportes ss = new Reportes(wsdlURL, SERVICE_NAME); IReportes port = ss.getWSHttpBindingIReportes(); Client client = ClientProxy.getClient(port); Endpoint cxfEndpoint = client.getEndpoint(); Map ctx = ((BindingProvider)port).getRequestContext(); ctx.put("ws-security.username", "username"); ctx.put("ws-security.password", "password"); WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(ctx); cxfEndpoint.getOutInterceptors().add(wssOut); { System.out.println("Invoking programaProveedores..."); java.lang.String _programaProveedores_idBeneficiario = ""; com.wsclient.ArrayOfProgramaProveedor _programaProveedores__return = port.programaProveedores(_programaProveedores_idBeneficiario); System.out.println("programaProveedores.result=" + _programaProveedores__return); } System.exit(0); } An exception is the result: Advertencia: Interceptor for {http://schemas.xmlsoap.org/ws/2005/02/trust/wsdl}SecurityTokenService#{http://schemas.xmlsoap.org/ws/2005/02/trust/wsdl}RequestSecurityToken has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: No signature token at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.doSignBeforeEncrypt(SymmetricBindingHandler.java:398) at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.handleBinding(SymmetricBindingHandler.java:124) at org.apache.cxf.ws.security.wss4j.PolicyBasedW…
tagged with: web-services
tagged with: cxf
tagged with: java
type: UnansweredQuestion
score: 2
tagged with: cxf-codegen-plugin
answer count: 1
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/q/26799483
tagged with: jetty
has answer: http://stackoverflow.com/a/26802158
downvote count: 0
score: 1
tagged with: java
type: Question
has title: How to specify OkHttp Client call correctly?
answer count: 1
tagged with: jetty-9
upvote count: 1
tagged with: okhttp
favorite count: 0
type: UnansweredQuestion
has body: I setup a Jetty Server (v9.3.0.M0) with a simple Jetty Servlet that writes the HttpServletRequest-body into the HttpServletResponse as follows: import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; import java.io.IOException; public class SimpleServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { StringBuilder stringBuilder = new StringBuilder(); BufferedReader reader = request.getReader(); try { String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line).append('\n'); } } finally { reader.close(); } String testString = stringBuilder.toString(); response.getWriter().println(testString); } } When I specify and run a JettyCient (v9.3.0.M0) much like this: import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.util.BytesContentProvider; public class JettyClient { public static void main(String[] args) throws Exception { HttpClient client = new HttpClient(); client.start(); ContentResponse response = client.POST("http://localhost:8083/hello") .content(new BytesContentProvider("this is a test".getBytes()), "text/plain") .send(); System.out.println(response.getContentAsString()); client.stop(); } } it runs perfectly, i.e. the server responds as intended and it just writes out "this is a test". When I specify an OkHttpClient (v2.0.0) much like this: import com.squareup.okhttp.*; import java.io.IOException; public class OkHttpClient { public static void main(String[] args) throws IOException { com.squareup.okhttp.OkHttpClient client = new com.squareup.okhttp.OkHttpClient(); RequestBody body = RequestBody.create(MediaType.parse("text/plain; charset=utf-8"), "this is a test"); Request request = new Request.Builder() .url("http://localhost:8…

http://stackoverflow.com/a/26784520
score: 1
has comment: http://stackoverflow.com/comment/42154750
has comment: http://stackoverflow.com/comment/42149977
has comment: http://stackoverflow.com/comment/42147249
accepted answer of: http://stackoverflow.com/q/26783915
answers question: http://stackoverflow.com/q/26783915
has comment: http://stackoverflow.com/comment/42146953
upvote count: 1
type: AcceptedAnswer
has body: There are multiple ways to find the element, here are some of them: by class name WebElement element = driver.findElement(By.className("alert-warning")); by xpath WebElement element = driver.findElement(By.xpath('//div[@class="Coeff-Details"]/div/p[@class="alert-warning"]')); by css selector WebElement element = driver.findElement(By.cssSelector('div.Coeff-Details p.alert.alert-warning')); Then, you can get the text using getText() method: element.getText();
type: Answer
downvote count: 0

http://stackoverflow.com/a/26696022
answers question: http://stackoverflow.com/q/26696008
has comment: http://stackoverflow.com/comment/41987024
accepted answer of: http://stackoverflow.com/q/26696008
has comment: http://stackoverflow.com/comment/41986967
has comment: http://stackoverflow.com/comment/41986925
has comment: http://stackoverflow.com/comment/41987063
has comment: http://stackoverflow.com/comment/41986938
score: 0
type: AcceptedAnswer
type: Answer
has body: Your local double xx is never used. Also, your format String only includes one floating specifier. I think you wanted, public static void main(String[] args) { double x = -7.5; System.out.printf("the absolute value of %.2f is %.2f%n", x, xx(x)); } public static double xx(double x) { return Math.abs(x); } Output is the absolute value of -7.50 is 7.50

http://stackoverflow.com/a/26756111
answers question: http://stackoverflow.com/q/26755755
type: Answer
has comment: http://stackoverflow.com/comment/42094555
has comment: http://stackoverflow.com/comment/121948776
score: 9
upvote count: 9
has body: Why is that? The reason is given in the JLS: 8.9.1. Enum Constants ... Instance methods declared in enum class bodies may be invoked outside the enclosing enum type only if they override accessible methods in the enclosing enum type (§8.4.8). Is there any way to invoke this method? Maybe via reflection? Given the above constraint, reflection is the only alternative if you do not want to expose the method in the enclosing enum class. Each enum constant is created as an inner class, like MyEnum$1 and MyEnum$2 in your example. Thus, you can retrieve the Class through the constant's getClass() method and then call your method through reflection (exception handling omitted): ... Class c = MyEnum.SPECIAL_VALUE.getClass(); Method m = c.getMethod("sayHello"); m.invoke(MyEnum.SPECIAL_VALUE); ... I would most likely try to avoid reflection and expose the method in the enum class, and let it throw an UnsupportedOperationException: ... public void sayHello() { throw new UnsupportedOperationException(); } ... This at least catches unintended calls during runtime - it still does not allow the compiler to catch them during compile time, but neither does the reflection approach.
has comment: http://stackoverflow.com/comment/42097151
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26755755

http://stackoverflow.com/comment/42176397
score: 0
has text: Are you sending more mails than the throttling limit? What is the error that you see?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26787835

http://stackoverflow.com/a/26713880
has body: Corrected!!! My corrected code: AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-permission android:name="android.permission.INTERNET" /> MainActivity.java: package ivoclar.pack; import android.app.Activity; import android.os.Bundle; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { String url = "http://gastro.hero.ch/index.php"; /** Called when the activity is first created. * @param savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView myWebView; myWebView = (WebView) findViewById(R.id.webview); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.setWebChromeClient(new WebChromeClient()); myWebView.loadUrl(url); myWebView.setWebViewClient (new WebViewClient(){ public boolean shouldOverrideUrlLoading(WebView view, String url){ view.loadUrl(url); return false; } }); //myWebView.loadUrl("http://gastro.hero.ch/"); } } layout - main.xml: <?xml version="1.0" encoding="utf-8"?> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> Ty: Pedro Oliveira Jibran Khan M D
score: 0
answers question: http://stackoverflow.com/q/26673544
type: Answer

http://stackoverflow.com/comment/42106411
type: Comment
has text: You try this: `System.out.println(((result * 1.0) / (1000L * 3600L * 24L)));` And you will understand what the problem is.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26762376

http://stackoverflow.com/comment/41982791
has text: thank you Tom. I will make those edits- hopefully it will work.
type: Comment
comment on: http://stackoverflow.com/a/26693592
type: AnswerComment
score: 1

http://stackoverflow.com/a/26709920
has body: Your Server class starts a new thread (instance of FFThread) for each incoming connection. Your run method of FFThread does count++, but it must be doing it on a local variable, since it's not accessing the count variable in the Server class. Therefore, each thread increments its own count from 0 to 1, and it never reaches two. Your run method should increment (and test) the count variable of the Server instance in order for that count to reach 2. You'll have to increment it in a thread safe manner (i.e. with a synchronized method). I believe adding the following to your Server class would work : private volatile int count = 0; ... public synchronized void incCount() { count++; } public int getCount() { return count; } Then, in your FFThread class, use this.cs.getCount() and this.cs.incCount() to read and increment the count.
has comment: http://stackoverflow.com/comment/42011947
has comment: http://stackoverflow.com/comment/42012190
has comment: http://stackoverflow.com/comment/42012648
answers question: http://stackoverflow.com/q/26708898
has comment: http://stackoverflow.com/comment/42012140
score: 0
has comment: http://stackoverflow.com/comment/42012784
has comment: http://stackoverflow.com/comment/42012671
type: Answer
has comment: http://stackoverflow.com/comment/42011545
has comment: http://stackoverflow.com/comment/42012294
has comment: http://stackoverflow.com/comment/42012271

http://stackoverflow.com/q/26792742
score: 0
answer count: 1
has title: Jython and standalone DB connection pool: How to confirm the pool is a Singleton
tagged with: java
type: AnsweredQuestion
tagged with: jython
has answer: http://stackoverflow.com/a/26824332
has body: Question: Can you use the zxJDBC.connectx method, outside of an application server container? I have my own server application in Jython, and I'm looking to upgrade to using a database connection pool (since I'm building and destroying individual connections manually, at this point). I have found some sample code and have gotten it to work (using Tomcat's connection pool), but something about the way it works bothers me. To me, it looks like the pool is getting created over and over again. Here's my working example: from __future__ import with_statement from com.ziclix.python.sql import zxJDBC params = { } params['url'] = 'jdbc:mysql://localhost:3306/my_database' params['driverClassName'] = 'com.mysql.jdbc.Driver' params['username'] = 'mario' params['password'] = 'myP@ssw0rd' params['validationQuery'] = 'SELECT 1' params['jdbcInterceptors'] = \ 'org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;' + \ 'org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer' # This is the line that worries me! conn = zxJDBC.connectx('org.apache.tomcat.jdbc.pool.DataSource', **params) with conn.cursor() as cursor: cursor.execute('SELECT * FROM MyTable') data = cursor.fetchall() print data conn.close() Take a look at "the line that worries me." I would like to use the zxJDBC connection object, but if each time I obtain it I have to give the DataSource class name along with the setup parameters, then the first thing I think is that a connection pool is being created anew each time. That's obviously not what I want. Does anyone know for sure what's going on, or how I might go about confirming what's going on—with a little experimentation, perhaps? Am I supposed to duplicate the JNDI infrastructure of a servlet container or something if I want to use this in my server? Am I failing to understand what exactly a DataSource is and how it works? I don't know how to get to the bottom of it. Thanks! Edit: Jython source code I took a look at the Jython source code. The connectx method i…
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26824332
type: Question
tagged with: connection-pooling
tagged with: database-connection

http://stackoverflow.com/comment/42009179
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26704975
has text: Still didn't got my answer. @fejese your regex is not working

http://stackoverflow.com/a/26821809
has comment: http://stackoverflow.com/comment/42213493
has comment: http://stackoverflow.com/comment/42213088
answers question: http://stackoverflow.com/q/26821595
has body: if you want to have integer output as your answer, have all your values except result1 as doubles, much easier check below: b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String f = et1.getText().toString(); double i = Double.parseDouble(f); String s = et2.getText().toString(); double j = Double.parseDouble(s); String w = et4.getText().toString(); double q = Double.parseDouble(s); double price_gold = 10; double fpa = 10; double fpol = 10; double isot = 10; double sint_ker = 10; Integer result1 = ((int)i * price_gold) + ((int)j * 1000) + ((int)q * isot); result = result1 / 340; String res = String.valueOf(result); et3.setText(res); } This code should then give you your integer values you are looking for, Easy :)
accepted answer of: http://stackoverflow.com/q/26821595
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42213131
score: 0
type: Answer

http://stackoverflow.com/a/26733336
answers question: http://stackoverflow.com/q/26733125
type: Answer
has body: You have no choice, you must migrate. The apt tool and its associated com.sun APIs have been deprecated since the release of Java 7, and were removed completely with the release of Java 8. As stated in the relevant JEP: The apt annotation processing framework is JDK-specific and dates back to JDK 5. The functionality of the API was standardized with JSR 269, which shipped as part of Java SE 6. In JDK 7, the entirety of the apt API was deprecated. [...] Users of annotation processing will have ample warning apt has been removed so needed migrations can occur before JDK 8 ships.
upvote count: 2
score: 2
downvote count: 0

php
tags question: http://stackoverflow.com/q/26707195
tags question: http://stackoverflow.com/q/26790454
tags question: http://stackoverflow.com/q/26771054
tags question: http://stackoverflow.com/q/26722090
tags question: http://stackoverflow.com/q/26827182
tag name: php
tags question: http://stackoverflow.com/q/26826769
tags question: http://stackoverflow.com/q/26734351
tags question: http://stackoverflow.com/q/26675140
tags question: http://stackoverflow.com/q/26734266
tags question: http://stackoverflow.com/q/26675629
tags question: http://stackoverflow.com/q/26789748
tags question: http://stackoverflow.com/q/26713026
tags question: http://stackoverflow.com/q/26814293
tags question: http://stackoverflow.com/q/26805912
tags question: http://stackoverflow.com/q/26681439
tags question: http://stackoverflow.com/q/26825900
tags question: http://stackoverflow.com/q/26697582
tags question: http://stackoverflow.com/q/26702085
tags question: http://stackoverflow.com/q/26761157
tags question: http://stackoverflow.com/q/26752034
tags question: http://stackoverflow.com/q/26814593
type: Tag

http://stackoverflow.com/q/26722584
has body: How can we convert java string to key so that it can be used for below RC4 encryption algorithm? I have a password which I need to be used as key for encryption. private static String rc4(String plaintext, int mode, Key key) throws Exception { Cipher cipher = Cipher.getInstance("RC4"); cipher.init(mode, (java.security.Key) key); return new String(cipher.doFinal(plaintext.getBytes())); } public static String encrypt(String plaintext, Key key) throws Exception { return rc4(plaintext, Cipher.ENCRYPT_MODE, key); }
has title: Convert String to Key in java for RC4 encryption
answer count: 3
type: UnansweredQuestion
upvote count: 3
tagged with: encryption
has answer: http://stackoverflow.com/a/52463858
has comment: http://stackoverflow.com/comment/42034780
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26722585
has answer: http://stackoverflow.com/a/26722586
downvote count: 0
tagged with: key
favorite count: 0

http://stackoverflow.com/a/27655833
has comment: http://stackoverflow.com/comment/43730957
score: 1
accepted answer of: http://stackoverflow.com/q/26775512
has comment: http://stackoverflow.com/comment/43731710
has body: It depends on how deep into hadoop API you are threading. If your application only submits jobs to the cluster, you are probably ok with vanilla libraries as long as you stick to one specific version. If you are doing advanced stuff and using hadoop internals, it may be necessary to include vendor specific ones.
answers question: http://stackoverflow.com/q/26775512
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43731264
upvote count: 1
has comment: http://stackoverflow.com/comment/43730825

http://stackoverflow.com/q/26831483
accepted answer: http://stackoverflow.com/a/26831619
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42229793
tagged with: java
tagged with: file
score: -1
type: Question
upvote count: 0
answer count: 1
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/42229571
has comment: http://stackoverflow.com/comment/42229611
has comment: http://stackoverflow.com/comment/42229772
has body: I know for a fact that the given file exists in this directory. .class file is in the same directory. What's wrong with the path? String fileName = "/home/security/workspace/SecondProject/src/config.txt"; File file = new File(fileName); FileInputStream fis = new FileInputStream(file); InputStreamReader isr = new InputStreamReader(fis, charset); BufferedReader br = new BufferedReader(isr); String line; while((line = br.readLine()) != null){ //process the line System.out.println(line); } br.close(); The error is as follows: java.io.FileNotFoundException: /home/security/workspace/SecondProject/src/config.txt (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) at JDBCExample.main(JDBCExample.java:92) Should it be an absolute path? /config.txt doesn't seem to work either. EDIT: Here's a proof, I don't know of any better way to prove it. https://i.sstatic.net/9p2MW.jpg Here's the terminal: security@security:~/workspace/SecondProject/src$ ls Config.txt JDBCExample.class JDBCExample.java
has answer: http://stackoverflow.com/a/26831619
favorite count: 0
has comment: http://stackoverflow.com/comment/42229666
has title: Problems with filepath: the file exists, but java throws an exce
downvote count: 1

singleton
tags question: http://stackoverflow.com/q/26787351
type: Tag
tags question: http://stackoverflow.com/q/26790059
tags question: http://stackoverflow.com/q/26733141
tags question: http://stackoverflow.com/q/26709538
tags question: http://stackoverflow.com/q/26733144
tags question: http://stackoverflow.com/q/26795361
tags question: http://stackoverflow.com/q/26699511
tags question: http://stackoverflow.com/q/26708178
tags question: http://stackoverflow.com/q/26719981
tags question: http://stackoverflow.com/q/26765109
tag name: singleton
tags question: http://stackoverflow.com/q/26741582

http://stackoverflow.com/q/26750985
answer count: 2
tagged with: loops
downvote count: 1
has title: Change the value of a variable each time another variable changes
has body: I am currently making a text adventure game in Java, but I have come across a problem: I need the value of a String variable to change each time the value of a particular int variable changes. I want the program to perform this task (then continue where it left off) each time the value of an int variable changes: if (enemyposition == 1) { enemyp = "in front of you"; } else if (enemyposition == 2) { enemyp = "behind you"; } else if (enemyposition == 3) { enemyp = "to your left"; } else if (enemyposition == 4) { enemyp = "to your right"; } else { enemyp = "WOAH"; } Thanks! :D
has comment: http://stackoverflow.com/comment/42085772
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26751056
has answer: http://stackoverflow.com/a/26751090
tagged with: int
has comment: http://stackoverflow.com/comment/42085699
upvote count: 0
has comment: http://stackoverflow.com/comment/42090016
tagged with: variables
tagged with: string
favorite count: 0
type: Question
score: -1
tagged with: java

http://stackoverflow.com/comment/122677351
type: AnswerComment
score: 3
type: Comment
has text: This doesn't work for me in Spring Boot 2.3.5.RELEASE
comment on: http://stackoverflow.com/a/26809261

http://stackoverflow.com/comment/41995059
type: QuestionComment
has text: Oh, and use `DataOutputStream.writeUTF()` to write the filename. There's no need to write the length and then the characters (and it takes more space on the wire).
comment on: http://stackoverflow.com/q/26700540
score: 0
type: Comment

http://stackoverflow.com/q/26746586
tagged with: java
has answer: http://stackoverflow.com/a/26746708
has answer: http://stackoverflow.com/a/26746617
has answer: http://stackoverflow.com/a/26746616
has answer: http://stackoverflow.com/a/26746613
type: Question
tagged with: if-statement
has body: How does a statement like this execute? int x = 2, y = 3; if (x != 0) if (x &lt; 10) if (y &lt; 10) { x++; y++; System.out.printf("X and Y are: %d, and %d", x, y); }
possible better answer: http://stackoverflow.com/a/26746613
linked to: http://stackoverflow.com/q/22523157
has answer: http://stackoverflow.com/a/26746665
has comment: http://stackoverflow.com/comment/42078556
has answer: http://stackoverflow.com/a/26746655
has title: Multiple if statements on one line
has answer: http://stackoverflow.com/a/26746653
accepted answer: http://stackoverflow.com/a/26746616
has comment: http://stackoverflow.com/comment/42078613
downvote count: 0
has answer: http://stackoverflow.com/a/26746640
favorite count: 0
has comment: http://stackoverflow.com/comment/42079653
answer count: 9
has comment: http://stackoverflow.com/comment/42078495
has comment: http://stackoverflow.com/comment/42078409
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26746634
upvote count: 2

http://stackoverflow.com/q/26742323
tagged with: string
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26742466
has body: I'm trying to count the number of non-blank characters in a string. It works fine when there are no leading blank spaces, but when I add 3 spaces in from, it doubles the number of non-blank characters. This is my code: import java.io.*; import java.util.*; public class countCharacters { public static void main(String[] args) throws Exception { String str1; int count; count = 0; BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter a string: "); str1 = dataIn.readLine(); while(str1.length() &gt; 0) { System.out.println("The String ''" + str1 + "''"); System.out.println("has " + str1.length() + " Characters, including all blanks."); for(int i=0; i &lt; str1.length(); ++i) if(str1.charAt(i) !=' ') count++; str1 = str1.trim(); System.out.println("and " + str1.length() + " Characters, trimmed of leading and trailing blanks."); System.out.println("and " + count + " non-blank characters."); System.out.println(""); System.out.print("Enter a string: "); str1 = dataIn.readLine(); } System.out.println("Program complete."); } }
has comment: http://stackoverflow.com/comment/42070527
has answer: http://stackoverflow.com/a/26742349
has comment: http://stackoverflow.com/comment/42070546
answer count: 4
has comment: http://stackoverflow.com/comment/42070598
tagged with: java
has comment: http://stackoverflow.com/comment/42070502
has answer: http://stackoverflow.com/a/26742479
type: Question
has comment: http://stackoverflow.com/comment/42070584
has title: using string methods to count characters
score: 0
has answer: http://stackoverflow.com/a/26742460

http://stackoverflow.com/a/26772265
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26772123
has body: The array is of type Student. So it will store student objects. You can store store the student object directly. like studentDetails[0] = student;

http://stackoverflow.com/q/26778308
accepted answer: http://stackoverflow.com/a/26929823
has body: I'm having trouble programatically adding event handlers to table rows. Since I have to declare the variable as final, all the event handlers always only use the last assigned value. I have no idea how to fix this. Does anyone have any ideas? public void Refresh() { Looper.prepare(); final Context context = getApplicationContext(); CharSequence text = "Refreshen..."; int duration = Toast.LENGTH_SHORT; try { Toast toast = Toast.makeText(context, text, duration); toast.show(); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet("http://www.nu.nl/")); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { ByteArrayOutputStream out = new ByteArrayOutputStream(); response.getEntity().writeTo(out); out.close(); String responseString = out.toString(); String[] lines = responseString.split("\n"); for(int i = 0; i &lt; lines.length; i++) { if(lines[i].contains("&lt;li class=\" \" data-vr-contentbox=\"articlelist")) { final String url = stripSpaces(lines[i + 2].replace("&lt;a href=\"", "").replace("\" class=\"trackevent\" &gt;", "")); final String title = stripSpaces(lines[i + 6].replace("&lt;span class=\"title\"&gt;", "").replace("&lt;/span&gt;", "")); final TableLayout tl = (TableLayout) findViewById(R.id.table); activity.runOnUiThread(new Runnable() { public void run() { TableRow row = new TableRow(context); row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView view = new TextView(context); view.setText(title); row.addView(view); tl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(activity, News.class); intent.putExtra("url", url); startActivity(intent); } }); tl.addView(row, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); } }); } } } else { //Closes the connection. response…
type: Question
has comment: http://stackoverflow.com/comment/42176038
tagged with: android
tagged with: events
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26929823
has title: Assigning event handlers to objects with variables in a loop
tagged with: java
has comment: http://stackoverflow.com/comment/42135396
type: AnsweredQuestion

http://stackoverflow.com/q/26675242
accepted answer: http://stackoverflow.com/a/26675342
score: 4
answer count: 1
tagged with: wifi
has answer: http://stackoverflow.com/a/26675342
favorite count: 0
has title: Why does WiFiP2P need internet permission?
tagged with: android
upvote count: 4
has body: Directly quoting the android website : Wi-Fi peer-to-peer (P2P) allows Android 4.0 (API level 14) or later devices with the appropriate hardware to connect directly to each other via Wi-Fi without an intermediate access point But according to the android website, for you to use the WiFiP2P class you have to have the following permission to your application's manifest file. &lt;uses-permission android:name="android.permission.INTERNET" /&gt; My question is: If WiFiP2P connects 2 android devices directly then why does it need the internet permission?
downvote count: 0
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26788106
has comment: http://stackoverflow.com/comment/42152955
score: 1
has comment: http://stackoverflow.com/comment/42152701
has body: If you look closely at the linked code in GenerateGrid: int j = 0; for (j = 0; j &lt;= 80; j++) { sudokuGrid.add(Squares[j]); } should come after the while(c != 81) loop. In your code, it is inside the loop. This means that you're adding too many squares to sudokuGrid. To check that this is happening, print the size of sudokuGrid at the end of the method -- it'll be a lot greater than 81. Edit: Also, there might be problems with the way you're displaying the board. Try this at the end of newGame, after the GenerateGrid call: for(int x = 0; x &lt;= 8; x++) { for(int y = 0; y &lt;= 8; y++) { sudoku[x][y].setText(&quot;&quot; + sudokuGrid.get(x * 9 + y).Value); } }
answers question: http://stackoverflow.com/q/26787422
downvote count: 0
has comment: http://stackoverflow.com/comment/42153454
type: Answer
has comment: http://stackoverflow.com/comment/42154307
upvote count: 1

http://stackoverflow.com/comment/42137670
score: 0
has text: Yes but I am wondering if "Export unsigned Application Package" will give me a release version on which proguard has been implemented?
comment on: http://stackoverflow.com/q/26776855
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41963373
has text: Thats it! Using checks for null works great, however, I got a bunch of ifelse statements now.... But that's all right! It works fine, now!
score: 0
comment on: http://stackoverflow.com/a/26679478
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26682340
has body: I am currently making xy scatter plot, and i have code for setting the properties of my line graph. private static void setLineProp(XYPlot plot, Color c) { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); renderer.setSeriesShapesVisible(0, true); renderer.setBaseItemLabelsVisible(true); renderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER)); renderer.setSeriesPaint(0, c); plotRev.setRenderer(0, renderer); } This will generate a label for every data point on top of the line graph, but some points are very close together and causes the labels to become jumbled and unreadable. I was wondering if there is a way to alternate individual point label above and below the line graph or even alternate the label offset so that the text does not jumble up?
has title: Is it possible to alternate item labels above and below the data point in a xy scatter line graph?
favorite count: 0
type: Question
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/42114722
tagged with: java
has comment: http://stackoverflow.com/comment/41969864
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/42116681
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/42081219
comment on: http://stackoverflow.com/a/26726502
type: Comment
has text: Thank you very much! (didn't mean to hit Enter and send that comment so early).
score: 0
type: AnswerComment

http://stackoverflow.com/q/26767829
has answer: http://stackoverflow.com/a/26768376
accepted answer: http://stackoverflow.com/a/26768376
has comment: http://stackoverflow.com/comment/42116639
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/42116744
has comment: http://stackoverflow.com/comment/42116666
tagged with: java
has body: I am writing a program that verifies arithmetic expression are correctly formed. (For example: Correct form "2 + (2-1)", incorrect form ")2+(2-1") Once it's been verified, the program will compute the results. At the moment, it can compute anything in parenthesis easily. But if there was a bracket involved (For example, "2 [ 3 + (1) ]") The program verifies the expression is correct, but cannot calculate the results. Here is the code I'm concerned about void postfixExpression() { stk.clear(); // Re-using the stack object Scanner scan = new Scanner(expression); char current; // The algorithm for doing the conversion.... Follow the bullets while (scan.hasNext()) { String token = scan.next(); if (isNumber(token)) { postfix = postfix + token + " "; } else { current = token.charAt(0); if (isParentheses(current)) { if (stk.empty() || current == Constants.LEFT_NORMAL) { // push this element on the stack; stk.push(new Character(current)); } else if (current == Constants.RIGHT_NORMAL) { try { Character ch = (Character) stk.pop(); char top = ch.charValue(); while (top != Constants.LEFT_NORMAL) { postfix = postfix + top + " "; ch = (Character) stk.pop(); top = ch.charValue(); } } catch (EmptyStackException e) { } } } else if (isOperator(current))// { if (stk.empty()) { stk.push(new Character(current)); } else { try { char top = (Character) stk.peek(); boolean higher = hasHigherPrecedence(top, current); while (top != Constants.LEFT_NORMAL &amp;&amp; higher) { postfix = postfix + stk.pop() + " "; top = (Character) stk.peek(); } stk.push(new Character(current)); } catch (EmptyStackException e) { stk.push(new Character(current)); } } }// Bullet # 3 ends } } // Outer loop ends try { while (!stk.empty()) // Bullet # 4 { postfix = postfix + stk.pop() + " "; } } catch (EmptyStackException e) { } } I've created two methods: isBracket, and isCurly. At first, I thought the most appropriate solution is to just include the two method in the same manner as isParentheses. Like so: if (isPare…
has title: Get the Java program to read parenthesis, brackets, and curly braces
type: Question

http://stackoverflow.com/q/26789798
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42156758
has answer: http://stackoverflow.com/a/26790652
upvote count: 1
answer count: 1
has body: I connected data base with hibernate to my application with this settings: hibernateContext.xml this is hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/fullproject root admin org.hibernate.dialect.MySQLDialect update true <mapping resource="user.hbm.xml" /> </hibernate-configuration> this is user.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <generator class="native" /> this is my user entity public class User { private int id; private String login; private String password; private String email; public User(){ } public User(String login, String password, String email){ this.login = login; this.password = password; this.email = email; } public int getId(){ return id; } public String getLogin(){ return login; } public String getPassword(){ return password; } public String getEmail(){ return email; } public void setId(int id){ this.id = id; } public void setLogin(String login){ this.login = login; } public void setPassword(String password){ this.password = password; } public void setEmail(String email){ this.email = email; } } when i try save db in this way "hibernateTemplate.save(user)' i catch in console this line "Hibernate: insert into users (login, password, email) values (?, ?, ?)" and changes don't save into database. I tried in user.hbn.xml change generator class to "increment" because my id in data base table has AUTO INCREMENT parameter, but it doesn't work.
favorite count: 0
has comment: http://stackoverflow.com/comment/42166179
linked to: http://stackoverflow.com/q/3931162
has comment: http://stackoverflow.com/comment/42165687
has comment: http://stackoverflow.com/comment/42157595
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/43320
has title: Doesn't save the data into data base. Hibernate and Spring connection
score: 1

http://stackoverflow.com/q/26695882
accepted answer: http://stackoverflow.com/a/26695913
tagged with: bootstrap-datepicker
tagged with: twitter-bootstrap
tagged with: datepicker
has body: I have a bootstrap datepicker. I am getting date from the date input box and storing in database using Java code. If the date in bootstrap date picker MM/dd/yyyy (10/1/2014) then when persisting in database its storing as a different date with one year difference or one month difference like that. I cant predict the change. I am getting the date from the datepicker and storing it as java.util.Date object. example: 11/01/2014 Fri Jan 10 18:00:00 CST 2014 I dont know whether in date conversion I am doing problem or its problem with bootstrap datepicker
has title: Bootstrap datepicker converted to java util date
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26695913
tagged with: jquery-ui-datepicker
score: 0
answer count: 1

http://stackoverflow.com/q/26678938
answer count: 1
has answer: http://stackoverflow.com/a/26804605
tagged with: security
tagged with: rest
accepted answer: http://stackoverflow.com/a/26804605
type: AnsweredQuestion
tagged with: wso2
score: 0
tagged with: java
type: Question
has body: I have followed this tutorial to implement an API in WSO2 ESB 4.8.0. The following steps are depicted in the tutorial: Create the custom handler to validate the Bearer token. Create API element in the ESB and pointing the rest endpoint that you have Include created handler to the created API element. Go to IS and create the OAuth2.0 application and get the Access token form IS Invoke the API with the valid access token. I can invoke the API in step 5 with any token, or an empty token. The API configured in the ESB should only return with the correct access token that is provided in step 4. Is it missing something to validate the token properly in the handler or in the API configuration? Regards
has title: WSO2ESB 4.8.0 and WSO2IS 5.0.0 secure REST endpoint with OAuth2

http://stackoverflow.com/q/26804937
upvote count: 1
type: Question
answer count: 2
downvote count: 0
has title: cannot run application in jetty after including swagger in Spring MVC
has answer: http://stackoverflow.com/a/40557869
tagged with: embedded-jetty
has answer: http://stackoverflow.com/a/26816639
favorite count: 0
linked to: http://stackoverflow.com/q/6028534
type: UnansweredQuestion
has body: I was able to run my Spring MVC appication, until the point where I introduced swagger dependency for the API documentation. Now when I run the application in jetty server[Run as -> Run Jetty], I get the below error java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.asMap(Lcom/google/common/collect/ListMultimap;)Ljava/util/Map; at com.mangofactory.swagger.scanners.ApiListingReferenceScanner.getResourceGroupRequestMappings(ApiListingReferenceScanner.java:146) Searching the web, I see comments on upgrading the com.google.guava to 15.0 version, but still the issue persists. Changes made that triggered the error: pom.xml: com.mangofactory swagger-springmvc 0.8.8 and the SwaggerConfig.java for Enabling swagger as mentioned here : http://java.dzone.com/articles/how-configure-swagger-generate I'm stuck, please help Update: Running in tomcat, but not in jetty Update [11/11]: upgraded swagger version to 0.9.1 upgraded guava version to 18.0 mvn dependency:tree shows only one guava version com.google.guava:guava:jar:18.0:compile Even now the same issue exists!
tagged with: spring-mvc
tagged with: guava
score: 1
tagged with: java
tagged with: swagger

http://stackoverflow.com/q/26789928
tagged with: osx-yosemite
tagged with: macos
has title: eclipse not working on mac OS X Yosemite
type: UnansweredQuestion
has body: I think it is something to do with java. Its for my android app class, eclipse can't find the path or do any of the following sofia andriod anything student.testcases java support files if anyone has any answers it is greatly appreciated error message: Description Resource Path Location Type Unbound classpath container: 'Default System Library' in project 'RestaurantGuide-Phase 1' RestaurantGuide-Phase 1 Build path Build Path Problem The project cannot be built until build path errors are resolved RestaurantGuide-Phase 1 Unknown Java Problem
has comment: http://stackoverflow.com/comment/42156007
has answer: http://stackoverflow.com/a/26790216
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42160800
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42156597
answer count: 1

http://stackoverflow.com/q/26732074
has answer: http://stackoverflow.com/a/26732896
has body: I am using ubuntu 12.04 and wanted to connect to the MS SQL server database which is hosted in the same network. I was able to connect this using Squirrel , yet unable to connect from a java program. These are the tools I and .jars I am using . Intellij Idea is the tool jar are jtds-1.3.1.jar and sqljdbc4.jar Java version 1.7 I am hoping to develop a web application in the Ubuntu Environment , yet my database will be in Ms Sql windows table. Is this feasible ? Please intruct me step by step , and sample code to connect ms sql database which s hosted ina wondows environment Rashen
tagged with: sql-server
has comment: http://stackoverflow.com/comment/42051536
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26732753
has title: Connect MS SQL database from Java in ubuntu environment
type: Question
possible better answer: http://stackoverflow.com/a/26732727
linked to: http://stackoverflow.com/q/17190583
tagged with: java
tagged with: jtds
has answer: http://stackoverflow.com/a/26732727
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/42052633
accepted answer: http://stackoverflow.com/a/26732753
score: 0
answer count: 3

http://stackoverflow.com/a/26780991
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26779822
has body: I've been combining my selenium tests with jUnit, so I can just use jUnit's built in assertions. It makes the code somewhat easier to use. The other method that you'll want to look at it Selenium's wait method. As you're thinking about the tests, you should also consider whether or not you really need for the test to continue to run after an error condition is found. In your example, does it make sense for the test to try to click the "Reports" link, if both verifyElementPresent and assertElementPresent have failed? If you don't need to continue to run the test after a failure, your code will be simpler. Looking at your code, I would probably rewrite navigation 1 something like: package com.eureqa.scripts; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class Phase1 { public static WebDriver driver; public static WebDriver driver1; public void navigation1(WebDriver driver1) { WebDriverWait wait = new WebDriverWait(driver, 10); assertTrue("commonheader:headerForm:projectlist not found", driver1.findElements(By.id("commonheader:headerForm:projectlist")).size() == 1); wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Reports"))).click(); } public static void main(String arr[]) throws InterruptedException { WebDriver driver1=LoginObject.driver(); System.out.println("Object Received"); LoginEureqa m=new LoginEureqa(); m.login(driver1); Phase1 p1=new Phase1(); p1.navigation1(driver1); System.out.println(); System.out.println("Phase1 executed successf`enter code here`ully"); } } Now, this doesn't exactly reproduce what you had in your original post, because it will fail at each step. If you wanted the first assertion to fail, but continue, you could surrou…
answers question: http://stackoverflow.com/q/26779822
has comment: http://stackoverflow.com/comment/42139596
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26743013
has comment: http://stackoverflow.com/comment/42291004
has comment: http://stackoverflow.com/comment/42263973
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42223783
has comment: http://stackoverflow.com/comment/42453811
has body: Hi Modified your source code a bit. Now its working for me. Activity Source: import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; public class MainActivity extends Activity { private MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // final MediaPlayer mp = new MediaPlayer(); mp = new MediaPlayer(); } public void button1(View v) { // Button button1 = (Button)findViewById(R.id.button1); mp.release(); mp = MediaPlayer.create(this, R.raw.muzika); mp.start(); } public void button2(View v) { // Button button2 = (Button)findViewById(R.id.button2); mp.release(); mp = MediaPlayer.create(this, R.raw.muzikb); mp.start(); } @Override public void onDestroy() { mp.release(); } } activity_main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" tools:context=".MainActivity" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="button1" android:text="Music 1" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="button2" android:text="Music 2" /&gt; &lt;/LinearLayout&gt; Let me know if I missed anything.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26701592
has comment: http://stackoverflow.com/comment/42458577
has comment: http://stackoverflow.com/comment/42453989
answers question: http://stackoverflow.com/q/26701592
has comment: http://stackoverflow.com/comment/42254036

http://stackoverflow.com/q/26822288
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
tagged with: android
has body: I am trying to test file manipulation with my APP. First of all I wanna check that whenever I call a function that reads the file, this function will throw an Exception because the file isn't there. However, I don't seem to understand how to achieve this... This is the code I designed, but it doesn't run ... the normal JUNIT says the FILEPATH wasn't found, the android JUNIT says, the Test could not be run. The folder: /data/data/example.triage/files/ is already available in the virtual device... @Before public void setUp() throws Exception { dr = new DataReader(); dw = new DataWriter(); DefaultValues.file_path_folder = "/data/data/example.triage/files/"; } @After public void tearDown() throws Exception { dr = null; dw = null; // Remove the patients file we may create in a test. dr.removeFile(DefaultValues.patients_file_path); } @Test public void readHealthCardsNonExistentPatientsFile() { try { List&lt;String&gt; healthcards = dr.getHealthCardsofPatients(); fail("The method didn't generate an Exception when the file wasn't found."); } catch (Exception e) { assertTrue(e.getClass().equals(FileNotFoundException.class)); } }
type: AnsweredQuestion
score: 1
tagged with: java
has title: Android File manipulation tests with JUNIT
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26822447
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26822447

http://stackoverflow.com/q/26811770
downvote count: 3
has comment: http://stackoverflow.com/comment/42196006
favorite count: 0
score: -3
has body: I have a source of two different nodes, code below: public class Jazel { int data; Jazel levo; Jazel desno; public Jazel(int vdata){ data = vdata; levo = null; desno = null; } } and public class JazelL { int data; JazelL next; public JazelL(int vdata){ data = vdata; next = null; } } My question is, what is the difference between these two nodes?
has comment: http://stackoverflow.com/comment/42196017
has answer: http://stackoverflow.com/a/26811877
has comment: http://stackoverflow.com/comment/42195986
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26811838
accepted answer: http://stackoverflow.com/a/26811838
has comment: http://stackoverflow.com/comment/42195962
tagged with: java
has comment: http://stackoverflow.com/comment/42195957
possible better answer: http://stackoverflow.com/a/26811877
has comment: http://stackoverflow.com/comment/42196008
tagged with: nodes
type: Question
has title: What is the difference between these two nodes?
answer count: 2

http://stackoverflow.com/comment/45873484
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26722327
has text: Did you solve your "Not in union" error? If so, how?
type: AnswerComment

http://stackoverflow.com/q/26690765
has body: Here's the section of my pom.xml org.codehaus.mojo findbugs-maven-plugin 3.0.0 true <findbugsXmlWithMessages>true</findbugsXmlWithMessages> true findbugs-exclude-filter.xml org.apache.maven.plugins maven-resources-plugin 2.6 maven-project-info-reports-plugin 2.7 org.apache.maven.plugins maven-jxr-plugin 2.3 and when I run "mvn site", I got a warning said [WARNING] Unable to create Maven project for com.sun:tools:pom:1.6 from repository. Here 's the context of the warning: [INFO] Generating "About" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Distribution Management" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Source Repository" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Mailing Lists" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Issue Tracking" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Continuous Integration" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Project Plugins" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Project License" report --- maven-project-info-reports-plugin:2.7 [INFO] Generating "Dependency Management" report --- maven-project-info-reports-plugin:2.7 [WARNING] Unable to create Maven project for com.sun:tools:pom:1.6 from repository. org.apache.maven.project.ProjectBuildingException: Error resolving project artifact: Failure to find com.sun:tools:pom:1.6 in http://maven.repository.redhat.com/techpreview/all/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-products-ga-repo has elapsed or updates are forced for project com.sun:tools:pom:1.6 at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:299) at org.apache.maven.project.…
has answer: http://stackoverflow.com/a/26690883
score: 2
downvote count: 0
tagged with: java
has title: Got "Unable to create Maven project for com.sun:tools:pom:1.6 from repository." warning when using findbugs-maven-plugin in maven
type: Question
tagged with: findbugs
upvote count: 2
linked to: http://stackoverflow.com/q/26422259
answer count: 1
has comment: http://stackoverflow.com/comment/41978240
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/42037520
has text: That's how it's been--if I remove `sock.Receive (response);` it sends it fine, if not it just hangs.
comment on: http://stackoverflow.com/q/26722727
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26725806
accepted answer: http://stackoverflow.com/a/26725944
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26725946
has title: Extract JSON Value
has comment: http://stackoverflow.com/comment/42041397
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
has answer: http://stackoverflow.com/a/26725944
has comment: http://stackoverflow.com/comment/42041291
has comment: http://stackoverflow.com/comment/42041200
has comment: http://stackoverflow.com/comment/42041881
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/42040731
has comment: http://stackoverflow.com/comment/42041451
has comment: http://stackoverflow.com/comment/42041183
has comment: http://stackoverflow.com/comment/42041846
has body: I am having some problem when trying to extract value from JSON. Here is the JSON returned from my servlet: [ { "eventDesc":"My sons 5th year birthday party", "eventDate":"12/11/2014", "eventID":"1", "eventName":"Birthday party", "eventTime":"17:00", "eventX":"41803.2", "eventY":"38210.8", "eventBy":"Gabriel" }, { "eventDesc":"Steamboat Gathering", "eventDate":"20/11/2014", "eventID":"2", "eventName":"Gathering", "eventTime":"19:00", "eventX":"41551.6", "eventY":"38211.7", "eventBy":"JunHong" } ] And I have no idea how should I extract it record per record because I have to plot each record onto the map. I have these codes to extract from the JSON returned in servlet: public void getThemesOnMap() throws JSONException{ String page; BufferedReader in; JSONArray jsonArray; try{ HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://localhost:8080/MyProject/MyServlet"); HttpResponse response = client.execute(request); in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer sb = new StringBuffer(""); String line = ""; String NL = System.getProperty("line.separator"); while((line = in.readLine()) != null){ sb.append(line + NL); } in.close(); page = sb.toString(); System.out.println(page); try{ JSONObject jsonObject = new JSONObject(page); jsonArray = jsonObject.getJSONArray(page); int length = jsonArray.length(); for(int i = 1; i &lt; length; i++){ JSONObject attribute = jsonArray.getJSONObject(i); String eventName = attribute.getString("eventName"); String eventX = attribute.getString("eventX"); String eventY = attribute.getString("eventY"); PictureMarkerSymbol graphicIcon; graphicIcon = new PictureMarkerSymbol(this.getResources().getDrawable(R.drawable.busstopicon)); Point p = new Point(Double.parseDouble(eventX), Double.parseDouble(eventY)); Symbol symbol = graphicIcon; HashMap&lt;String, Object&gt; attrMap = new HashMap&lt;String, Object&gt;(); attrMap.put("eventName", eventName); graphicsLayer.addGra…
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/42040758
favorite count: 0
upvote count: 0
possible better answer: http://stackoverflow.com/a/26725946
has comment: http://stackoverflow.com/comment/42041365
has comment: http://stackoverflow.com/comment/42042836
has comment: http://stackoverflow.com/comment/42041254
has answer: http://stackoverflow.com/a/26726070
has comment: http://stackoverflow.com/comment/42041797
has comment: http://stackoverflow.com/comment/42042863

http://stackoverflow.com/comment/42198372
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26813249
has text: You should look up what `do/while` loops are and how they work. Then you can repeat your program while the user enters `1`.

http://stackoverflow.com/q/26695864
tagged with: android
possible better answer: http://stackoverflow.com/a/26696249
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26696249
has body: I have an ImageButton and to that in the android:background property I currently have a xml drawable which changes the ImageButton background color when pressed. This is all good but I also want to add a top border to each of these ImageButton's. Here's a sample image I created to better get my point across. These buttons will also have an active state which indicates the current active button and I can set that as a drawable using Java code.
accepted answer: http://stackoverflow.com/a/26696547
answer count: 4
has answer: http://stackoverflow.com/a/26696328
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26696409
tagged with: imagebutton
has title: How to add a one-side border and background into one drawable?
has answer: http://stackoverflow.com/a/26696547
score: 0

http://stackoverflow.com/q/26738571
has body: Yeah this is homework but I am very stuck on what is wanted. The comparator class should implement java.util.Comparator, and the second argument of the sort() method should be an instance of my Comparator class. So far my comparator class looks like: import java.util.Comparator; public class Compare implements Comparator&lt;Rational&gt; { public int compare1(int a, int b){ int z = 0; if(a &gt; b) z = 1; else if(b &gt; a) z = -1; return z; } @Override public int compare(Rational a, Rational b) { // TODO Auto-generated method stub return 0; } } I have a separate method to sort the array but this method uses compareTo() public static Collection&lt;Rational&gt; sort1(List&lt;Rational&gt; list){ List&lt;Rational&gt; sortedList1 = new ArrayList&lt;Rational&gt;(); for (int i=0;i &lt; list.size();i++) { //iterating through list Rational currentValue = list.get(i); int pos = sortedList1.size(); for (int j=0;j&lt;sortedList1.size();j++) { int comparison = currentValue.compareTo(sortedList1.get(j)); //comparing //this is the right position if the currentValue is greater or equal //to the sorted value at this position if(comparison &gt; 0 || comparison == 0){ pos = j; break; } } sortedList1.add(pos, currentValue); } return sortedList1; } What should I use this method but using my separate comparator class? I'm totally lost on what I should do. My Rational Class looks like: public class Rational implements Comparable { private int num; // the numerator private int den; // the denominator // create and initialize a new Rational object public Rational(int numerator, int denominator) { if (denominator == 0) { throw new RuntimeException("Denominator is zero"); } int g = gcd(numerator, denominator); num = numerator / g; den = denominator / g; } // return string representation of (this) public String toString() { if (den == 1) { return num + ""; } else { return num + "/" + den; } } // return (this * b) public Rational times(Rational b) { return new Rational(this.num * b.num, this.den …
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26738709
tagged with: java
has answer: http://stackoverflow.com/a/26739884
type: Question
has comment: http://stackoverflow.com/comment/42063731
has title: How to use a separate comparator class to sort an array list
has answer: http://stackoverflow.com/a/26738722
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26738722
upvote count: 2
possible better answer: http://stackoverflow.com/a/26738672
has answer: http://stackoverflow.com/a/26738672
answer count: 4

http://stackoverflow.com/a/26812984
answers question: http://stackoverflow.com/q/26812865
has body: example using ternary operator .increase j if x grater than i decrease otherwise int x = 5, j=0; for (int i = 0; i &lt;= x*2; i++) { j= (x&gt;i)? ++j:--j; // u can use if else also for (int y = 0; y &lt; j; y++) { System.out.print(" *"); } System.out.println(""); } output>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42201868
upvote count: 1

apache-kafka
tags question: http://stackoverflow.com/q/26729048
type: Tag
tag name: apache-kafka
tags question: http://stackoverflow.com/q/26799398
tags question: http://stackoverflow.com/q/26725463

http://stackoverflow.com/a/26742960
type: Answer
has body: Use the fact the negative numbers multiplied by each other are positive and use e >= -10. for (int e = 10; e &gt; -11; e -= 2) System.out.print(e * e + " "); System.out.println(); I find it more readable to go negative to positive though. And it's generally a good idea to add the brackets in: for (int e = -10; e &lt; 11; e += 2) { System.out.print (e * e + " "); } System.out.println();
downvote count: 0
answers question: http://stackoverflow.com/q/26742867
score: 3
upvote count: 3

http://stackoverflow.com/comment/42106873
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26753102
has text: while the server not be reset all request use form cache.
type: AnswerComment

http://stackoverflow.com/a/26793274
score: 1
accepted answer of: http://stackoverflow.com/q/26793020
answers question: http://stackoverflow.com/q/26793020
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Essentially, you want to keep a reference to the original image, so instead of image = bright.filter(image, image); You could do... BufferedImage filtered = bright.filter(image, null);
upvote count: 1

http://stackoverflow.com/comment/42186294
comment on: http://stackoverflow.com/q/26806596
type: QuestionComment
has text: Use this `'[^']*'` regex to get the output you want.
score: 2
type: Comment

http://stackoverflow.com/comment/42148430
type: Comment
comment on: http://stackoverflow.com/a/26785801
score: 1
has text: Ah I see, I was just thinking about things a completely different way. This makes sense now.
type: AnswerComment

http://stackoverflow.com/q/26685648
tagged with: mysql
has answer: http://stackoverflow.com/a/26685721
has title: Obtaining a Connection object from Tomcat DBCP JDBC COnnection Pooling
has body: I have a DataSource that I obtain from tomcat-dbcp: import java.sql.Connection public Connection initPooledConnection() { try { conn=(Connection)ds.getConnection(); if(conn==null) { System.out.println("Failed to initialize the connection"); } } catch (SQLException e) { e.printStackTrace(); } return conn; } How do I continue to use com.mysql.jdbc.Statement,com.mysql.jdbc.ResultSet,com.mysql.jdbc.PreparedStatement to make requests to mysql?
tagged with: apache-commons-dbcp
answer count: 1
tagged with: tomcat
score: 0
tagged with: jdbc
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/q/26704904
has body: How would you go about reverse mapping without using BiMap's .inverse() function? I was given: public static Map&lt;String, Set&lt;String&gt;&gt; reverseMapping(Map&lt;String, String&gt; mapping) I tried something like this but didn't get me anywhere. Map &lt;String, Set&lt;String&gt;&gt; remap = new HashMap&lt;String, Set&lt;String&gt;&gt;(); for (String name : mapping.keySet()) { String color = mapping.get(name); if(remap.containsKey(color)){ ...; } else{ ... } } return remap; }
has title: Map and reverseMapping without BiMap
has comment: http://stackoverflow.com/comment/42002927
has comment: http://stackoverflow.com/comment/42003061
tagged with: dictionary
has comment: http://stackoverflow.com/comment/42003216
score: 0
has answer: http://stackoverflow.com/a/26705166
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42003179
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26705166

http://stackoverflow.com/q/26755608
score: -1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1967987
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26757286
has title: Finding everything that affects a variable
has body: I'm trying to make a program that will read in a class file and if you give it a variable for example you give it "i" in the following example: public class Example { public static void main( String[] args) { int i = 1; int j = 5; int k = 2; i = i + k; System.out.println(i); } } Then my program will return int i = 1; int k = 2; i = i + k; System.out.println(i); Since these are variables that affect i. I'm not sure how to do this. So far I've tried using javaparser which takes in the file and finds all the VariableDeclarationExpr using a visitor pattern. However, this won't print out the bottom two cases in the code above. Can anyone give me any hints to how to find them?
tagged with: java
downvote count: 1
type: Question
tagged with: javaparser
upvote count: 0

http://stackoverflow.com/q/26721442
has answer: http://stackoverflow.com/a/26744077
has comment: http://stackoverflow.com/comment/42059157
score: 0
possible better answer: http://stackoverflow.com/a/26733154
answer count: 2
has answer: http://stackoverflow.com/a/26733154
tagged with: emulation
has comment: http://stackoverflow.com/comment/42037453
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/26744077
tagged with: java
has title: libGDX black screen in 'Android', works fine on 'Desktop'
type: AnsweredQuestion
has body: listen - I'm trying to learn the libGDX API because I want to develop a small cross-platform game, mostly for smartphones (Android iOS). So I started a new project with the libGDX special setup that the developers made, I installed Gradle on my Eclipse and everything went out great, I ran the 'Desktop' version of the small demo, and it worked out perfectly (Linux if that matters), I even did a couple of changes in the code and made a really small game, which worked out fine. And then, I wanted to follow my main goal, and start developing for Android, so I ran an emulator, created a brand new clean project, and I was told that the app unexpectedly stopped, then I saw that to run opengl2 in Android emulator I have to check the 'gpu host' box, so I did that. I restarted the emulator, ran my app and all I saw was a black screen, and in the catlog console I was informed with the next line: E/EGL_emulation(1191): rcCreateWindowSurface returned 0 and - eglCreateWindowSurface(631): error 3x3003 (EGL_BAD_ALLOC) I don't know what to do now, I even tried to run it in a real Android device and I got the same results, how could I fix this problem/error ? EDIT: here is some source files if you're wondering - import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class FlappyRabbi extends ApplicationAdapter { SpriteBatch batch; Texture img; @Override public void create () { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); } @Override public void render () { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.end(); } }
type: Question
tagged with: android

http://stackoverflow.com/q/26696986
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26697050
has title: Before any thread dies will it call notify for all objects waiting on thread reference
tagged with: java
type: Question
score: 0
answer count: 1
has body: Please check bellow code it work fine even though i haven't called notify(). So my question is that does any thread will call notifyAll() implicitly before it dies ? class ThreadB extends Thread{ int total; @Override public void run() { super.run(); synchronized (this) { for(int i=0; i&lt;100; i++) total += i; } } } public class ThreadA { public static void main(String[] args) throws InterruptedException{ ThreadB b = new ThreadB(); b.start(); synchronized (b) { b.wait(); System.out.println("ThreadA.main()"); } } }
accepted answer: http://stackoverflow.com/a/26697050
has comment: http://stackoverflow.com/comment/41989187
tagged with: android

http://stackoverflow.com/comment/42231222
score: 0
comment on: http://stackoverflow.com/q/26832270
type: Comment
type: QuestionComment
has text: Unsure, but I think it's because the class is only constructed at the beginning of the program, but it's parent class is being called constantly and the values are reset every time it is. It was in the specification that they had to be static so...

jdbc
tags question: http://stackoverflow.com/q/26712370
tags question: http://stackoverflow.com/q/26800524
tags question: http://stackoverflow.com/q/26735044
tags question: http://stackoverflow.com/q/26778780
tags question: http://stackoverflow.com/q/26753936
tags question: http://stackoverflow.com/q/26766843
tags question: http://stackoverflow.com/q/26693470
tags question: http://stackoverflow.com/q/26698351
tags question: http://stackoverflow.com/q/26777992
tags question: http://stackoverflow.com/q/26688636
tags question: http://stackoverflow.com/q/26778706
tags question: http://stackoverflow.com/q/26808965
tags question: http://stackoverflow.com/q/26767947
tags question: http://stackoverflow.com/q/26712230
tags question: http://stackoverflow.com/q/26674463
tags question: http://stackoverflow.com/q/26700304
tags question: http://stackoverflow.com/q/26684845
tags question: http://stackoverflow.com/q/26788245
tags question: http://stackoverflow.com/q/26759681
tags question: http://stackoverflow.com/q/26787382
tags question: http://stackoverflow.com/q/26770083
tags question: http://stackoverflow.com/q/26676852
type: Tag
tags question: http://stackoverflow.com/q/26696497
tags question: http://stackoverflow.com/q/26733307
tags question: http://stackoverflow.com/q/26677633
tags question: http://stackoverflow.com/q/26797717
tags question: http://stackoverflow.com/q/26785842
tags question: http://stackoverflow.com/q/26698914
tags question: http://stackoverflow.com/q/26767073
tags question: http://stackoverflow.com/q/26687779
tags question: http://stackoverflow.com/q/26720902
tags question: http://stackoverflow.com/q/26721704
tags question: http://stackoverflow.com/q/26743841
tags question: http://stackoverflow.com/q/26684648
tags question: http://stackoverflow.com/q/26682265
tags question: http://stackoverflow.com/q/26760759
tags question: http://stackoverflow.com/q/26772343
tags question: http://stackoverflow.com/q/26741563
tags question: http://stackoverflow.com/q/26751883
tags question: http://stackoverflow.com/q/26772689
tags question: http://stackoverflow.com/q/26690757
tags question: http://stackoverflow.com/q/26701977
tags question: http://stackoverflow.com/q/26711383
tags question: http://stackoverflow.com/q/26693073
tags question: http://stackoverflow.com/q/26685648
tags question: http://stackoverflow.com/q/26787747
tags question: http://stackoverflow.com/q/26683315
tags question: http://stackoverflow.com/q/26688747
tags question: http://stackoverflow.com/q/26737651
tags question: http://stackoverflow.com/q/26759834
tags question: http://stackoverflow.com/q/26766592
tags question: http://stackoverflow.com/q/26787761
tags question: http://stackoverflow.com/q/26813889
tags question: http://stackoverflow.com/q/26766850
tags question: http://stackoverflow.com/q/26685830
tags question: http://stackoverflow.com/q/26705897
tags question: http://stackoverflow.com/q/26709184
tags question: http://stackoverflow.com/q/26735636
tags question: http://stackoverflow.com/q/26680987
tags question: http://stackoverflow.com/q/26760036
tags question: http://stackoverflow.com/q/26749426
tag name: jdbc
tags question: http://stackoverflow.com/q/26813220
tags question: http://stackoverflow.com/q/26818859
tags question: http://stackoverflow.com/q/26780404
tags question: http://stackoverflow.com/q/26754178
tags question: http://stackoverflow.com/q/26790722
tags question: http://stackoverflow.com/q/26780184
tags question: http://stackoverflow.com/q/26751397
tags question: http://stackoverflow.com/q/26731745
tags question: http://stackoverflow.com/q/26794073

http://stackoverflow.com/comment/42079867
has text: I want only exclude application.properties when I package my war using maven, everything else works fine. I don't want to delete application.properties after generating the war.
score: 0
comment on: http://stackoverflow.com/q/26744060
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26725220
tagged with: android-arrayadapter
tagged with: futuretask
tagged with: java
has answer: http://stackoverflow.com/a/26725602
score: 0
answer count: 2
has body: I am building an application which is dynamically populating/depopulating arraylist depending on Futuretask thread which communicates with server. Problem is that when i add new object into my arrayadapter and in any way i call notifyDataSetChanged or setNotifyOnChange (for example after adding item, i also tried make some postadd function which calls notifyDataSetChanged, or even tried adding setNotifyOnChange in adapter constructor, or before adding (adapter.setNotifyOnChange(true))) in this Futuretask it simply freezes the thread and causes application malfunction. Without notifyonchange when i slide with my finger to call ArrayAdapter's getView() it works, but that is an undesired behavior. Note: I am accessing the adapter by static variable reference. Note#2: I dont think creating new adapter over and over again is a smart choice. /edit: My remove method looks like this: public void remove (int itemid) { for (ContactItem i : items) if (i.ID == itemid) items.remove(i); } (and it hangs in the end at the last pharantesis)
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26725440
has title: ArrayAdapter refreshing data
type: Question

http://stackoverflow.com/comment/42080686
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26747467
score: 1
has text: Side note: on both of these answers, the Strings should be null-checked to avoid a potential exception on sorting.

http://stackoverflow.com/a/26687044
has comment: http://stackoverflow.com/comment/41971701
has comment: http://stackoverflow.com/comment/42008245
accepted answer of: http://stackoverflow.com/q/26686872
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42166661
has comment: http://stackoverflow.com/comment/42059826
answers question: http://stackoverflow.com/q/26686872
type: Answer
has comment: http://stackoverflow.com/comment/41972023
has comment: http://stackoverflow.com/comment/41971977
has comment: http://stackoverflow.com/comment/41971717
has comment: http://stackoverflow.com/comment/41971813
has comment: http://stackoverflow.com/comment/42059489
has comment: http://stackoverflow.com/comment/41988954
has comment: http://stackoverflow.com/comment/42167310
has body: Steps: Change ListView to Expandablelistview. Add subitems for the group items required. Example :Custom Navigation Drawer
has comment: http://stackoverflow.com/comment/41975959
has comment: http://stackoverflow.com/comment/42166586
has comment: http://stackoverflow.com/comment/41972292
has comment: http://stackoverflow.com/comment/41993388
has comment: http://stackoverflow.com/comment/42323917
score: 0

http://stackoverflow.com/q/26695190
linked to: http://stackoverflow.com/q/24954281
tagged with: dspace
type: Question
has body: Code: /** * Creates a * cited document from the given bitstream of the given item. This * requires that bitstream is contained in item. * &lt;p&gt; * The Process for adding a cover page is as follows: * &lt;ol&gt; * &lt;li&gt; Load source file into PdfReader and create a * Document to put our cover page into.&lt;/li&gt; * &lt;li&gt; Create cover page and add content to it.&lt;/li&gt; * &lt;li&gt; Concatenate the coverpage and the source * document.&lt;/li&gt; * &lt;/p&gt; * * @param bitstream The source bitstream being cited. This must be a PDF. * @return The temporary File that is the finished, cited document. * @throws java.io.FileNotFoundException * @throws SQLException * @throws org.dspace.authorize.AuthorizeException */ public File makeCitedDocument(Bitstream bitstream) throws IOException, SQLException, AuthorizeException, COSVisitorException { PDDocument document = new PDDocument(); PDDocument sourceDocument = new PDDocument(); try { Item item = (Item) bitstream.getParentObject(); sourceDocument = sourceDocument.load(bitstream.retrieve()); PDPage coverPage = new PDPage(PDPage.PAGE_SIZE_LETTER); generateCoverPage(document, coverPage, item); addCoverPageToDocument(document, sourceDocument, coverPage); document.save(tempDir.getAbsolutePath() + "/bitstream.cover.pdf"); return new File(tempDir.getAbsolutePath() + "/bitstream.cover.pdf"); } finally { sourceDocument.close(); document.close(); } } What I'm trying to achieve after pdf merge: Retain PDF/A compliance if sourceDocument is PDF/A compliant Retain bookmarks if sourceDocument contains bookmarks Retain the metadata of sourceDocument (eg Title, Author, Subject, Keywords) Please don't suggest iText, I have already achieved this using iText but due to licensing, we need to use pdfbox instead. Please also note that I did not write these code, this is from dspace. You can find the complete code here: CitationDocument.java
score: 5
upvote count: 5
tagged with: pdfbox
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
has title: How to concatenate two pdfs and retain bookmarks and pdf/a compliance using pdfbox?
favorite count: 0
type: UnansweredQuestion
tagged with: pdfa
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/48454281

http://stackoverflow.com/comment/42014373
type: Comment
score: 0
has text: * is for 0 or more characters if you want to ensure at least one character then use + instead of *
comment on: http://stackoverflow.com/a/26711161
type: AnswerComment

http://stackoverflow.com/comment/42110612
type: QuestionComment
has text: You need a join here, go thorugh this link once http://www.techonthenet.com/sql/joins.php
comment on: http://stackoverflow.com/q/26764820
score: 0
type: Comment

http://stackoverflow.com/q/26823002
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26823104
tagged with: java
has body: How can I create the POJO classes with JAXB with such a xml structure : value1 value2 value3 value4 As you can see the first procedure tag is not the root one and is the same than the second procedure tag.
tagged with: jaxb
type: Question
tagged with: pojo
score: 0
has title: Java JAXB xml pojo classes
answer count: 1

http://stackoverflow.com/q/26748915
downvote count: 0
has comment: http://stackoverflow.com/comment/48464895
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question
has body: I'm having an issue that you all might know how to solve. I pushed a new build for one of my projects to my Sonatype Nexus instance. Then I updated the dependencies of another project to use the new build version. After refreshing the project, Eclipse was complaining of the following issue. "Illegal entry in Gradle Dependencies: c:/Users/..." I proceeded to build the project on the command line with "gradle build" and it succeeded in downloading the new artifact dependency. Again I went to my Eclipse project and refreshed it using the STS Gradle -&gt; Refresh All, same issue. After surfing the web a bit I found some posts that said to try re-importing the project, but that did not work either. After a few more refreshes and a comp reboot I still had not gotten any where. Next I used "gradle cleanEclipse eclipse" and the issue was resolved in Eclipse but now it does not recognize it as a Gradle project. If anyone knows of a fix that allows the new dependencies version to be imported with out resorting to generating the Eclipse files manually please let me and the rest of the SO community know. EDIT: The full error is as follows: Project 'Spirit' is missing required library: 'C:\Users\Zixradoom\Documents\bin\eclipse\eclipse\unresolved dependency - org.apache.logging.log4j log4j-core 2.0.2' I deleted the gradle cache dir and then rebuilt the project on the command line which restored the cache but, now Eclipse is claiming that it can no longer see any of the libs. I have refreshed the project and that did not update them either. Gradle Build Snipet: repositories { maven { credentials { username mavenUser password mavenPassword } url "https://www.example.com/nexus/content/groups/public" } } dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.0.2' compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.0.2' compile group: 'com.s2d', name: 'Cognition', versio…
tagged with: spring-tool-suite
upvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42276006
has comment: http://stackoverflow.com/comment/42108014
type: UnansweredQuestion
has title: Eclipse STS Gradle Plugin Dependency Breaks
has answer: http://stackoverflow.com/a/29692047
tagged with: gradle-eclipse
score: 2

http://stackoverflow.com/a/26735708
score: -1
has body: You can use this query to get your result. This query should be run in the same session which was used to perform insert. select last_insert_id();
type: Answer
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/26735636

http://stackoverflow.com/a/26810100
has comment: http://stackoverflow.com/comment/42193547
has comment: http://stackoverflow.com/comment/42193321
has comment: http://stackoverflow.com/comment/42198736
has comment: http://stackoverflow.com/comment/42193267
has comment: http://stackoverflow.com/comment/42193003
type: Answer
has comment: http://stackoverflow.com/comment/42194806
has body: It looks like you are loading a bitmap into memory. In an android app you only have about 16 megabytes of ram available, so you can run out of ram very quickly, and an outOfMemoryError will occur. You can fix this by using the resource id of the image instead of a Bitmap object. For example, use: setContentView(R.layout.view_id); where view_id is the id of the view you want displayed.
has comment: http://stackoverflow.com/comment/42202381
answers question: http://stackoverflow.com/q/26809927
has comment: http://stackoverflow.com/comment/42193351
has comment: http://stackoverflow.com/comment/42193050
has comment: http://stackoverflow.com/comment/42194782
score: 0

http://stackoverflow.com/comment/42032865
has text: In what way is your program not already able to accomplish this?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26721465

http://stackoverflow.com/a/27677496
has body: What you can try is take one constant key (or simply nullwritable) and pass this as a key and your complete line as a value(you can reverse it in mapper class or you can also reverse it in the reducer class as well). so your reducer will receive a constant key (or place holder if you have used nullwritable as a key) and complete line. Now you can simply reverse the line and write it to output file. By not using tmp as a key you avoid writing unwanted numbers in your output file.
score: 0
answers question: http://stackoverflow.com/q/26743762
type: Answer

http://stackoverflow.com/comment/42083259
score: 0
type: AnswerComment
has text: For this particular assignment I had to set the layout to null...so what do you recommend that I change my code to
type: Comment
comment on: http://stackoverflow.com/a/26749497

http://stackoverflow.com/q/26708903
has answer: http://stackoverflow.com/a/26709000
possible better answer: http://stackoverflow.com/a/26708944
has comment: http://stackoverflow.com/comment/42009904
has answer: http://stackoverflow.com/a/26708944
downvote count: 2
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/42009845
tagged with: java
has comment: http://stackoverflow.com/comment/42009794
accepted answer: http://stackoverflow.com/a/26709000
type: Question
answer count: 2
upvote count: 0
score: -2
has title: Create a map which has integer as key and an enum as values
has comment: http://stackoverflow.com/comment/42009836
has body: How to create map in java with integer as key and enum as value?
favorite count: 0

http://stackoverflow.com/a/26692109
type: Answer
answers question: http://stackoverflow.com/q/26691883
downvote count: 1
score: -1
upvote count: 0
has body: It looks to me like you're missing one or more the Spring Framework jars from your web application. If you look at the stack trace there's a line: Caused by: java.lang.NoClassDefFoundError: org/springframework/core/NestedRuntimeException I'd say you don't have the "spring-core" jar in your web application. You need the Spring jars in your web app's WEB-INF/lib directory. Most Spring-based web applications need at least "spring-beans", "spring-context", "spring-core" "spring-io" and "spring-web" .. perhaps more, I'm working from memory here.

http://stackoverflow.com/comment/42093128
type: QuestionComment
comment on: http://stackoverflow.com/q/26754510
has text: Sorry I've never used nashorn so I can only try to give you hints... usually when we see errors in line 1 it's because the javascript was minified. Maybe there is some option in nashorn / eclipse to enable automatic minification, and this option would have been turned on?
score: 0
type: Comment

http://stackoverflow.com/comment/42157639
score: 0
comment on: http://stackoverflow.com/q/26790059
has text: Since you've tagged that: [The "Double-Checked Locking is Broken" Declaration](http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html) - that's a) a good example for horrible things that can happen multithreaded b) written with the old memory model in mind. Some parts are no longer correct and you can in fact use double checked locking in a very specific way that is explained in the end. Also http://jeremymanson.blogspot.de/2008/05/double-checked-locking.html is a good (up to date) read. And if you're still not satisfied read [JCIP](http://jcip.net/)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26689027
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41975068
upvote count: 4
has body: I'm using RealTextView library and I face the following problem. First let me say, I would gladly use this in Android Studio (and gradle). Yet, I have project in Eclipse that has the need of the RealEditText view properties. I've tried *manual import of the library and the RealEditText behaves like TextView. in my layout.xml: &lt;com.myapplication.view.RealEditText android:id="@+id/realEditText1" android:layout_width="400dp" android:layout_height="300dp" android:layout_below="@+id/textView1" android:layout_marginTop="70dp" android:layout_toRightOf="@+id/textView1" android:ems="10" real:minTextSize="18sp" android:text="RealEditText" /&gt; And then referencing it in the activity/fragment (pretty common practice, nothing fancy happening here). private RealEditText mRealEText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mRealEText = (RealEditText) findViewById(R.id.realEditText1); } I also tried adding the property android:editable="true" to the view, but it made no difference. Anyone has tried importing this library to Eclipse? Any ideas why this happens? *copied the lib package (without the checkbox and button views), updated the attr.xml with the lib data EDIT: Solution to this issue is enabling touch properties in the widget declaration: android:focusable="true" android:focusableInTouchMode="true"
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: RealEditText behaves like TextView (Compatibility with Eclipse)
score: 3
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41975008
tagged with: gradle
downvote count: 1

http://stackoverflow.com/comment/42192804
type: Comment
type: QuestionComment
has text: It worked under windows but when I deployed on server It failed, same is true for Mac
comment on: http://stackoverflow.com/q/26810055
score: 0

http://stackoverflow.com/a/26718229
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26717768
answers question: http://stackoverflow.com/q/26717768
score: 1
has body: Since non-static inner classes have a special relationship with their outer class you always need an instance of the outer class to create an instance of the inner class. In your case, where a non-inner class extends an inner class, you'll need to either create an instance of the outer class or pass it: public class Subcl extends Supcl.Inner { public Subcl() { //assuming there is a no-argument constructor Supcl() //this only works in one statement so the call to super is still //part of the first statment in this constructor new Supcl().super(34); //will call Inner(34) } public Subcl( Supcl sup) { sup.super(34); //will call Inner(34) } } Note that you'd have to do this even if Inner had a no-argument constructor, since you need to somehow get the instance of Supcl and the compiler can't deduce this. Finally a word of advise (although it is primarily my opinion): as you can see the syntax for inner classes is not always straight forward and it might be hard to grasp what's going on in some cases, thus I'd suggest using inner classes only in simple cases and only if you really need them. It will make your life a lot easier :)
upvote count: 1

http://stackoverflow.com/a/26733997
score: 0
answers question: http://stackoverflow.com/q/26733909
type: Answer
has comment: http://stackoverflow.com/comment/42054679
has body: Every loop pass creates a new Nat object which needs memory. Since the loop is always running and has no breaking condition, the memory grows really fast.
has comment: http://stackoverflow.com/comment/42055823

http://stackoverflow.com/a/26790047
has comment: http://stackoverflow.com/comment/42156252
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26789819
type: Answer
score: 1
upvote count: 1
has body: The method printf() is not the same as println(). It is used for formatted output. The first parameter is a string that formats the characters. For example: System.out.printf( "%2d %2d%n", x, y ); But you used the thing that you wanted to print as the first argument. The method thinks this is a format string, and looks for parts that begin with %. You probably have % in your string, but after it there is an _. This is not a legal format, so you get this exception. You probably wanted to use the println() method. Using it would eliminate the exception.
accepted answer of: http://stackoverflow.com/q/26789819
downvote count: 0

http://stackoverflow.com/a/32723048
score: -1
upvote count: 0
type: Answer
has body: The content of org.eclipse.wst.common.component looks typical to Maven projects I have in Luna - I'm not seeing those warnings, but I have all Validators disabled. Go to Preferences, Validation, and Suspend All. You could work out which validator is producing the message and disable just that one.
downvote count: 1
answers question: http://stackoverflow.com/q/26699644

http://stackoverflow.com/a/26811098
upvote count: 2
answers question: http://stackoverflow.com/q/26810814
score: 2
has body: If the values are unique, put them in Sets rather than Array Lists. Suppose you have Set&lt;String&gt; oracleSet = new HashSet&lt;&gt;(); Set&lt;String&gt; msSet = new HashSet&lt;&gt;(); Then after you fill them up, You can use msSet.removeAll(oracleList); Then, if msSet.isEmpty() returns false, you know you have items in msSet which did not exist in oracleSet. And you can print them all if you wish by iterating on msSet. Of course, if you need to keep msSet for further work as it was before the deletion, use a copy of it: Set&lt;String&gt; copyOfMsSet = new HashSet&lt;&gt;( msSet ); and use copyOfMsSet.removeAll(oracleList) instead of msSet.removeAll(oracleList). HashSets are very efficient to search, if you don't need the items to be ordered. If you do, you should probably use a TreeSet, but that will be less efficient. Mind you, the efficiency depends on the set's capacity and load factor (which can be set in the constructor) and this may affect performance for very large sets. If the oracleSet is much larger than the msSet, it may by more efficient to do something like this: Set &lt;String&gt; intersectionOfMsAndOracleSets = new HashSet&lt;&gt;( msSet ); intersectionOfMsAndOracleSets.retainAll( oracleSet ); And then msSet.removeAll( intersectionOfMsAndOracleSets ); That is, suppose msSet has a size of n and oracleSet has a size of m, and n is much smaller than m, then the operation of the intersection takes O(n), while my original suggestion is O(m). If m is about four times bigger than n, this becomes more efficient.
has comment: http://stackoverflow.com/comment/42194943
downvote count: 0
has comment: http://stackoverflow.com/comment/42195473
type: Answer
has comment: http://stackoverflow.com/comment/42202246

http://stackoverflow.com/q/26781154
type: Question
has answer: http://stackoverflow.com/a/26781304
has body: I am using BlueJ, for reference. The program compiles and runs fine. The problem is that I believe I am supposed to be adding to an existing array, but instead it seems I'm just adding to a new one. The program reads this text file called "EmployeeData.TXT": S Washington,George 000001 125000 H MacDonald,Ronald 386218 7.80 true 40 H Walton,Samuel 268517 8.21 false H Thomas,David 131313 9.45 true 38 H Sanders,HarlandDavid 277651 8.72 false S Baron,James 368535 310236 I am supposed to be adding (among other things) to that. When I add an employee, it doesn't display it with the above list of employees, it doesn't display that list at all. Here is a snippet of the output I currently get, showing it doesn't include the text file data. S, Ghandhi, Mohandas 1111 150000.0 H, Luther, Maritn 2222 10.5 false false H, Mandela, Nelson 3333 12.5 true true 40 In addition, I'm not sure why there is a comma coming after the S / H.. Is that what causes it to not add to the data brought from the text file? Here is my main class, WorkerApp: public class WorkerApp{ public static void main (String args[]){ Company company = new Company(); try{ Scanner reader = new Scanner (new File("EmployeeData.txt")); while(reader.hasNext()){ String line = reader.nextLine(); String Employee[] = new String[7]; String sorh = Employee[0]; String name = Employee[1]; String id = Employee[2]; double salary = Double.parseDouble(Employee[3]); Employee e; if (Employee[0].equals("S")){ e = new SalariedWorker(sorh, name, id, salary);} else { boolean overtime = Boolean.parseBoolean(Employee[4]); if(overtime){ int maxhu = Integer.parseInt(Employee[5]); e = new HourlyWorker(sorh, name, id, salary, maxhu); } else{ e = new HourlyWorker(sorh, name, id, salary); } } company.add(e); } }catch (Exception err){ System.out.println("Cannot open EmployeeData.TXT."); } System.out.println("REPORT"); company.print(); System.out.println(); System.out.println("1. Adding a salaried worker"); SalariedWorker s1 = new SalariedWorker("S…
tagged with: bluej
has title: Not Adding to Array Properly. Hope for assistance
score: 0
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26781304
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41983914
comment on: http://stackoverflow.com/a/26694171
type: Comment
score: 0
has text: Unfortunately, this doesn't solve the problem. The questioner wants to be able to modify `curNumber`.
type: AnswerComment

http://stackoverflow.com/a/26810297
upvote count: 3
score: 3
has body: Not really an detailed answer but allready too long for a comment. Spring security comes with a feature that is exactly what you need : Domain Object Security or ACLs It's a rather advanced feature because if needs to add a set of tables to represents the authorizations of users on every secured domain object. One for the object classes, one for the objects themselves (only primary key is stored) and others for actual authorizations. In fact, it can be seen as the authorizations on a shared filesystem. You normaly use then method security with @PreAuthorize annotation that allows to use an expression containing the actual parameters of the method. You directly allow a user to modify, or delete each and every domain object. In addition to the Spring Security Reference Manual already cited above, you can find a complete tutorial on ACLs on krams::: Spring Security 3: Full ACL Tutorial. My advice : try and experiment and ask questions here if you get stuck on some specific problems.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26807867
accepted answer of: http://stackoverflow.com/q/26807867
type: Answer
has comment: http://stackoverflow.com/comment/42196713

http://stackoverflow.com/comment/42070912
type: QuestionComment
comment on: http://stackoverflow.com/q/26739858
has text: can you by any change post the html source?
score: 0
type: Comment

http://stackoverflow.com/comment/42034445
score: 0
type: Comment
type: QuestionComment
has text: You cannot remove arbitrary lines from a text file directly. Period. You will have to find another way. Why don't you look into e.g. an SQLite database? SQLite doesn't require any database server, just a data file; you can easily have one app adding records while the other processes and removes, and you may learn a few new useful skills in the process. A flat text file is not generally the best for storing processing queues like that; and, ignoring memory (which may not even be a problem) you *will* run into concurrency issues even if you get the line removal down.
comment on: http://stackoverflow.com/q/26722140

http://stackoverflow.com/comment/42000478
comment on: http://stackoverflow.com/a/26703107
score: 0
type: AnswerComment
has text: I added following code but checkbox are not displayed `JCheckBox checkbox; List<JCheckBox> checkboxes = new ArrayList<JCheckBox>(); String labels[] = {"jCheckBox1", "jCheckBox2", "jCheckBox3", "jCheckBox4", "jCheckBox5", "jCheckBox6","jCheckBox7","jCheckBox8","jCheckBox9"}; for (int i = 0; i < labels.length; i++) { { checkbox= new JCheckBox(labels[i]); checkboxes.add(checkbox); jPanel2.add(checkbox); }`
type: Comment

http://stackoverflow.com/q/26831407
tagged with: java
accepted answer: http://stackoverflow.com/a/26843210
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26843210
answer count: 1
favorite count: 0
has body: We have a case where we need to fire a server call to fetch next 100 records as soon as the user scrolls down to see the last element in a scroll bar. Please share any pointers.
tagged with: swt
type: AnsweredQuestion
score: 2
downvote count: 0
has title: How to know if the user has scrolled to the end in an SWT Scrolled Bar?

http://stackoverflow.com/q/26809242
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26809468
answer count: 1
has title: why the header attribute of linked list is set as transient
score: 0
has answer: http://stackoverflow.com/a/26809468
tagged with: linked-list
has body: If one attribute is set transient then it's not able to be serialized, I'm wondering why the Entry header in LinkedList is set as transient. The part of source code as following: public class LinkedList{ private transient Entry header = new Entry(null, null, null); ... }
type: Question

http://stackoverflow.com/a/26826669
type: Answer
has body: I think that the bast way is to use file system. If you are on linux you can put all the document in one directory. In NTFS file system create a hierarchy of directory using a pattern like year/month/day of the pdt and reference its path in mysql. For apache it'll be static resources and you'll have the best performances.
answers question: http://stackoverflow.com/q/26826514
score: 0

http://stackoverflow.com/comment/42137044
comment on: http://stackoverflow.com/q/26779486
type: Comment
score: 1
type: QuestionComment
has text: None of the above? It is just the Servlet 3.0+ way of registering a servlet, basically the replacement of the web.xml.

http://stackoverflow.com/comment/48224731
score: 0
has text: @svlada it looks like you didn't correctly override persistent provider. I'd suggest you to create new question and describe fully your issue there.
type: Comment
comment on: http://stackoverflow.com/a/26768877
type: AnswerComment

http://stackoverflow.com/comment/42186543
type: Comment
has text: Wouldn't having this second file in the /src/test/resources and verify that it's values are used test this? What you are doing is a very common pattern and people put files in /stc/test/resources all the time that override properties set in production. I have not heard of anything trying to test this further.
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26802620

http://stackoverflow.com/a/26775814
type: Answer
score: 1
upvote count: 1
has body: It appears to be related to a version mismatch for the dependencies. The sample code uses the Gradle spring-boot plugin to sort out transitive dependencies. However, this can't be used in my project as I am using the gradle-grails plugin, which specifically forbids using the Java or Groovy plugins (and the spring-boot plugin requires the Java one). When I changed the dependencies from 4.1.1 (latest, 6 Nov 14) to 4.0.6 of these two dependencies, the error went away: compile "org.springframework:spring-context:4.0.6.RELEASE" compile "org.springframework:spring-tx:4.0.6.RELEASE"
accepted answer of: http://stackoverflow.com/q/26757470
answers question: http://stackoverflow.com/q/26757470
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26789563
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26789515
has comment: http://stackoverflow.com/comment/42155358
has comment: http://stackoverflow.com/comment/42155256
type: Answer
answers question: http://stackoverflow.com/q/26789515
downvote count: 0
score: 1
upvote count: 1
has body: try this : Scanner keyboard = new Scanner(System.in); public static int counter = 1; public void readInput() { System.out.println("for the "+counter +"line "); String degerler = keyboard.nextLine(); counter++; } more information : Static variable’s value is same for all the object(or instances) of the class

http://stackoverflow.com/a/26779492
type: Answer
score: 9
answers question: http://stackoverflow.com/q/26779393
upvote count: 9
has body: The problem is that by using scanner.nextInt() you only read an integer value, but not the whole line and you don't consume the newline character (\n) that is appended to the line when you press Enter. Then, when you process reading with scanner.nextLine() you consume the newline character (\n) and from the previous row and don't read the line you want to read. In order to force it to read it, you have to add an additional input.nextLine() statement. System.out.println("2---"); int try2 = scan.nextInt(); System.out.println("3---"); scan.nextLine(); //&lt;-- fake statement, to move the cursor on the next line String try3 = scan.nextLine(); Not related to the question, you have to close the Scanner, after finishing work, otherwise the compiler complains with a warning: scan.close();
downvote count: 0

http://stackoverflow.com/comment/127565602
type: AnswerComment
type: Comment
has text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
score: 1
comment on: http://stackoverflow.com/a/72196439

http://stackoverflow.com/comment/42203167
score: 0
has text: Hope this may help you!
type: AnswerComment
comment on: http://stackoverflow.com/a/26816238
type: Comment

http://stackoverflow.com/a/26768329
has body: I figured it out! Neuroph has its own settings when it comes to memory management: the file that should be edited is (in my case!): C:\Program Files\neurophstudio\etc\neurophstudio.conf The settings can be different for different memory needs
answers question: http://stackoverflow.com/q/26765155
score: 0
type: Answer

http://stackoverflow.com/comment/42068387
type: QuestionComment
score: 0
has text: and what do you mean by "it worked with gmail"
comment on: http://stackoverflow.com/q/26740970
type: Comment

http://stackoverflow.com/comment/42154792
has text: @JBNizet Coding up something that's already in the JDK is a good programming exercise. It means that you have a model solution to consult when you've finished.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26789205

http://stackoverflow.com/comment/42051818
type: QuestionComment
has text: I did not know that site like code review exists :) I will put next posts like this there. Thx for the hint.
type: Comment
comment on: http://stackoverflow.com/q/26731829
score: 0

http://stackoverflow.com/q/26673319
has comment: http://stackoverflow.com/comment/42092116
answer count: 0
tagged with: java
has title: How to identify the xpath for below html which is having text and link
type: Question
has comment: http://stackoverflow.com/comment/41953062
has body: Please find my code below for HTML Page 1 2 3 I've tried below code. to loop on pages. List<WebElement> allrows = driver.findElements(By.xpath("//*[@id='content']/div[3]/table/tbody/tr")); System.out.println("Total rows :" +allrows.size()); //Getting the page count List<WebElement> allpages = driver.findElements(By.xpath("//div[@class='content-table-pagination']//a")); System.out.println("Total pages :" +allpages.size()); for(int i=1; i<=(allpages.size()); i++) { List<WebElement> allrows1 = driver.findElements(By.xpath("//*[@id='content']/div[3]/table/tbody/tr")); for(int row=1; row<=allrows.size(); row++) { System.out.println("Total rows :" +allrows1.size()); String validatorSoruceRefId = driver.findElement(By.xpath("//*[@id='content']/div[3]/table/tbody/tr["+row+"]/td[7]")).getText(); System.out.println(validatorSoruceRefId); System.out.println("Row loop"); //if(validatorSoruceRefId==Constants.SourceRefId){ if(validatorSoruceRefId.contains("MANTPLAP27102014090917528")){ System.out.println("is it found"); break; } else { System.out.println("Element doesn't exist"); } allpages = driver.findElements(By.xpath("//div[@class='content-table-pagination']//a")); } driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS); allpages.get(i).click(); System.out.println("I'm in page number"+ i); if I use this method to click on paination, it clicks only 1 and 3 pages.It skips the 2nd page. allpages.get(i).click(); Help me on this
has comment: http://stackoverflow.com/comment/42106557
score: 0
has comment: http://stackoverflow.com/comment/42089118
type: UnansweredQuestion
tagged with: selenium-webdriver

http://stackoverflow.com/comment/41963137
has text: No sorry, that wasn't obvious to me, but thank you. Okay now I can't get the digit value to stay in the correct display, as soon as a number bigger than 9 is entered, the digit value goes away
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26681563
type: Comment

http://stackoverflow.com/a/26709492
answers question: http://stackoverflow.com/q/26709317
score: 0
has body: You don't need to import files from another source folder, in eclipse. After the project is built, files from all source folders are compiled in single build folder. Test is folder for testing files. Bottom line : You need NOT import test folder. Check the package name defined in class. Rename it to some other name and then try importing. Don't create source folders as eclipse would create the source folder by itself depending on the package name defined in class
type: Answer

http://stackoverflow.com/a/26683555
type: Answer
score: 6
downvote count: 0
upvote count: 6
has body: Chaining of one Function to another works naturally because the return value of the first function is passed as the argument to the next function, and that function's return value is passed as the argument to the subsequent function, and so forth. This doesn't work naturally with BiFunction because they take two arguments. The first argument would be the return value from the previous function, but what would the second argument be? It also explains why BiFunction allows chaining with andThen to a Function instead of to another BiFunction. This suggests, however, that it would be possible to chain one BiFunction to another if there were some way of providing the value for second argument. This can be done by creating a helper function that stores the value for the second argument in a local variable. Then, a BiFunction can be converted into a Function by capturing that local variable from the environment and using it as the second argument. Here's what that would look like. BiFunction&lt;RemoteWebDriver, WfParams, RemoteWebDriver&gt; chainWanted = this::chainHelper; RemoteWebDriver chainHelper(RemoteWebDriver driver, WfParams params) { return init.andThen(rwd -&gt; wait.apply(rwd, params)) .apply(driver, params); } // ... chainWanted.apply(driver, params); The chainHelper method holds the params argument for later capture. We call init.andThen() in order to do the chaining. But this requires a Function whereas wait is a BiFunction. Instead of using a method reference this::wait we use the lambda expression rwd -&gt; wait.apply(rwd, params) which captures params from the lexical environment. This gives a lambda expression that takes a single argument and returns a single value, so it's now a Function that wraps the wait which is a BiFunction. This is an example of partial application or currying. Finally, we call the resulting BiFunction using apply(), passing the original arguments.
answers question: http://stackoverflow.com/q/26679628

http://stackoverflow.com/q/26696955
type: UnansweredQuestion
has body: I want to sort a map by its values. But the compare method is already in the class. public class Parser implements Comparator&lt;String&gt; { private Map&lt;String, Integer&gt; frequencies; public Parser() { frequencies = new HashMap&lt;String, Integer&gt;(); } public int getCount(String word) { Integer c = frequencies.get(word); if (c == null) { return 0; } else { return c.intValue(); } } public int compare(String o1, String o2) { int count1 = getCount(o1); int count2 = getCount(o2); return count1 &lt; count2 ? -1 : count1 &gt; count2 ? 1 : 0; } public List&lt;String&gt; getWordsInOrderOfFrequency(){ TreeMap&lt;String,Integer&gt; sorted_map = new TreeMap&lt;String,Integer&gt;(); sorted_map.putAll(frequencies); ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(sorted_map.keySet()); return result; } } Here the question is in the getWordsInOrderOfFrequenct() method. I want to sort the keyset by its values after compared.
has answer: http://stackoverflow.com/a/26697001
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41988918
has comment: http://stackoverflow.com/comment/41988598
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2864840
has answer: http://stackoverflow.com/a/33969713
has title: How to sort java sort map by values with the compare method already in class?
linked to: http://stackoverflow.com/q/26667590

http://stackoverflow.com/comment/42165169
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26795283
has text: Thanks, but I would like to know complexity of various data structure in JDK. The url seems only describe data structure's complexity.
score: 0

http://stackoverflow.com/comment/42226321
has text: Why don't you look at each of your four errors individually and search specifically for that error message. Google and SO have a wealth of information. As it is, you haven't even identified what four errors you're getting, nor included all the code, so there's no way for anyone to help you.
comment on: http://stackoverflow.com/q/26829514
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42228173
type: Comment
comment on: http://stackoverflow.com/a/26830664
score: 1
type: AnswerComment
has text: You can wrap them in a bash script and invoke it, also use `ProcessBuilder` instead of `Runtime`

http://stackoverflow.com/a/26800234
accepted answer of: http://stackoverflow.com/q/26800164
has comment: http://stackoverflow.com/comment/65704962
has body: As MDN Window.history() describes : For top-level pages you can see the list of pages in the session history, accessible via the History object, in the browser's dropdowns next to the back and forward buttons. For security reasons the History object doesn't allow the non-privileged code to access the URLs of other pages in the session history, but it does allow it to navigate the session history. There is no way to clear the session history or to disable the back/forward navigation from unprivileged code. The closest available solution is the location.replace() method, which replaces the current item of the session history with the provided URL.
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26800164

http://stackoverflow.com/comment/42106128
score: 0
type: Comment
type: QuestionComment
has text: @PeterNiederwieser I decided to follow your idea adding it via file system. Thanks for your help!
comment on: http://stackoverflow.com/q/26760101

http://stackoverflow.com/comment/42205402
type: Comment
has text: How would the program knows that is referred to the EditText?
comment on: http://stackoverflow.com/a/26817485
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42019989
score: 0
has text: Sorry :) Here is the link: http://rosettacode.org/wiki/Fast_Fourier_transform#JavaScript I've rewritten the _cfft_ function in Java
type: Comment
comment on: http://stackoverflow.com/q/26702187
type: QuestionComment

http://stackoverflow.com/q/26803258
has title: Spring - Multiple PathVariable values for generic request mapping handler
tagged with: java
type: Question
has body: I'm trying to implement a hierarchical taxonomy tree, where it follows the structure term 1 / \ term 2 term 3 / | \ term 4 term 5 term 6 where each Term object contains a set containing all the Terms below it. Traditionally, to access the third level of terms, with a url /term/chapter/section/paragraph a Spring RequestMapping would consist of @RequestMapping(value = "/term/{term1}/{term2}/{term3}", method = RequestMethod.GET) public Term getTerm(@PathVariable("term1") Term rootTerm, @PathVariable("term2") Term childTerm, @PathVariable("term3") Term leafTerm) { /* Processing code here */ return Term; } The downside for this is that it specifically limits the height of the taxonomy tree to the number of specified handlers for the requested URLs. In this case, I'm limited to a tree of height 3. Is there a built in way to pass in the extra Term URL identifiers to a method with no regard to number of child Terms? Or would I have to work on processing the URL itself within the controller?
has answer: http://stackoverflow.com/a/26804496
answer count: 2
downvote count: 0
tagged with: rest
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26804110
score: 2

http://stackoverflow.com/comment/42209335
has text: Then you can convert it into a unicode literals and decode later it with java. You could also do the same thing with with HTML entities. The only way is to encode somehow the special characters and decode them after you select from the DB.
comment on: http://stackoverflow.com/q/26819691
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26832171
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42231738
tagged with: transactions
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42231347
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42232300
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42232509
has answer: http://stackoverflow.com/a/26834887
accepted answer: http://stackoverflow.com/a/26834887
tagged with: spring
has title: @Transaction - How to commit to another method in same transaction
has body: I Have a method using @Transactional annotation, and inside this method, i have one that persists one entity, and the next ones uses this persisted entity that is not yet persisted, because the method using @Transactional dont finished. What is the best approach to do this? I Think about REQUIRED_NEW, but when this is a new transactional, if the external transaction fails, it will not fail all. Thanks !! Paulo @Override @Transactional public Catalog updateCatalog(CatalogPrice catalog, Long id) { CatalogEntity catalogEntity = CatalogEntity.findSingle(id); Catalog catalog = catalogHand.updateCatalogPrice(catalog); catalogEntity.sendToQueue(catalog); return catalog; }
score: 2
has comment: http://stackoverflow.com/comment/42231884
downvote count: 0
has comment: http://stackoverflow.com/comment/42233299

birt
tags question: http://stackoverflow.com/q/26730838
tag name: birt
type: Tag
tags question: http://stackoverflow.com/q/26713409

http://stackoverflow.com/comment/41975776
score: 0
has text: public class StockUser { private String userName; private ArrayList<String> stockSym; private static int id = 1; public StockUser() { userName = ""; id++; } public StockUser(String user) { userName = user; id++; } public StockUser(String userName, String stock) { stockSym.add(stock); this.userName = userName; id++; }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26689443

http://stackoverflow.com/q/26772693
has comment: http://stackoverflow.com/comment/42125196
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/42125560
has comment: http://stackoverflow.com/comment/42125827
tagged with: scala
upvote count: 4
has comment: http://stackoverflow.com/comment/42125465
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26775008
has comment: http://stackoverflow.com/comment/42125497
accepted answer: http://stackoverflow.com/a/26775008
tagged with: higher-kinded-types
has title: Java Generic getting type parameter
type: Question
has comment: http://stackoverflow.com/comment/42125392
has body: In Scala, you can define a class as this: class MyClass[T1[T2]] { def abc(a1: T1[Double]):T1[Int] = ??? } In this code, type parameter T1 represents a type that needs one type parameter T2, so we can create an instance like new MyClass[List]. I want to do this in Java, but I don't have any idea. I wonder if it is possible in Java, and if not, any idea how I can do this thing in Java. From my understanding, generic type essentially makes a function of types. So if you have a class like List&lt;T&gt;, you can think of the class List a function of type, so List takes a type parameter like Integer, then it will be a concrete type like list of integers(List&lt;Integer&gt;). MyClass above takes a type parameter T1, but I want this T1 is also a generic type that takes a type parameter T2, so I can create an instance like MyClass&lt;List&gt; and can use type like List&lt;Integer&gt; or List&lt;Double&gt; inside MyClass. In Scala, if you try MyClass[Int] or MyClass[String] will fail because Int or String does not take a type parameter. Of course, this may not be necessary if I allow to duplicate some codes, but to make a more general code, I think it is indispensable.
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42125416

http://stackoverflow.com/comment/128447660
comment on: http://stackoverflow.com/q/26683777
has text: Other reason what happened to me: Let's suppose that web app is replicated in two web servers. Server A and B. On the other side, we have a web client which connects to webserver using public domain. We have domain A and B. Its config file was aiming to domain A. Even though, there weren't not logs in server A anymore. I was testing the web server by IP instead of domain and it logs. So I realized the provider changed its config file to domain B so the logs was writing on server B but the provider didn't let us know that for several weeks, maybe more than a month.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/41042018
answers question: http://stackoverflow.com/q/26713145
type: Answer
has body: This should do the job: logger.log(Level.getLevel("DIAG"), "your message"); As stated in the log4j2 doc
score: 0

http://stackoverflow.com/a/30574646
downvote count: 0
has body: EDIT: I don't know if anyone is still struggling with this, but with rJava 0.9-9, the 'partial fix' below no longer works. What does work, and completely, is the final solution offered here: https://github.com/s-u/rJava/issues/86 Copying from there, many thanks to Gregory R. Warnes: uninstall existing rJava versions by running the following in the Terminal: Rscript -e 'remove.packages("rJava")' sudo Rscript -e 'remove.packages("rJava")' add the following to /Users/&lt;userid&gt;/.bashrc: export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)/jre' (e.g., type &gt; vim /Users/&lt;userid&gt;/.bashrc in the Terminal, then 'i', add the line above, then ':wq' to save and quit) close and re-start all Terminal, R and RStudio windows type the following in the Terminal window: sudo ln -sf $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib in a new R session, re-install rJava from source: install.packages("rJava", repos="http://rforge.net", type="source") OLD 'PARTIAL FIX' BELOW: Okay. I have been working on this problem all morning, and I have a partial fix. I tried the solution suggested by Guilherme Kenji Chihaya above, but even after sudo R CMD javareconf -n and install.packages('rJava', type='source'), R insists on using Java 1.6 (and is happy to do so). HOWEVER, R studio throws an error after re-installing rJava: library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so': dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so Reason: image not found Error: package or namespace load failed for ‘rJava’ Googling this lead me to this post: http://andrewgoldstone.com/blog/2015/02/03/rjava/, with a workin…
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26745364

http://stackoverflow.com/q/26743712
tagged with: cdi
has title: Correct way to get contextual reference of a Java CDI bean
tagged with: java-ee-7
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26758636
type: Question
upvote count: 2
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26758636
has body: I googled for the way to get contextual reference of a CDI bean. I found 2 ways: 1. Using beans.iterator() public static &lt;T&gt; T getReference(BeanManager bm, Class&lt;? extends T&gt; type, Annotation... qualifiers) { Set&lt;Bean&lt;?&gt;&gt; beans = bm.getBeans(type, qualifiers); if (beans == null || beans.isEmpty()) { throw new IllegalArgumentException("Bean not found."); } // Using beans.iterator() Bean&lt;T&gt; bean = (Bean&lt;T&gt;) beans.iterator().next(); return (T) bm.getReference(bean, type, bm.createCreationalContext(bean)); } 2. Using BeanManager.resolve public static &lt;T&gt; T getReference(BeanManager bm, Class&lt;? extends T&gt; type, Annotation... qualifiers) { Set&lt;Bean&lt;?&gt;&gt; beans = bm.getBeans(type, qualifiers); if (beans == null || beans.isEmpty()) { throw new IllegalArgumentException("Bean not found."); } // Using BeanManager.resolve() Bean&lt;T&gt; bean = (Bean&lt;T&gt;) bm.resolve(beans); return (T) bm.getReference(bean, type, bm.createCreationalContext(bean)); } My question is: Which way is correct? if both are correct, what is context use of each one? Thank you!
tagged with: java-ee-6
answer count: 1
favorite count: 0

http://stackoverflow.com/a/26750055
has body: Could you please try this: restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); String postParams = "\"" + id + "\""; String postResp = restTemplate.postForObject("findRecordById",postParams, String.class);
score: 0
answers question: http://stackoverflow.com/q/26748648
has comment: http://stackoverflow.com/comment/42085098
type: Answer

http://stackoverflow.com/a/26828325
has comment: http://stackoverflow.com/comment/42224415
type: Answer
has comment: http://stackoverflow.com/comment/42246245
has body: This happens because there is no "lambda type" in the Java language. When the compiler sees a lambda expression, it will try to convert it to an instance of the functional interface type you are trying to target. It's just syntax sugar. The compiler can only convert lambda expressions to types that have a single abstract method declared. This is what it calls as "functional interface". And Object clearly does not fit this. If you do this: Runnable f = (/*args*/) -&gt; {/*body*/}; Then Java will be able to convert the lambda expression to an instance of an anonymous class that extends Runnable. Essentially, it is the same thing as writing: Runnable f = new Runnable() { public void run(/*args*/) { /*body*/ } }; I've added the comments /*args*/ and /*body*/ just to make it more clear, but they aren't needed. Java can infer that the lamba expression must be of Runnable type because of the type signature of f. But, there is no "lambda type" in Java world. If you are trying to create a generic function that does nothing in Java, you can't. Java is 100% statically typed and object oriented. There are some differences between anonymous inner classes and lambdas expressions, but you can look to them as they were just syntax sugar for instantiating objects of a type with a single abstract method.
has comment: http://stackoverflow.com/comment/42248824
has comment: http://stackoverflow.com/comment/42224349
answers question: http://stackoverflow.com/q/26828246
has comment: http://stackoverflow.com/comment/42283356
has comment: http://stackoverflow.com/comment/42272257
score: 15
downvote count: 2
upvote count: 17

http://stackoverflow.com/comment/42106467
comment on: http://stackoverflow.com/q/26762045
type: Comment
type: QuestionComment
has text: Dont know if its **THE** problem, but your `byteArrayToHexStr/hexStrToByteArray` don't handle negative values correctly.
score: 1

http://stackoverflow.com/a/26691792
answers question: http://stackoverflow.com/q/26690297
accepted answer of: http://stackoverflow.com/q/26690297
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42015782
has body: In order to increase the time that your socket waits till it receives a data from the other site, you can call following static methods before making your actual connection: HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, 30000); HttpConnectionParams.setSoTimeout(params, 30000);`. The above calls specifies a 30 second timeout for both your connection establishment and socket readings.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26705683
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26705578
has body: Java arrays do not override toString() so you are getting the default implementation from Object. Instead, you can use Arrays.deepToString(Object[]) like System.out.println("The row-sort matrix is..." + Arrays.deepToString(m));
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26705578

http://stackoverflow.com/comment/42063259
has text: 1. Well the point is Dagger needs the `@Inject` annotation on *a constructor*. Since you don't have any special constructors, this will be the no-args one. 2. When using the `BarImpl` parameter, you let Dagger create an instance for you. If `BarImpl` would have any injectable fields, this is done automatically (just like in the `Foo` class). In this case, you could trivially return a new `BarImpl` instance yourself.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26733819
type: Comment

http://stackoverflow.com/comment/113603443
has text: Isn't this the same as the self-answer by Royi that was posted almost a year earlier than this?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/32082350
score: 0

http://stackoverflow.com/a/26695494
has comment: http://stackoverflow.com/comment/41986355
has body: Scanner#nextInt just reads a single int from the input stream. Instead, you want to read a bunch of numbers and start working on them. I can think on two solutions for this: Read the whole line (using Scanner#nextLine), split it by blank space (" ") (using String#split), convert each String into an int and calculate the sum (using Integer#parseInt). int total = 0; System.out.println("Please enter some numbers with a space between each"); String lineWithNumbers = kb.nexLine(); String[] numbers = lineWithNumbers.split(" "); for (String number : numbers) { total += Integer.parseInt(number); } Read the whole line (using Scanner#nextLine), use another Scanner to read the integers stored in this String and calculate the sum. int total = 0; System.out.println("Please enter some numbers with a space between each"); String lineWithNumbers = kb.nexLine(); Scanner lineScanner = new Scanner(lineWithNumbers); while (lineScanner.hasNext()) { total += lineScanner.nextInt(); }
accepted answer of: http://stackoverflow.com/q/26695414
has comment: http://stackoverflow.com/comment/41986317
has comment: http://stackoverflow.com/comment/41986032
answers question: http://stackoverflow.com/q/26695414
has comment: http://stackoverflow.com/comment/41986260
has comment: http://stackoverflow.com/comment/41986005
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41986167
has comment: http://stackoverflow.com/comment/41986241
has comment: http://stackoverflow.com/comment/41985990
type: Answer

http://stackoverflow.com/a/26816511
score: 2
upvote count: 2
has body: This is an enhanced for loop, or a "for each" loop. It iterates over all the elements of str, which is probably a Collection of Strings in your example, or an Array of Strings. Read this for more details. For example, instead of writing this: for (int i = 0; i &lt; myArray.length; i++) { System.out.println(myArray[i]); } you can write its equivalent: for (int myValue : myArray) { System.out.println(myValue); }
answers question: http://stackoverflow.com/q/26816474
accepted answer of: http://stackoverflow.com/q/26816474
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26712475
has title: Which jar file is used during compilation?
type: UnansweredQuestion
has body: Let's assume I have two jar files on classpath when building my project - myJarFile.jar and myJarFileOld.jar. They contain the same packages and the same classes, but the myJarFileOld.jar contains old implementation, which causes that the compilation fails. I'm not asking for solution of this error, I know that I should remove myJarFileOld.jar to make compilation work. However I'd like to know, what mechanism decides which class from which jar file is used during compilation, when both jar files are present?
tagged with: java
type: Question
tagged with: jar
tagged with: compilation
has answer: http://stackoverflow.com/a/26712546
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26712538
has answer: http://stackoverflow.com/a/26713031

http://stackoverflow.com/q/26822900
has comment: http://stackoverflow.com/comment/42214961
has body: I need to add a separate values to a Same key in HashMap in java not in just once. But in a Loop or when ever I need enter those values.for example if key is 1 then values for that is may be 3,5,7,8 count=0; while (true) { Packet info = captor.getPacket(); if (info != null) if(info instanceof TCPPacket){ ///// TCP TCPPacket tc= (TCPPacket) info; } if(info instanceof UDPPacket){ //// UDP UDPPacket ud= (UDPPacket) info; } I am saving the packet number for each packet. and i need to save the number of packets for each Ip address getting IP address as key
has title: save multiple values for same key hash Map in a loop java
answer count: 1
has comment: http://stackoverflow.com/comment/42214965
favorite count: 0
score: -4
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/26822923
accepted answer: http://stackoverflow.com/a/26822923
downvote count: 4
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42214963
upvote count: 0

http://stackoverflow.com/q/26767236
downvote count: 1
type: Question
has title: how to list an items to a JTable
possible better answer: http://stackoverflow.com/a/26768151
tagged with: jtable
score: 0
answer count: 3
tagged with: sql
favorite count: 0
has answer: http://stackoverflow.com/a/26768151
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42115637
has answer: http://stackoverflow.com/a/26769017
tagged with: java
linked to: http://stackoverflow.com/q/3549206
has comment: http://stackoverflow.com/comment/42116465
accepted answer: http://stackoverflow.com/a/26769017
has body: I am trying to create a checkout simulation for my coursework. So every time I search for an item I can retrieve it from the database and display it on the JTable. However, once I add an item to the list and try to add another item the old item get replaced by the new item. I am trying to list all the item in the JTable, this is my code: DBConnection db = new DBConnection(); try { ResultSet rs = DBConnection.stmt.executeQuery("SELECT ID, MESSAGE FROM STOCK WHERE ID = '"+ id + "'"); jTable1.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e){ System.out.println(e); }`
upvote count: 1
has answer: http://stackoverflow.com/a/26767367

http://stackoverflow.com/comment/42212945
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26745831
has text: Thanks for the source code. "Unfortunately", it looks OK, the models should be serializable without problems. So Chris' original suggestion stands: clean, build and redeploy. It seems your current deployment method is not updating the whole application properly. Either recheck with the [documentation](http://www.gwtproject.org/doc/latest/DevGuideDeploying.html) that you are doing everything manually or look into [Maven](http://mojo.codehaus.org/gwt-maven-plugin/) (I'd say it's easiest for you since it's mature and there are tons of tutorials and samples).
type: Comment

http://stackoverflow.com/q/26778413
has comment: http://stackoverflow.com/comment/42135211
has answer: http://stackoverflow.com/a/26779136
favorite count: 0
possible better answer: http://stackoverflow.com/a/46074898
tagged with: spring
has comment: http://stackoverflow.com/comment/42134874
has comment: http://stackoverflow.com/comment/42135210
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26779136
has body: Hi I try write a Spring Security application but i have a problem. I get error: ERROR: org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting co…
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/42135214
downvote count: 0
has comment: http://stackoverflow.com/comment/42135388
score: 4
tagged with: security
has answer: http://stackoverflow.com/a/46074898
has title: NoSuchBeanDefinitionException in Spring Security

http://stackoverflow.com/a/26708382
has comment: http://stackoverflow.com/comment/42009190
has comment: http://stackoverflow.com/comment/42009316
answers question: http://stackoverflow.com/q/26708212
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42009327
has comment: http://stackoverflow.com/comment/42009120
accepted answer of: http://stackoverflow.com/q/26708212
has comment: http://stackoverflow.com/comment/42008994
has comment: http://stackoverflow.com/comment/42009259
has comment: http://stackoverflow.com/comment/42008966
has comment: http://stackoverflow.com/comment/42009027
has comment: http://stackoverflow.com/comment/42009083
has body: You haven't declared all of your variables, and your equals method is incomplete. add this: double slope; and this: // returns true if Line this is the same as Line L2, false otherwise public boolean equals(LineClass L2) { if (L2.slope == slope &amp;&amp; L2.yIntercept == yIntercept) return true; else return false; } This assumes that you are simply checking if the lines are mathematically equivalent.
has comment: http://stackoverflow.com/comment/42009020
score: 0

http://stackoverflow.com/comment/42030040
type: Comment
has text: It looks like considerably more effort to me, for the given task. (In other cases it's very appropriate of course - but compare the amount of code you've provided for an *incomplete* program with my shorter code which is a self-contained program with the same output.)
comment on: http://stackoverflow.com/a/26719883
type: AnswerComment
score: 0

http://stackoverflow.com/q/26765891
has answer: http://stackoverflow.com/a/26766845
accepted answer: http://stackoverflow.com/a/26766845
has title: two way SSL/TLS authentication in a Rest Web Service
type: AnsweredQuestion
downvote count: 0
type: Question
score: 1
tagged with: java
tagged with: ssl
tagged with: jersey
upvote count: 1
answer count: 1
tagged with: tomcat
has body: I am going to expose my situation. I have a REST application running on Apache Tomcat 7.0. The question is that I want to authenticate and create client roles on the rest API server in order to allow users make some actions or not. The authentication and roles of clients will be determined by the SSL/TLS client certificate that clients have to send to the server. Strategy is: a Rest Client application sends a request to the server. Client apart from sends actions on the post request, sends his own SSL/TLS certification (I don't know how). Rest Web Service receives this request from the client, process it and determines with SSL/TLS certificate the client role, in order to answer if the action request is allowed or not. Is this feasible? Can anybody help with some tutorials or other posts?
favorite count: 0
tagged with: rest

http://stackoverflow.com/q/26701358
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41996363
accepted answer: http://stackoverflow.com/a/26701401
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26701398
tagged with: java
has title: Java ArrayList - Not Setting Existing Element
possible better answer: http://stackoverflow.com/a/26701398
has answer: http://stackoverflow.com/a/26701401
has body: When I try: //Util.java public static ArrayList&lt;Sprite&gt; Load(String[] path, int numOfFiles){ ArrayList&lt;Sprite&gt; sprites = new ArrayList&lt;Sprite&gt;(numOfFiles); Texture texture; Sprite sprite; for(int i = 0; i &lt; numOfFiles; i++){ texture = new Texture(Gdx.files.internal(path[i])); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); sprite = new Sprite(texture); sprite.flip(false, true); sprites.set(i, sprite); } return sprites; } I get an error: Exception in thread "LWJGL Application" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 If I call: //TheGame.java ArrayList&lt;Sprite&gt; sprites; String[] filenames = {"a.png", "b.png", "c.png"}; sprites = new ArrayList&lt;Sprite&gt;(); sprites.addAll(Util.Load(filenames, 3)); It should work becausenumOfFilesis3. I would prefer to use it the way I want. Why is it doing this? I have changed it to this in the meantime, which works just fine. //Util.java public static ArrayList&lt;Sprite&gt; Load(String[] path, int numOfFiles){ ArrayList&lt;Sprite&gt; sprites = new ArrayList&lt;Sprite&gt;(); Texture texture; Sprite sprite; for(int i = 0; i &lt; numOfFiles; i++){ texture = new Texture(Gdx.files.internal(path[i])); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); sprite = new Sprite(texture); sprite.flip(false, true); sprites.add(sprite); } return sprites; }
has comment: http://stackoverflow.com/comment/41996555
type: Question
tagged with: libgdx
tagged with: arrays
has answer: http://stackoverflow.com/a/26701404
tagged with: arraylist

http://stackoverflow.com/q/26810008
possible better answer: http://stackoverflow.com/a/26813468
has body: I am trying to paint a rounded rectangle around a JScrollPane. For the life of me I can't figure out how to do this! No matter what I try, the border is not visible. I have figured out that it is drawing BEHIND the contents and not over them. The only thing inside the scroll pane is a JPanel with some graphics painted onto it. Does anyone know how to fix this? Here is the code I have tried to paint the border on the scroll pane: public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setColor(Color.black); g2.setStroke(new BasicStroke(1)); g2.draw(new RoundRectangle2D.Double(0, 0, getWidth() - 1, getHeight() - 1, 10, 10)); } I have also tried using paint instead of paintComponent but with no such luck!
has answer: http://stackoverflow.com/a/26813468
tagged with: border
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26810068
type: AnsweredQuestion
tagged with: swing
has title: Painting a rounded border onto a JScrollPane
type: Question
has answer: http://stackoverflow.com/a/26810068
tagged with: java

http://stackoverflow.com/comment/41951860
type: QuestionComment
comment on: http://stackoverflow.com/q/26676210
has text: @Manju I just updated your code,there might be few small syntax error since I did not test.
score: 0
type: Comment

http://stackoverflow.com/q/26831263
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has body: Eclipse crashed and now I can't access my workspace. I can't even edit the files in a notepad app. I tried deleting the .metadate the .lock file. Tried restarting even the computer. Nothing worked. Is my project lost now? Oh I just looked and my src folder has 0bytes. How is it possible? Should I take it as a sign that I should change to android studio or is that just as buggy?
tagged with: eclipse
has answer: http://stackoverflow.com/a/26831295
linked to: http://stackoverflow.com/q/18391415
score: 0
answer count: 1
has title: Eclipse crashed and now I can't access my workspace. Eclipse deleted my files after the crash. How is that a solution to anything?

http://stackoverflow.com/a/26710207
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26709964
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26709964
has body: The problem is that BufferedWriter.write() writes a char, not a byte. Whenever you're writing to the file, you're writing a variable-sized unicode character, not a single byte, so you're ending up with much more stored in your file than you were expecting. You want to use new BufferedOutputStream(new FileOutputStream("filename")) instead, and change the signature of your method to take an OutputStream. (You might notice that OutputStream.write() takes an int rather than a byte, but that is just there to confuse you... it actually writes only the low-order byte, rather than the whole int, so it does what you want.)
type: AcceptedAnswer

http://stackoverflow.com/q/26727736
has comment: http://stackoverflow.com/comment/42043975
has comment: http://stackoverflow.com/comment/42043959
tagged with: random
answer count: 1
has title: How to get all colors in the pallet
favorite count: 0
tagged with: colors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26727849
tagged with: paint
tagged with: java
has body: In java can you get all colors possible? I know that it comes from R B G which is red blue and green. And there is like 256 different variations of each? So how can I get all of these without having to write the code for every single one. Will random let you choose a color?
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42043910
type: Question
score: -2

gmail
type: Tag
tags question: http://stackoverflow.com/q/26804983
tag name: gmail
tags question: http://stackoverflow.com/q/26728132
tags question: http://stackoverflow.com/q/26701420

http://stackoverflow.com/comment/42088059
comment on: http://stackoverflow.com/q/26752334
score: 0
has text: `try { image = ImageIO.read(new File("car.jpg")); } catch (IOException ex) { }` When (not if) that fails, the person debugging it will benefit from an `ex.printStackTrace();` in that catch block (or better still, logging)..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41948008
type: Comment
comment on: http://stackoverflow.com/q/26674079
type: QuestionComment
has text: I know, that's why I'm trying to figure out how to fix it.
score: 0

http://stackoverflow.com/comment/42036020
comment on: http://stackoverflow.com/a/26723186
type: AnswerComment
has text: I don't think that this is his problem, but it's hard to tell given that it's a very poorly written and incomplete question. Note that I'm not your down-voter.
type: Comment
score: 1

http://stackoverflow.com/comment/41992892
score: 0
type: Comment
type: QuestionComment
has text: Well that is logical. If you register servlet in web.xml it must actually be a servlet. Could you share the code of your ServerSide class?
comment on: http://stackoverflow.com/q/26694109

http://stackoverflow.com/comment/42201181
has text: Which 'context menu' are you asking about?
score: 0
comment on: http://stackoverflow.com/q/26813745
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26824130
has body: To do a map-reduce based matrix transposal, which is basically what is being asked, you would proceed by: Transform your lines into indexed tuples: (hint: use zipWithIndex and map) [(1,1,one), (1,2,two), (1,3,three)] [(2,1,four), (2,2,five), (2,3,six)] [(3,1,seven), (3,2,eigth), (3,3,nine)] Add the column as key to each tuple: (hint: use map) [(1,(1,1,one)), (2,(1,2,two)), (3,(1,3,three))] [(1,(2,1,four)), (2,(2,2,five)),(3,(2,3,six))] [(1,(3,1,seven)), (2,(3,2,eigth)), (3,(3,3,nine))] Group by key [(1,[(3,1,seven), (1,1,one), (2,1,four)])] [(2,[(1,2,two), (3,2,eigth), (2,2,five)])] [(3,[,(2,3,six),(1,3,three), (3,3,nine))])] Sort values back in order and remove the indexing artifacts (hint: map) [ one, four, seven ] [ two, five, eigth ] [ three, six, nine ]
has comment: http://stackoverflow.com/comment/42225247
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42221340
has comment: http://stackoverflow.com/comment/42226269
downvote count: 0
answers question: http://stackoverflow.com/q/26821707
has comment: http://stackoverflow.com/comment/42217773
has comment: http://stackoverflow.com/comment/42224724

http://stackoverflow.com/comment/41968649
type: QuestionComment
comment on: http://stackoverflow.com/q/26685303
score: 0
has text: What value did you expect and why?
type: Comment

http://stackoverflow.com/a/26747226
accepted answer of: http://stackoverflow.com/q/26726720
type: AcceptedAnswer
type: Answer
has body: I sorted it out. To get the pojo for the button clicked, set a tag in the adapter with the objects position like so: pickUpButton.setTag(R.integer.LIST_ITEM_POSITION, position); Then when the button is clicked, I change the underlying pojo like this (my Model is ShoppingListItem): ImageButton buttonToChange = (ImageButton) view.findViewById(R.id.pick_up_button); if (buttonToChange.getTag(R.bool.PICKED_UP_TAG).toString() == "false") { buttonToChange.setImageResource(R.drawable.triangle_full); int myPosition = (Integer) buttonToChange.getTag(R.integer.LIST_ITEM_POSITION); ShoppingListItem itemToChange = shoppingListItems.get(myPosition); itemToChange.setPickedUp(true); } else if (buttonToChange.getTag(R.bool.PICKED_UP_TAG).toString() == "true") { buttonToChange.setImageResource(R.drawable.triangle_empty); int myPosition = (Integer) buttonToChange.getTag(R.integer.LIST_ITEM_POSITION); ShoppingListItem itemToChange = shoppingListItems.get(myPosition); itemToChange.setPickedUp(false); } listAdapter.notifyDataSetChanged(); This will stop the issue of non persisting data with recycling listviews. For me, there is no local storage of this data (all comes and goes via JSON api). Be sure to persist changes to the database if your app calls for it.
answers question: http://stackoverflow.com/q/26726720
score: 0

http://stackoverflow.com/q/26730663
has comment: http://stackoverflow.com/comment/42050535
downvote count: 1
has comment: http://stackoverflow.com/comment/42049117
has comment: http://stackoverflow.com/comment/42331482
tagged with: css
has answer: http://stackoverflow.com/a/27824841
has body: I am new to jsp. I am using Glassfish server from netbeans. Problem is that i could link my jsp file with css and javascripts. Here's the format of my file structure Web Pages --Web-Inf --assets --css --style.css --js --jquery.js --includes --header.jsp --footer.jsp --sidebar.jsp --pages --home.jsp --index.jsp Here's the code in my index.jsp &lt;%@include file="includes/header.jsp" %&gt; &lt;% if (request.getParameter("page") == null) { %&gt; &lt;%@include file="pages/home.jsp" %&gt; &lt;% } else { %&gt; &lt;% } %&gt; &lt;%@include file="includes/sidebar.jsp" %&gt; &lt;/div&gt; &lt;!--Latest end--&gt; &lt;%@include file="includes/footer.jsp" %&gt; And here's my code in header.jsp &lt;link href="${pageContext.request.contextPath}/assets/css/bootstrap.min.css" rel="stylesheet"&gt;
has comment: http://stackoverflow.com/comment/42049080
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42049327
has comment: http://stackoverflow.com/comment/42363299
has comment: http://stackoverflow.com/comment/42050641
score: 2
has comment: http://stackoverflow.com/comment/42049558
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42050202
answer count: 1
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/42050871
favorite count: 0
has comment: http://stackoverflow.com/comment/42049421
has title: JSP couldnt link css files and js files
has comment: http://stackoverflow.com/comment/42050434
upvote count: 3

http://stackoverflow.com/q/26737897
tagged with: client-server
has body: If I have class A and 2 threads from class B, and i want that thread to access to variable x in class A if one of the thread manipulate in that variable, how the second thread get the last value of x resultant form first thread? For example public class A { public static int x = 0; public static void manipulate{ x++; } } and class B for example: public class B implements Runnable{ public void run{ A.manipulate(); } } If I run 2 threads, the first will set x to 1, and the second set x to 2, is that true? if not true, how i do that?
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42061835
has comment: http://stackoverflow.com/comment/42062300
has title: Shared data between clients in socket
tagged with: java
type: Question

http://stackoverflow.com/q/26677310
has title: Spring Data JPA repositories: IN-clause in derived query not working
favorite count: 0
tagged with: spring-data-jpa
linked to: http://stackoverflow.com/q/4378824
possible better answer: http://stackoverflow.com/a/48129147
type: AnsweredQuestion
has body: I have a repository that looks like this: public interface UserRepository extends JpaRepository&lt;User, Long&gt; { User findByEmailIgnoreCase(String email); @Query("select u from User u where u.id in (:ids)") Set&lt;User&gt; getByIdInSet(@Param("ids") Set&lt;Long&gt; ids); } When I call getByIdInSet I get the following error: Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class org.eclipse.persistence.indirection.IndirectSet for parameter ids with expected type of class java.lang.Long from query string select u from User u where u.id in (:ids). at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:933) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) Apparently I don't know what means because I have tried changing all sorts of data types and still get the same error. The set of ids I am passing contains just one id. Please point me in the right direction.
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/26677411
tagged with: spring-data
accepted answer: http://stackoverflow.com/a/26677411
upvote count: 10
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
linked to: http://stackoverflow.com/q/2772305
has answer: http://stackoverflow.com/a/48129147

http://stackoverflow.com/comment/42051567
type: AnswerComment
comment on: http://stackoverflow.com/a/26721277
type: Comment
has text: I changed the hssf to xssf, but now i get another error and I'm stuck again :p so I posted the other error: http://stackoverflow.com/questions/26731531/resource-injection-error-on-managed-bean-when-reading-excel-in-java
score: 0

http://stackoverflow.com/a/26753708
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26752851
downvote count: 0
has body: This has absolutely nothing to do with using Cucumber with Java. The error message you are getting is from the Windows command line and telling you that it couldn't find cucumber anywhere. Either you didn't install it, or you didn't put it in your %PATH%, or its extension is not in %PATHEXT%. You would be getting the exact same error if you tried using it to test Ruby code. It isn't even found in the first place.

http://stackoverflow.com/comment/42139017
type: QuestionComment
has text: I get a NullPointer exception in the While Statement "while (rs1.next())" So I think I don't get any resultSet.
comment on: http://stackoverflow.com/q/26775990
score: 0
type: Comment

http://stackoverflow.com/a/26674815
score: 1
upvote count: 1
downvote count: 0
has body: Hashcode values are used to reduce the search time of an object . The hashcode value does not necessarily be unique for distinct objects. The hashCode() method may in fact, be overridden in such a way that it returns a constant integer for all objects (this would however defeat the purpose of hashCode() method). However, the default implementation of class Object does return a unique integer for every object, as it maps the internal address of the object to an integer and returns the same. But this is not a requirement
type: Answer
answers question: http://stackoverflow.com/q/26674729

http://stackoverflow.com/q/26774012
type: Question
has answer: http://stackoverflow.com/a/26774541
has comment: http://stackoverflow.com/comment/42127797
has title: How refactor incrementing in scala?
has answer: http://stackoverflow.com/a/26774559
score: 0
answer count: 3
tagged with: increment
has answer: http://stackoverflow.com/a/26777093
type: UnansweredQuestion
tagged with: scala
has body: I have a code like that: var index = 0 var array: Array[String] = //initialized functionOne(array(index)) index = index + 1 functionTwo(array(index)) index = index + 1 The idea is clear - I need to increment index each time when I get element from array. With java can simply write index++ intead of duplicating index = index+ 1 everywhere. Is there a pattern/api to refactor code above with scala?
tagged with: java
linked to: http://stackoverflow.com/q/4520463

http://stackoverflow.com/comment/42003842
score: 0
type: Comment
type: QuestionComment
has text: The shorter, cleaner and better the code relevant to your problem the more probable it is for someone to answer your question. It didn't matter now, it might when you encounter harder problems
comment on: http://stackoverflow.com/q/26705103

http://stackoverflow.com/comment/42164621
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26779849
has text: And @override will not help If I have n no. of sub classes which is extending "Base" class will increase LOC as well as maintainability of code As I wanted "fillRandomData()" method's definition written at single place I has access to it's child classes's members.

http://stackoverflow.com/q/26752448
tagged with: audio
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: audio-streaming
has title: How can I print sound as byte array? or int array?
has body: I'm making anti-phase sound with java.(anti-phase is reflected wave. x-coordinate is not changed, but y-coordinate is upside down.) Before reflecting sound wave, I have to get byte array(or int array) from sound. I get sound from microphone of my laptop. Here is my CODE(I got original code, which record sound as file, in web. I modified it little) public class NoiseController extends Thread{ private TargetDataLine line; private AudioInputStream audioInputStream; public NoiseController(TargetDataLine line) { this.line = line; this.audioInputStream = new AudioInputStream(line); } public void start() { line.start(); super.start(); } public void stopRecording() { line.stop(); line.close(); } public void run() { try { int packet; while((packet = audioInputStream.read()) != -1) System.out.println(packet); } catch(IOException ioe) { ioe.getStackTrace(); } } public static void main(String[] args) { AudioFormat audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat); TargetDataLine targetDataLine = null; try { targetDataLine = (TargetDataLine)AudioSystem.getLine(info); targetDataLine.open(audioFormat); } catch(LineUnavailableException lue) { out("unable to get a recording line"); lue.printStackTrace(); System.exit(-1); } AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE; NoiseController recorder = new NoiseController(targetDataLine); System.out.println(targetDataLine); System.out.println(targetType); out("Press ENTER to start the recording."); try { System.in.read(); } catch(IOException ioe) { ioe.printStackTrace(); } recorder.start(); out("Recording..."); out("Press ENTER to stop the recording."); try { System.in.read(); System.in.read(); } catch(IOException ioe) { ioe.getStackTrace(); } recorder.stopRecording(); out("Recording stopped."); } private static void out(String msg) { System.out.println(msg); } } However, Console doesn't print anything …
has comment: http://stackoverflow.com/comment/42088719
has answer: http://stackoverflow.com/a/26766943
answer count: 1
downvote count: 0
favorite count: 0
tagged with: javasound
type: UnansweredQuestion
tagged with: audio-recording

http://stackoverflow.com/q/26818823
has comment: http://stackoverflow.com/comment/42207684
type: Question
tagged with: ubuntu
has answer: http://stackoverflow.com/a/26819812
tagged with: openssl
score: 0
has title: Does java handle packets differently on ubuntu vs windows
tagged with: packets
answer count: 1
has body: I have a vps and I wanted to install a java server programm on it. It contains ssl but I believe that is not used for java. At least it doesn't seem really encrypted. The weird thing is that sending from the ubuntu server 2 bytes get added that I didn't specify, and some bytes change. I know need to know why it doesn't do that on windows and does on my ubuntu vps... And if it is different how to solve it. I use printWriter and then flush to the client. and the "ISO8859-1" to encrypt the packets and those are not strings or numbers just plain bytes that I sended. protected Socket socket; protected BufferedReader socketIn; protected PrintWriter socketOut; protected LoginServer server; public static final byte[] LOGIN_SUCCESSBYTE = {(byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00}; this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1")); this.socketOut.flush(); this.socketOut.write(new String(LoginServer.LOGIN_SUCCESSBYTE,"ISO8859-1")); this.socketOut.flush(); the packet send by windows 00000000 EC 2C 4A 00 01 00 02 00 00 00 FF 00 00 00 00 00 .,J..... ........ 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ......…
tagged with: vps
has comment: http://stackoverflow.com/comment/42207545
accepted answer: http://stackoverflow.com/a/26819812
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26675368
favorite count: 0
has body: I'm running my project with jboss 7.1.1 and it's giving flowing exception. 09:21:52,354 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.module.service."deployment.PortalDeCompras-SrvEAR.ear.PortalDeCompras-Srv.jar".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.PortalDeCompras-SrvEAR.ear.PortalDeCompras-Srv.jar".main: JBAS018759: Failed to load module: deployment.PortalDeCompras-SrvEAR.ear.PortalDeCompras-Srv.jar:main at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67] Caused by: org.jboss.modules.ModuleNotFoundException: com.is2.log4j.portalCompras:main at org.jboss.modules.Module.addPaths(Module.java:1030) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.Module.link(Module.java:1386) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.Module.relinkIfNecessary(Module.java:1414) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:242) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] ... 5 more This is my application.xml <?xml version="1.0" encoding="UTF-8"?> xmlns="http://java.sun.com/xml/ns/javaee" xsi:sch…
has answer: http://stackoverflow.com/a/26692970
upvote count: 3
type: UnansweredQuestion
tagged with: maven
has title: ModuleNotFoundException error in JBoss
type: Question
score: 3
tagged with: java
tagged with: jboss
tagged with: eclipse
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/42056778
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26735179
score: 1
has text: What language are you using? If possible in your programming language you can try putting `null` as second parameter

http://stackoverflow.com/comment/42131293
type: QuestionComment
has text: @JCalbreath no, I added an answer. `line` needs to be a string.
comment on: http://stackoverflow.com/q/26767009
score: 0
type: Comment

http://stackoverflow.com/q/26822505
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26823057
tagged with: eclipse
has title: Starting Java Project in eclipse using Tomcat
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42214421
tagged with: tomcat
favorite count: 0
linked to: http://stackoverflow.com/q/998737
has comment: http://stackoverflow.com/comment/42214339
tagged with: eclipse-wtp
has comment: http://stackoverflow.com/comment/42214436
has body: I created a new Tomcat Apache Server v7.0 in Eclipse. I have a Java project which I need to run and host on this server in Eclipse. How do I run this project on the new server with the address stat.cmc.edu
has comment: http://stackoverflow.com/comment/42214321
has comment: http://stackoverflow.com/comment/42214375
has comment: http://stackoverflow.com/comment/42214386
upvote count: 3
tagged with: web-services
accepted answer: http://stackoverflow.com/a/26823057

http://stackoverflow.com/a/26720141
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26720071
answers question: http://stackoverflow.com/q/26720071
has body: what you want to do is something along the lines of int total = 0; ... //beginning of your for loop total = total + nu01; // alternatively you could do total += nu01;
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26822923
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26822900
answers question: http://stackoverflow.com/q/26822900
score: 1
upvote count: 1
has body: There are basically two ways: (assuming your keys are of type String and your values are of type Object) Instead of HashMap&lt;String, Object&gt; use HashMap&lt;String, Collection&lt;Object&gt;&gt; Use MultiMap&lt;String, Object&gt; from commons collections or guava. (Link: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multimap.html )

http://stackoverflow.com/comment/42038764
type: QuestionComment
has text: What exactly is the problem?
comment on: http://stackoverflow.com/q/26724663
score: 0
type: Comment

http://stackoverflow.com/a/26790652
has body: This sound like your transaction didn't get commit after update. When you call HibernateTemplate.update() it only update your persistent but doesn't actually to commit those changes. Remember to always conclude your transaction and save it before moving on. Here are some resources on hibernate sessions and transactions that might help you with your current problem 1 and 2
answers question: http://stackoverflow.com/q/26789798
score: 0
has comment: http://stackoverflow.com/comment/42236261
has comment: http://stackoverflow.com/comment/42165838
type: Answer

http://stackoverflow.com/comment/42192945
has text: Have you tried 4.3.6 version of Hibernate in POM ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26809308
type: Comment

http://stackoverflow.com/comment/42046889
type: Comment
has text: It seems to me that you know when you're doing a restore --- because something bad happened...and you're doing a restore. Likewise, you know if you're doing a fresh install. Because you, the "admin", have the context, simply do the right thing based on that context. No need to complicate your code, increasing probabilities for bugs, for something that seems well suited for fairly simple documentation.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26728993

http://stackoverflow.com/comment/42003928
type: AnswerComment
score: 0
has text: @Joiya550 yes! [please download the x64 SDK+ADT](https://developer.android.com/sdk/index.html#win-bundle)
type: Comment
comment on: http://stackoverflow.com/a/26704933

http://stackoverflow.com/q/26798868
tagged with: java
linked to: http://stackoverflow.com/q/4201984
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26801677
has comment: http://stackoverflow.com/comment/42175635
score: 0
has comment: http://stackoverflow.com/comment/42176027
tagged with: api
tagged with: google-plus
has comment: http://stackoverflow.com/comment/42176466
has comment: http://stackoverflow.com/comment/42175813
has answer: http://stackoverflow.com/a/26799153
has title: How to post with Google Plus API - Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42175984
has comment: http://stackoverflow.com/comment/42175609
has body: I'm trying to create a web service to use the Google Plus API. I'm writing it in java, however I can't figure out what files I need and how I would go about posting to Google plus groups using Java If you have any insite please could you post relavent links and helpful tips to help me out. EDIT 1: I have been playing around with the GooglePlus API provived by Google and have written a project based on the sample code given from this page: https://developers.google.com/+/domains/posts/creating The code runs fine until it gets to the GoogleTokenResponse tokenResponse = flow.newTokenRequest(code).setRedirectUri(REDIRECT_URI).execute(); line. Where it returns a null error. I am copying the link provided in the console and pasting in the code, however everytime it just returned a null error, is there a specific part of the returned code given that causes an issue?
has comment: http://stackoverflow.com/comment/42175841

http://stackoverflow.com/a/26786148
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26785352
has comment: http://stackoverflow.com/comment/42151527
type: Answer
answers question: http://stackoverflow.com/q/26785352
has body: Grid CSS is a new feature available since 5.0.5 / 5.1, so you won't be able to find what you are looking for in your 5.0 archive. See: https://code.google.com/p/primefaces/issues/detail?id=7215 The online showcase is actually running on PrimeFaces 5.1.2, but the latest showcase which is available to download is also running PrimeFaces 5.0 However, the CSS file your are looking for is available in the primefaces 5.1 download, located under /META-INF/resources/primefaces/primefaces.css
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42151181

http://stackoverflow.com/comment/41973970
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26688342
has text: I need sorting based on the value of the map.
score: 0

http://stackoverflow.com/a/26807561
answers question: http://stackoverflow.com/q/26800016
has body: A couple of things come to mind: Is your MyCrawler extending edu.uci.ics.crawler4j.crawler.WebCrawler? public class MyCrawler extends WebCrawler Are you passing in MyCrawler.class (i.e., as a class) into controller.start? controller.start(MyCrawler.class, numberOfCrawlers); Both of these need to be satisfied in order for the controller to compile and run. Also, Crawler4j has some great examples here: https://code.google.com/p/crawler4j/source/browse/src/test/java/edu/uci/ics/crawler4j/examples/basic/BasicCrawler.java https://code.google.com/p/crawler4j/source/browse/src/test/java/edu/uci/ics/crawler4j/examples/basic/BasicCrawlController.java These 2 classes will compile and run right away (i.e., BasicCrawlController), so it's a good starting place if you are running into any issues.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42164425
type: Comment
comment on: http://stackoverflow.com/q/26794964
score: 4
type: QuestionComment
has text: it was a method from [`Iterable`](http://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html) interface

http://stackoverflow.com/comment/42541354
score: 1
has text: I can reproduce the problem now, but I am a Gradle noob in combination with an Android noob. What I can say in accordance with Andy is that you compile your aspect with a plain Java compiler, i.e. it is not "finished" yet. Then somehow your build process gets the unfinished aspect from *annotation.jar* into the APK at the end. I recommend to just build your annotation subproject with *Ajc* as well, then you should be fine. The alternative is to make sure that the finished rather than the unfinished aspect class goes into the APK. For that, get *annotation.jar* on the *inpath*.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26802394

http://stackoverflow.com/comment/42177081
has text: How about adding a web.xml?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26801089

http://stackoverflow.com/a/26685843
type: AcceptedAnswer
downvote count: 0
has body: You must specify the type being compared when you implement comparable: class Car implements Comparable&lt;Car&gt;, Cloneable Raw types will use Object. You're using a raw type, so right now, compareTo must declare Object as the parameter, not Car. To fix this error, change implements Comparable to implements Comparable&lt;Car&gt;
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26685807
accepted answer of: http://stackoverflow.com/q/26685807

http://stackoverflow.com/comment/42007857
comment on: http://stackoverflow.com/q/26707639
type: Comment
type: QuestionComment
has text: It is hard to tell someone what is broke in code when one does not know what the code is supposed to do in the first place. You didn't really explain what is the purpose of the program. What problem is it trying to solve. What are the business rules? etc. Please clarify.
score: 0

http://stackoverflow.com/a/26812553
has body: Try doing a memory analysis. One way is to take a heap dump during a transaction and perform an analysis it. This is the best way to go about it, use a tool like JRockit mission control or Oracle VisualVM to perform analysis. This will let you see what happens in your JVM real time. You could take your application off the JVM, connect to it and load your application and see information like heap and gc. They have many more features and definitely something a developer must have. EDIT: I have updated the link for mission control. Thanks Klara!
answers question: http://stackoverflow.com/q/26809273
has comment: http://stackoverflow.com/comment/42332621
has comment: http://stackoverflow.com/comment/42247200
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42290329
has comment: http://stackoverflow.com/comment/42361888
has comment: http://stackoverflow.com/comment/42347264

http://stackoverflow.com/comment/42257602
has text: I've solved, I will post ;)
comment on: http://stackoverflow.com/a/26786490
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/42142493
has text: This is not a suitable question for Stackoverflow. Ask this kind of questions on [Programmers (Stackexchange)](http://programmers.stackexchange.com/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26782442
score: 0

http://stackoverflow.com/comment/42194249
type: Comment
comment on: http://stackoverflow.com/a/26809705
has text: Awsome explanation. Thanks. though I don't see the parallel with the runtime-type token. Here the use seems to be specifically for compile time and not runtime? It seems that EventType was made generic specifically so that in the method addEventHandler(EventType<T>,EventHandler<T>), the compiler could infer the type parameter if a lambda is used. If EventType were not generic, we would either have to use the old form: new EventHandler<type specified> or if we used a lambda it would default to Event as the type. Having this feature allows us to use a lambda with the specific type supplied ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26685319
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26685303
answers question: http://stackoverflow.com/q/26685303
has body: Step through the loop: i = 0. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 1. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 2. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 3. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 4. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 5. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 6. Is i &lt; 8? Yes. Is i != 6? No. Is either or both of these yes? Yes. i = 7. Is i &lt; 8? Yes. Is i != 6? Yes. Is either or both of these yes? Yes. i = 8. Is i &lt; 8? No. Is i != 6? No. Is either or both of these yes? No, end the loop So i ends up as 8 after the loop.
type: AcceptedAnswer

architecture
tags question: http://stackoverflow.com/q/26779966
tags question: http://stackoverflow.com/q/26830248
type: Tag
tag name: architecture
tags question: http://stackoverflow.com/q/26725693

http://stackoverflow.com/q/26745263
type: UnansweredQuestion
tagged with: java
tagged with: selenium
tagged with: web-crawler
has answer: http://stackoverflow.com/a/26763396
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26745521
has body: I have started using selenium to collect data from a website that uses Javascript. I have managed to get to a point where I am able to select the cells from the table but I would now like to be able to select the "Individual" strings from each cell, for example: This is a cell from the table: 2014-11-02 21:15:00 AMALT 60007 107115 1 576833 I would like to be able to select the 2014-11-02 21:15:00 rows in the cell individually, how is this possible? I want to be able to do something like this List<WebElement> allRows = table.findElements(By.tagName("idx=0")); but that doesn't work. I am collecting the table and cells as a whole like this: // Now get all the TR elements from the table List<WebElement> allRows = table.findElements(By.tagName("tr")); // And iterate over them, getting the cells for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.tagName("td")); // Print the contents of each cell for (WebElement cell : cells) { System.out.println(cell.getText()); }break; } Thank you. Update, the table layout has changed to: 2014-11-04 23:00:00 gasdjjhg 11344 14500 saddasd sdsed dsfdsf 1 The table Layout keeps changing?
tagged with: javascript
score: 0
has title: Selecting individual parts of cell using Selenium

http://stackoverflow.com/q/26760999
score: -2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42147311
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42103534
has answer: http://stackoverflow.com/a/26761169
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/42103550
favorite count: 0
has title: Parsing Json : When i put the URL in browser doesn't work but when i put the url in jsonViewer i can see the data
has body: Parsing Json : When i put the URL in browser doesn't work but when i put the url in jsonViewer i can see the data
downvote count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/26761169

http://stackoverflow.com/comment/42121485
comment on: http://stackoverflow.com/q/26770586
type: QuestionComment
type: Comment
has text: I believe you. I am interested in the declaration of `dDay`. Is it `int`? Or something different like `char`? The wrong declaration could give the behaviour you describe.
score: 0

http://stackoverflow.com/comment/42085651
type: Comment
comment on: http://stackoverflow.com/a/26750961
has text: I think you're answering a different question than he asked.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42060256
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26731275
has text: if it stays in its original Russian form, does Google not index them ? Why it has to be in english if I handle them in my side without any problem ?

http://stackoverflow.com/comment/42009473
comment on: http://stackoverflow.com/q/26708633
type: Comment
type: QuestionComment
has text: @TheLostMind I bet the op has its custom made linked list
score: 0

http://stackoverflow.com/q/26794181
type: Question
answer count: 2
downvote count: 0
tagged with: event-handling
has title: How do I register an object's event listener to an event handler outside its class?
has comment: http://stackoverflow.com/comment/42163178
tagged with: user-interface
has answer: http://stackoverflow.com/a/26794280
favorite count: 0
has comment: http://stackoverflow.com/comment/42163200
accepted answer: http://stackoverflow.com/a/26794280
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/26794281
has body: I have 2 classes, one JFrame class and one JButton class called LightsOutButton. The JFrame class has a collection of these LightsOutButton objects. I need to do actions when the individual buttons are pressed, but I can't access the JFrame class's methods from the event handler in my LightsOutButton class. It seems like the best way to work around this would be to register each button with the JFrame class's event handler. How would I do that? `// this is my button object. It has registered its action listener to itself(which I want to change) public class LightsOutButton extends JButton implements ActionListener { private boolean onOrOff; // true = on, false = off private int iCoord; private int jCoord; public LightsOutButton() { super.addActionListener(this); onOrOff = false; super.setContentAreaFilled(false); } } // this is my JFrame class. This is the class that I want to handle each button object's events public void actionPerformed(ActionEvent e) { // Get the button that was clicked JButton button = (JButton)e.getSource(); if(button == newGame) { reset(); } if(button == manual) { if (manualMode == false) { manualMode = true; } if (manualMode == true) { manualMode = false; } } // this is the implementation that I'm wishing for here: if(button = LightsOutButton){ // do something } }`
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26794281
has comment: http://stackoverflow.com/comment/42163392
score: 1
tagged with: java
tagged with: event-listener

http://stackoverflow.com/q/26708269
tagged with: spring-mvc
has title: SQL server connection with spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26712541
linked to: http://stackoverflow.com/q/18841744
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42009269
type: Question
has comment: http://stackoverflow.com/comment/42008895
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42009961
tagged with: sql-server
has answer: http://stackoverflow.com/a/26712541
favorite count: 0
has comment: http://stackoverflow.com/comment/42008988
has body: I created a spring mvc application to connect with sqlserver database. I used jtds driver for connection. &lt;beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;beans:property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" /&gt; &lt;beans:property name="url" value="jdbc:jtds:sqlserver://localhost:1433;databaseName=3PLTest;" /&gt; &lt;beans:property name="username" value="sa" /&gt; &lt;beans:property name="password" value="sa" /&gt; &lt;/beans:bean&gt; When i am trying to run the server it gives the error. ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect) Nov 03, 2014 10:33:46 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [appServlet] in context with path [/warehouse] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection] with root cause java.net.ConnectException: Connection refused: connect I am using SQLEXPRESS. How does this happen?
upvote count: 1
tagged with: spring

http://stackoverflow.com/comment/42084868
score: 1
comment on: http://stackoverflow.com/q/26750488
has text: is it valid netbeans project
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42162167
type: Comment
comment on: http://stackoverflow.com/q/26788263
has text: Sorry about that Andrew, as I've mentioned, it's goes on and on infinitely, dumping this stack trace over and over. I went over what Eclipse displays, trying to look for the root cause, but it's just this, I'm afraid. The application doesn't crash, but the JavaFX control becomes unresponsive.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26830506
upvote count: 1
score: 1
has body: Solution The solution to this problem is very simple. We need to add an OnItemClickListener to our ListView to listen for clicks and respond accordingly. So, in the onCreate() method, once you've made sure that you set of data isn't empty, you're going to want to Override the onItemClick() method to listen for the click and change the color. You're also going to want to keep track of which item you selected for the later steps, so add public int selectionId = -1; at the top of your class. Furthermore, you'll need to let the ListAdapter know that you changed something by calling ((SimpleAdapter) getListAdapter()).notifyDataSetChanged(). if(receiverList.size() != 0) { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int index, long id) { view.setBackgroundColor(Color.RED); TextView receiverIdTextView = (TextView) view.findViewById(R.id.receiverId); selectionId = Integer.valueOf(receiverIdTextView.getText().toString()); ((SimpleAdapter) getListAdapter()).notifyDataSetChanged(); } }); SimpleAdapter adapter = getNewAdapter(); setListAdapter(adapter); } Great! Now we have a working system that will change the color of the row that you tap. But we're not done yet. We need to make sure that the previous selection changes back to the normal color. For this, we are going to use override the SimpleAdapter's getView() method, which is called everytime the ListView goes to draw the items being displayed in it. It only actually displays the items it needs to - the ones that you can see. It does not render the ones above or below your screen. So if you have 200 items in a ListView, only 5 or 6, depending on the size of your screen and the size of the items, are being rendered at a time. To override the getView() method, go up to where you initialize the adapter and change the code to this: SimpleAdapter adapter = new SimpleAdapter(MainActivity.this,receiverList, R.layout.receiver_…
accepted answer of: http://stackoverflow.com/q/26830505
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26830505
type: Answer

http://stackoverflow.com/comment/42017260
comment on: http://stackoverflow.com/q/26712130
has text: @Chaitanya yes, as I said I get the error "Could not resolve property: X of: Visite", where X is the field I try to use, for example displayName
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26790324
type: AnsweredQuestion
has body: I am only in my 8th week of Java, so I am quite new. I have a class that has an ArrayList object, list. I have another class called TransactionCalc. I would like for TransactionCalc to have its own ArrayList object, called arr3. I need to have be exactly as large as list. I know how to declare an ArrayList that is a size other than 10, but how do you do this if you do not yet know the exact size? Is it possible? public class TransactionCalc extends CalculateAbstract{ private int count = 0; private ArrayList &lt;ItemAttribute&gt; arr3 = new ArrayList &lt;ItemAttribute&gt; (1); //the 1 needs to be list.size() ?? I am assuming that in the other class I will need to do public static final int = list.size(), but is it possible to get that constant over to the TransactionCalc class so that it can be in the declaration? I forgot to add this... since the functionality of arrayList is not really needed, I could also do list.toArray(arr3) but that still wouldn't allow for it to be an object of the TransactionCalc class. Is it possible to do that? I'd like to avoid sending the same arr3 over and over again to multiple methods in the same class. Also, how would I put this as a constructor? EDIT with help from amaleemur____________ I have updated my code to have: public class FindItemInfo implements InterfacePrint{ ArrayList &lt;ItemAttribute&gt; list = new ArrayList&lt;ItemAttribute&gt;(); //load arraylist and do something with it //sort arraylist public void printPriority(){ TransactionCalc finish = new TransactionCalc(); for (int i = 0; i &lt; list.size(); i++){ for (int x = 0; x &lt; list.size(); x++){ if(arr2.get(i) == list.get(x).getPriority()){ finish.cashOut(list.get(x), bankAccount, list.size()); } //send sorted arr2 to TransactionCalc class } } public static int getListSize(){ return list.size(); } } public class TransactionCalc {//extends CalculateAbstract{ private int count = 0; //private ArrayList &lt;ItemAttribute&gt; arr3 = new ArrayList &lt;ItemAttribute&gt; (Fin…
tagged with: java
accepted answer: http://stackoverflow.com/a/26790462
answer count: 2
possible better answer: http://stackoverflow.com/a/26790468
has answer: http://stackoverflow.com/a/26790468
has title: ArrayList Declaration - set unknown size
tagged with: arraylist
tagged with: size
has comment: http://stackoverflow.com/comment/42156972
has answer: http://stackoverflow.com/a/26790462
tagged with: declaration
tagged with: constructor
has comment: http://stackoverflow.com/comment/42160637
has comment: http://stackoverflow.com/comment/42156793
score: 0
has comment: http://stackoverflow.com/comment/42156851
type: Question

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/26830182
type: Tag
tags question: http://stackoverflow.com/q/26686084
tags question: http://stackoverflow.com/q/26759649
tags question: http://stackoverflow.com/q/26805912

http://stackoverflow.com/comment/42162347
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26793489
score: 1
has text: I'd be very keen to see a non-cut version of the method so we can actually work out whether it is the underlying problem or not. It'd also be interesting if he ends up with more than 25 people in the text file, but I suspect that is out of scope for the moment.

http://stackoverflow.com/a/27658772
type: Answer
has body: DynamoDBMapper constructor takes DynamdbMapperConfig which can have a "TableNameOverride" property. This can be configured to override the annotated table name. See this answer for an idea on how to do this - https://stackoverflow.com/a/25274713 DynamodbMapper APIs (query/scan etc) also take DynamodbMapperConfig objects. This can be used to override table name even in operation levels. So, coming to your problem- I think its better to have separate accounts for production and test. That's because if you manage to corrupt the data in production table due to bug in code, it will be hard to restore unless you have sound back up/restore mechanisms. If you want to still go in this route, you can configure table prefixes based on stage as per above example.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26761089

http://stackoverflow.com/q/26769428
has body: When Server and Client are communicating using Strings (using BufferedReader and PrintWriter classes), the BufferedReader class has a method called ready(), meaning that there is a string waiting for the client to grab and process. This method also makes the server to be made with 2 threads, which is what I want to achieve. When using ObjectInputStream and ObjectOutputStream classes, OIS class doesn't have a 'ready()' method, instead it has a method called 'available()' which returns the number of available bytes to be processed. The problem is that the available() method returns 0 every time and the lack of 'ready()' method in OIS makes the Server to be multi-threaded (1 thread for each connection plus main thread) and that's not what I want. So, is there a way to check whether a Server has "received" an Object from the ObjectInputStream over the Socket without creating and holding a Thread for every connection?
has comment: http://stackoverflow.com/comment/42119546
type: Question
tagged with: server
has title: Checking for an available Object from Socket using ObjectInputStream
score: 0
linked to: http://stackoverflow.com/q/24616774
answer count: 1
has comment: http://stackoverflow.com/comment/42119638
has answer: http://stackoverflow.com/a/26769769
tagged with: input
accepted answer: http://stackoverflow.com/a/26769769
type: AnsweredQuestion
tagged with: object
tagged with: java
tagged with: stream

http://stackoverflow.com/q/26680102
has title: how to make cursor black in android
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26680221
has body: I make a simple demo of auto complete .it is working fine I need some issue in UI . Please check image as autosuggest look.. here is my code .. &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:background="@drawable/bg1" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="28dp" android:layout_marginTop="42dp" android:text="@string/chooseStation" android:textColor="#000000" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;Button android:id="@+id/item_buttonId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/okButton" /&gt; &lt;AutoCompleteTextView android:id="@+id/item_autoComplete" android:layout_width="150dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1" android:layout_alignBottom="@+id/textView1" android:layout_alignParentRight="true" android:textColor="#000000" /&gt; &lt;/RelativeLayout&gt; Major concern is this code : &lt;AutoCompleteTextView android:id="@+id/item_autoComplete" android:layout_width="150dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1" android:layout_alignBottom="@+id/textView1" android:layout_alignParentRight="true" android:textColor="#000000" /&gt; Actually first problem is that my cursor become white it is not visible .secondly how to make rectangle in text field so that it look good.in my view it show only base line .Thirdly how to give padding so that it not touch end point of width ..
has comment: http://stackoverflow.com/comment/41959274
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7238450
tagged with: android

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/26831758

http://stackoverflow.com/a/26779504
score: 4
accepted answer of: http://stackoverflow.com/q/26779393
answers question: http://stackoverflow.com/q/26779393
type: Answer
upvote count: 4
has body: Use next API rather than nextLine as when you do nextInt you press enter and it generates number + \n and nextInt is only going to take an integer and won't take \n which in turn gets passed to next input i.e. try3 which is why it gets skipped. Scanner scan = new Scanner(System.in); System.out.println("1---"); int try1 = scan.nextInt(); System.out.println("2---"); int try2 = scan.nextInt(); System.out.println("3---"); String try3 = scan.next(); System.out.println("4---"); String try4 = scan.next();
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42190766
type: AnswerComment
type: Comment
has text: not, it should not be, please to read answer by Mahesh Acharya
score: 1
comment on: http://stackoverflow.com/a/26808979

http://stackoverflow.com/comment/42050535
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26730663
has text: @Naveen nope my index.jsp is not in the folder and i am not reffering to footer.jsp. Problem is i am not being able to link css files and javascript files.

http://stackoverflow.com/comment/42021426
score: 0
comment on: http://stackoverflow.com/q/26678346
type: QuestionComment
has text: Maven is designed to work with default file structure so it's generally harder to configure maven for a custom structure than changing the project structure. If you really don't want to change your project structure opt for Gradle which is way more flexible.
type: Comment

http://stackoverflow.com/comment/42056083
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26734740
has text: possible duplicate of [DOMDocument getNodeValue() returns null (contains an output escaped string)](http://stackoverflow.com/questions/12413450/domdocument-getnodevalue-returns-null-contains-an-output-escaped-string)
score: 0

http://stackoverflow.com/comment/42342603
comment on: http://stackoverflow.com/a/26818583
has text: Even if I agree, this is not the point. The point is trying to solve a problem when using those tools, which once available for using, it should work even if it's not the better approach.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26777025
downvote count: 0
has body: The OGNL even has a pseudo-property for collections. Suppose you have uid="row" on the table then &lt;display:column title="Anzahl der Mahnungen"&gt; &lt;s:property value="%{#attr.row.reminderSend.size}"/&gt; &lt;/display:column&gt;
accepted answer of: http://stackoverflow.com/q/26768035
answers question: http://stackoverflow.com/q/26768035
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42220787
score: 0
type: Comment
has text: @NadhiraRizky I'm not sure what "invoke the option" means. when you write `new Book(..)` you are creating a Book instance. You must have a Book constructor with parameters matching the parameters you pass in the `new Book(...)` call.
type: AnswerComment
comment on: http://stackoverflow.com/a/26826236

http://stackoverflow.com/comment/42162279
has text: Sort by what? It should already be sorted by ordinal value.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26793651

http://stackoverflow.com/comment/42057177
has text: Great advice but that didn't solve the problem. :) But Thanks for advice
type: Comment
comment on: http://stackoverflow.com/a/26724844
score: 0
type: AnswerComment

http://stackoverflow.com/a/26761794
has comment: http://stackoverflow.com/comment/42104952
upvote count: 1
answers question: http://stackoverflow.com/q/26761468
type: Answer
has body: You can use the MySQL Using the JDBC DriverManager Interface in Java. You need to import import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; try { conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/java?user=u5ser&amp;password=p4ssword"); } catch (SQLException ex) { // handle any errors System.out.println("SQLException Message: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); } As you said this is experimental :-) you can do that.
downvote count: 0
score: 1

http://stackoverflow.com/q/26694109
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41993164
has title: How compose web.xml to lauch server side with maven and jetty
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41991160
has comment: http://stackoverflow.com/comment/41993001
answer count: 1
has answer: http://stackoverflow.com/a/26717963
tagged with: web.xml
accepted answer: http://stackoverflow.com/a/26717963
tagged with: http://stackoverflow.com/tag/xml
has body: What should I put into web.xml to launch to start server side. I launch jetty but only ui works server side isn't not running I have next folder tree: src |-main |-java | |-com | |-example | |-test | |-ServerSide.java |-webapp |-index.html |-WEB-INF |-web.xml Server side class package com.example.test; import java.io.IOException; import java.util.Date; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; @ServerEndpoint("/testbattle") public class ServerSide { @OnOpen public void onOpen(Session session) throws IOException { System.out.println("Welcome" + new Date()); session.getBasicRemote().sendText("Hello websockets"); } }
has comment: http://stackoverflow.com/comment/41992842
has comment: http://stackoverflow.com/comment/41992892
tagged with: maven
linked to: http://stackoverflow.com/q/26690910
tagged with: jakarta-ee

tomcat7
tags question: http://stackoverflow.com/q/26811013
tags question: http://stackoverflow.com/q/26733474
tags question: http://stackoverflow.com/q/26830987
tags question: http://stackoverflow.com/q/26761980
tags question: http://stackoverflow.com/q/26755943
tags question: http://stackoverflow.com/q/26780747
type: Tag
tags question: http://stackoverflow.com/q/26790769
tags question: http://stackoverflow.com/q/26678346
tag name: tomcat7
tags question: http://stackoverflow.com/q/26765999
tags question: http://stackoverflow.com/q/26689901

http://stackoverflow.com/q/26757902
upvote count: 10
has body: Can the JVM perform runtime optimization in the following scenario? We've got the following situation, we have this interface: public interface ECSResource { default int getFor(final Entity entity) { return ResourceRetriever.forResource(this).getFor(entity); } } And a concrete implementation such as: private static enum TestResources implements ECSResource { TR1, TR2; } Would the JVM be able to figure out (at runtime) that an enum instance such as TestResources.TR1 belongs to a single ResourceRetriever like ResourceRetriever.forResource(TestResources.TR1)? In the naive implementation every call to TestResources.TR1.getFor(...) would create a new ResourceRetriever instance. In this case though, we know that (by code inspection) a call to ResourceRetriever.forResource(this) will call the following: public class ResourceRetriever { private final ECSResource resource; ResourceRetriever(ECSResource resource) { this.resource = resource; } public static ResourceRetriever forResource(ECSResource resource) { return new ResourceRetriever(resource); } //lots of methods } Hence there is nothing that can change at runtime due to random results, rounding errors, etc. Hence the question: Can the JVM map every enum ECSResource instance to its unique corresponding ResourceRetriever.forResource(this) instance? Note that it is possible to do such thing by your own, via the following: private static enum TestResources implements ECSResource { TR1, TR2; private static final Map&lt;TestResources, ResourceRetriever&gt; retrieverMapping; static { retrieverMapping = Arrays.stream(TestResources.values()) .collect(Collectors.toMap(res -&gt; res, ResourceRetriever::forResource)); } @Override public int getFor(final Entity entity) { return retrieverMapping.get(this).getFor(entity); } }
has answer: http://stackoverflow.com/a/26789035
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: enums
tagged with: runtime
score: 10
tagged with: optimization
answer count: 1
downvote count: 0
has title: Can a non-changing enum method be optimized by the JVM at runtime?
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/26783291
has comment: http://stackoverflow.com/comment/42143722
accepted answer: http://stackoverflow.com/a/26783402
answer count: 1
linked to: http://stackoverflow.com/q/286945
favorite count: 0
has title: Unexpected character (j) at position 67
has body: I have a json file which contains json array representing some shapes like that, [{"Cordinates": [272.0,81.0,200.0,100.0], "Type":"Ellipse2D", "Color":java.awt.Color[r=255,g=0,b=0]}, {"Cordinates":[227.0,272.0,200.0,100.0], "Type":"Rectangle2D", "Color":java.awt.Color[r=255,g=0,b=0]} ] the errors Unexpected character (j) at position 67. And here is my code to parse this public List&lt;ShapeItem&gt; read() { try { Object obj = parser.parse(new FileReader(filePath)); JSONArray ja = (JSONArray)obj; for (int j = 0; j &lt; ja.size(); j++){ JSONObject si = (JSONObject) ja.get(j); String type = (String) si.get("Type"); JSONArray cordinates = (JSONArray) si.get("Cordinates"); Float x, y, width, height; x = (Float) cordinates.get(0); y = (Float) cordinates.get(1); width = (Float) cordinates.get(2); height = (Float) cordinates.get(3); if (type.equals("Ellipse2D")){ s = new Ellipse2D.Float(x, y, width, height); } else if (type.equals("Rectangle2D")){ s = new Rectangle2D.Float(x, y, width, height); } c = (Color) si.get("Color"); shapeItem = new ShapeItem(s, c); shapes.add(shapeItem); } } return shapes; } I want to read this file and create those shapes and return array of shapes but i got errors any help?
has answer: http://stackoverflow.com/a/26783402
has comment: http://stackoverflow.com/comment/42143813
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42143694
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42143597
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/286945
has comment: http://stackoverflow.com/comment/42143742
has comment: http://stackoverflow.com/comment/42143729
score: -1

http://stackoverflow.com/a/26929175
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26724980
type: Answer
accepted answer of: http://stackoverflow.com/q/26724980
has body: You could try PowerMock which supports the removal of static initializers. See here for an example. In summary, you annotate your test class with @RunWith(PowerMockRunner.class) and @SuppressStaticInitializationFor("org.mycompany.ClassWithStaticInitializer").

http://stackoverflow.com/a/26789773
score: 0
type: Answer
has body: Change the way you print the time public void printTime() // print the time { String dt = ""; if(this.isAM) { dt = "AM"; } else { dt = "PM"; } System.out.println(String.format("%02d:%02d %s", this.hours, this.min, dt); }
answers question: http://stackoverflow.com/q/26789624

character
tags question: http://stackoverflow.com/q/26725314
tags question: http://stackoverflow.com/q/26755361
tags question: http://stackoverflow.com/q/26823076
tags question: http://stackoverflow.com/q/26789808
tags question: http://stackoverflow.com/q/26747281
tag name: character
tags question: http://stackoverflow.com/q/26724663
type: Tag
tags question: http://stackoverflow.com/q/26692513
tags question: http://stackoverflow.com/q/26705834

http://stackoverflow.com/q/26777286
answer count: 1
accepted answer: http://stackoverflow.com/a/26778359
tagged with: xtend
has body: Is it possible to control the indentation of recursive called methods in xtend? I have the following case: def generateField(Field field) ''' field «field.name» { description '«field.description»' label '«field.label»' «FOR alias : field.aliases BEFORE ' aliases {\n' SEPARATOR ',' AFTER '\n}'» «var f = alias.value as Field»«generateField(f)» «ENDFOR» } ''' The generated content looks like this: field name { description 'field Description' label 'fD' aliases { field nameA { description 'field Description' label 'fD' }, field nameB { description 'field Description' label 'Fd' }} The indentation of the brackets and the parameters is wrong generated. I expect auto indentation for recursively called methods. I'm using Xtend 2.8.0
has title: Recursive indentation in XTend
type: AnsweredQuestion
type: Question
tagged with: xtext
tagged with: generator
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26778359

http://stackoverflow.com/q/26798535
upvote count: 1
has answer: http://stackoverflow.com/a/26798729
tagged with: java
type: Question
has body: I'm attempting to read in a text file and output it, which is done, however each line is stored in a different part of the array, so the first line is [0] and so on, I'm trying to split the first line up so the first word in the first line is [0], the second is [1], etc. Here is the code I have so far, any help would be much appreciated. public class main { public static void main (String[] args) throws IOException { String matchResults = "P:/SD/Assignment1/results.txt"; try { readfile txtFile = new readfile(matchResults); String[] lineArray = txtFile.openMatchResults(); int i; for (i=0; i &lt; lineArray.length; i++) { System.out.println(lineArray[i]); } } catch (IOException e) { System.out.println(e.getMessage()); }
tagged with: arrays
answer count: 1
downvote count: 0
favorite count: 0
has title: Reading in a text file and splitting it's contents - can only post each line?
tagged with: readfile
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/42238738
type: Comment
comment on: http://stackoverflow.com/a/26827458
type: AnswerComment
has text: Thanks for the explanation. It's a big project. You know, it's not easy to change existing workflow...
score: 0

http://stackoverflow.com/q/26690757
tagged with: java
has title: What special characters need to be escaped when insert String literal to database
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41978984
score: -1
has comment: http://stackoverflow.com/comment/41978155
has comment: http://stackoverflow.com/comment/41978830
has comment: http://stackoverflow.com/comment/41978098
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41978127
has comment: http://stackoverflow.com/comment/41978375
favorite count: 0
has body: I'm using jdbc to insert data to database. For some reasons, I can't use PreparedStatement, I have to execute query directly. What special characters do I have to escape ?. I only know about the single quote(') and the backslash(). Edit: The reason I can't use PreparedStatement is, my app receive json data from server and its values are always represented as String. For example : { "tableName": "movies", "data": [ "The Big Lewbowski", "119", "1998-06-03" ] } It mean now I have to insert the data to the table movies. I can only deserialize the data to a List Now if I use PrepareStatement. String sql = "insert into movies values(?,?,?)"; PreparedStatement ps = con.prepareStatement(sql); System.out.println(ps.toString()); for (int i = 0; i &lt; newData.size(); i++) { ps.setObject(i + 1, newData.get(i)); } System.out.println(ps.toString()); com.mysql.jdbc.JDBC4PreparedStatement@6267c3bb: insert into movies values(** NOT SPECIFIED **,** NOT SPECIFIED **,** NOT SPECIFIED **) com.mysql.jdbc.JDBC4PreparedStatement@6267c3bb: insert into movies values('The Big Lewbowski','117','1998-06-03') As you can see , it doesn't work. my movies table have the different column types : movies(title varchar,runtime int,releaseDate Date); It can insert the data but there must been implicit conversion, right?
has answer: http://stackoverflow.com/a/26690950
has comment: http://stackoverflow.com/comment/41978129
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41978821
upvote count: 0

http://stackoverflow.com/comment/42095464
type: QuestionComment
type: Comment
has text: My bad, I should have been more specific, check out this answer in that post http://stackoverflow.com/a/5924132/1161998
comment on: http://stackoverflow.com/q/26756467
score: 0

http://stackoverflow.com/q/26762559
has title: Spring Data JPA + Hibernate on Websphere 8.5.5
type: AnsweredQuestion
score: 3
downvote count: 0
has body: While moving from Tomcat to WebSphere, I've encountered issues with my Spring 4 / Hibernate projects not loading correctly. I've already set the app to a PARENT_LAST classloader and reverted my Hibernate version back to 4.2.16 (due to WAS 8.5.5 only supporting JPA 2.0). I did have to now enclose the WAR inside an EAR to comply with IDE integrations as well. I am now getting the following error upon startup. Any assistance would be appreciated. If anyone has run Spring + Hibernate (and CXF) inside of a web app on WebSphere 8.5.5, I'd also like to hear if you've had other issues. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [datasource.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: org.hibernate.engine.spi.CascadeStyle at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750) at org.springframework…
tagged with: java
tagged with: hibernate
type: Question
tagged with: websphere
tagged with: jpa
upvote count: 3
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26768877
accepted answer: http://stackoverflow.com/a/26768877
tagged with: spring

http://stackoverflow.com/a/26800862
answers question: http://stackoverflow.com/q/26798670
score: 0
has body: This effect is called a "pursuit curve". I've modified your program to demonstrate the effect. import java.awt.Graphics; import java.awt.Color; import javax.swing.JPanel; import javax.swing.JFrame; public class Slugs extends JPanel { private static final long serialVersionUID = 1L; // Max length of line segment. final double range = 1; // Total number of iterations of the algorithm. final int num = 2000; // current iteration public int i = 0; // Declare arrays for points. final double[][][] points = new double[4][2][]; public Slugs (final int width, final int height) { // initialize arrays for points. for (int line = 0; line &lt; points.length; line++) { for (int axis = 0; axis &lt; points[line].length; axis++) { points[line][axis] = new double[num]; } } // First point placed in center of panel. points[0][0][0] = 100; points[0][1][0] = 100; points[1][0][0] = 100; points[1][1][0] = 700; points[2][0][0] = 700; points[2][1][0] = 700; points[3][0][0] = 700; points[3][1][0] = 100; // Generate a random point. for (int i = 1; i &lt; num; i++) { // for each line for (int line = 0; line &lt; points.length; line++) { // calculate vector from last point on this line to last point // on the line we're chasing final double vectX = points[(line + 1) % 4][0][i - 1] - points[line][0][i - 1]; final double vectY = points[(line + 1) % 4][1][i - 1] - points[line][1][i - 1]; // find length of the vector final double length = hypot(vectX, vectY); // adjust vector length to max allowable range final double deltaX = vectX / length * range; final double deltaY = vectY / length * range; // record current point points[line][0][i] = points[line][0][i - 1] + deltaX; points[line][1][i] = points[line][1][i - 1] + deltaY; } } } public void paintComponent(Graphics g) { if(i &lt; num - 1) { g.setColor(Color.blue); for (int line = 0; line &lt; points.length; line++) { g.drawLine( (int) points[line][0][i], (int) points[line][1][i], (int) points[line][0][i + 1], (int) points[line][1][i + 1]); } i++; de…
type: Answer

http://stackoverflow.com/comment/42188108
comment on: http://stackoverflow.com/a/26806813
score: 0
type: AnswerComment
type: Comment
has text: @user3780814 See my edit, I played with a formatter and definitely you can parse that date if you get rid of the timezone in the string.

http://stackoverflow.com/comment/42163339
type: QuestionComment
comment on: http://stackoverflow.com/q/26793671
has text: @starlord figured it out. I had the wrong driver setup for the application purpose. It was supposed to be "com.mysql.jdcbc.driver"
score: 0
type: Comment

http://stackoverflow.com/comment/41987372
comment on: http://stackoverflow.com/q/26695579
type: Comment
type: QuestionComment
score: 1
has text: **how** exactly did you *create the random percentages* and **how** *are you able to randomly assign values for different elements in the array*? Help us help you.

http://stackoverflow.com/q/26678482
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41956299
has body: I have a tile object which I named bt, as well as other tiles like a grass tile, gt, and a flower tile, ft. These are all objects. I then put the names of those objects in to an array to create a map that renders to the screen. like so: Tile[] map = new Map{bt, bt, bt, bt, gt, gt, gt, gt, bt, bt, ft, ft} Now my question is, am I referencing a name to the tile objects? meaning, is there actually only the three tiles, not the 12 as outlined? If so, how can I go around that? My goal is to make 1 of each different tile, and then have the array repeat them, basically instantiating a new tile each time.
has answer: http://stackoverflow.com/a/26679060
has answer: http://stackoverflow.com/a/26678693
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41956884
tagged with: tiles
upvote count: 1
has title: Array instantiating
possible better answer: http://stackoverflow.com/a/26678693
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/41956836
accepted answer: http://stackoverflow.com/a/26678592
has comment: http://stackoverflow.com/comment/41956116
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26678592
has answer: http://stackoverflow.com/a/26678754
has comment: http://stackoverflow.com/comment/41956332

http://stackoverflow.com/comment/41995702
comment on: http://stackoverflow.com/q/26701056
score: 2
type: Comment
type: QuestionComment
has text: Also here `if(poorSignal[i][j] = true)` you're **assigning** and not comparing. Use `==` or simply write `if(poorSignal[i][j])`

http://stackoverflow.com/comment/42321298
score: 1
comment on: http://stackoverflow.com/a/26881799
has text: A +1 from me, thanks for the info. I awarded the bounty to Justin as his answer may help avoid lower-level cunningness as displayed in your answer. But if I end up using this approach, I promise to return and throw a nice bounty in your direction ;-)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42008344
score: 0
has text: Debug the project by checking click event of button
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26707971

http://stackoverflow.com/comment/42087676
comment on: http://stackoverflow.com/a/26751971
type: AnswerComment
has text: Thanks Eliott. That worked out to be great!! And is pretty fast. WIll learn more about map and hash.
score: 0
type: Comment

http://stackoverflow.com/q/26702408
tagged with: java
score: 0
has title: Unbind service in android.app.Application
has body: In the application in onCreate() I bind to InAppBillingService. There is no onDestroy() method in the Application class. How to implement the call to unbindService() after the application is closed?
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/26702507
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26702591
has answer: http://stackoverflow.com/a/26702507
type: Question
has answer: http://stackoverflow.com/a/26702535
accepted answer: http://stackoverflow.com/a/26702535

http://stackoverflow.com/a/26817697
has body: So you would need counter variables for every metrics that you need.So before your while loop define them as: int totalAwayScore = 0, totalHomeScore = 0, invalidLines = 0, totalLines = 0; Within while loop, increment totalLines as totalLines++; which means you have next line to read. Your try catch is where you know how much is score so keep on adding to metrics that you defined above like: try { // "try" is a special statement which allows us to deal with "exceptions" int HomeScore = Integer.parseInt(elements[2]); // attempt to convert the String into an Integer type value int AwayScore = Integer.parseInt(elements[3]); totalAwayScore += AwayScore; totalHomeScore += HomeScore; System.out.println(HomeTeam + " ["+ HomeScore +"]" + " | " + AwayTeam + " ["+AwayScore+"]"); } catch (NumberFormatException e) { invalidLines++; } Here if you get number format exception, you get to know that it's invalid line and hence increment the value of variable that holds invalid lines in a file. At the end of the while loop you print the stats like: System.out.println("Total home score is " + totalHomeScore + " totalAway score is " + totalAwayScore + " invalid lines were " + invalidLines + " of total " + totalLines);
answers question: http://stackoverflow.com/q/26817588
score: 0
type: Answer

http://stackoverflow.com/q/26832267
upvote count: 26
tagged with: date
possible better answer: http://stackoverflow.com/a/26832369
answer count: 2
has answer: http://stackoverflow.com/a/26832373
has body: I'm trying to use Java 8's java.time.format.DateTimeFormatter to parse a formatted string into a java.time.LocalTime object. However, I'm running into some problems with parsing some input strings. When my input string has "AM" it parses correctly, but when my string has "PM" it throws an exception. Here's a simple example: import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class FormatterExample { private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm a"); public static void main(String[] args) { parseDateAndPrint("08:06 AM"); parseDateAndPrint("08:06 PM"); } public static void parseDateAndPrint(String time) { LocalTime localTime = LocalTime.parse((time), timeFormatter); System.out.println(localTime.format(timeFormatter)); } } Output: 08:06 AM Exception in thread "main" java.time.format.DateTimeParseException: Text '08:06 PM' could not be parsed: Conflict found: Field AmPmOfDay 0 differs from AmPmOfDay 1 derived from 08:06 at java.time.format.DateTimeFormatter.createError(DateTimeFormatter.java:1919) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1854) at java.time.LocalTime.parse(LocalTime.java:441) at FormatterExample.parseDateAndPrint(FormatterExample.java:11) at FormatterExample.main(FormatterExample.java:8) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.time.DateTimeException: Conflict found: Field AmPmOfDay 0 differs from AmPmOfDay 1 derived from 08:06 at java.time.format.Parsed.crossCheck(Parsed.java:582) at java.time.format.Parsed.crossCheck(Parsed.java:563) at java.time.format.Parsed.resolve(Parsed.java:247) at java.time.format.DateTimeFormatter.parseResol…
downvote count: 0
favorite count: 0
score: 26
tagged with: parsing
accepted answer: http://stackoverflow.com/a/26832373
tagged with: java-8
type: Question
type: AnsweredQuestion
has title: Java 8 DateTimeParseException when parsing AM/PM time with DateTimeFormatter
has answer: http://stackoverflow.com/a/26832369
tagged with: java

http://stackoverflow.com/q/26768760
upvote count: 2
accepted answer: http://stackoverflow.com/a/26774598
score: 2
type: AnsweredQuestion
has body: For reasons that I will not explain (because people will direct their responses at the other topic, instead of my problem at hand), I need to know how to determine whether or not my H2 database is locked. Using Java code, how do I determine whether or not the lock file exists on my database?
tagged with: java
tagged with: h2
tagged with: database
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26774598
favorite count: 0
tagged with: filelock
has title: How do I determine if an H2 database file lock exists?

http://stackoverflow.com/a/42479572
answers question: http://stackoverflow.com/q/26677322
has body: Try this: File file = new File(this.getClass().getResource("/com/fuentes/fuente.ttf").getFile());
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26724802
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42045404
has title: Spring 4.1.0 with Hibernate 4.3.5.Final compatibility issues
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has body: I try to use Spring 4.1.0 with Hibernate 4.3.5.Final, inside jboss but get compatibility issues as following: Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/classloading/spi/ClassLoaderService at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:64) [hibernate-envers-4.1.7.Final.jar:4.1.7.Final] at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:312) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:397) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) [spring-orm-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:341) [spring-orm-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) [spring-orm-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627) [spring-…
answer count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42086698
comment on: http://stackoverflow.com/a/26750812
type: AnswerComment
score: 0
type: Comment
has text: This is not working. i put the the Whole code. Please give me a solution

http://stackoverflow.com/a/26692757
answers question: http://stackoverflow.com/q/26692689
score: 0
type: Answer
has body: You will need to pass choice as an argument to calc if you wish to use its value in calc - something like this tweak to your code: import java.util.Scanner; public class Learn { public static void main(String args[]) { int firstnumber, secondnumber, choice; System.out.println("1- Add"); System.out.println("2- Sub"); System.out.println("3- Div"); System.out.println("4- Mul"); System.out.print("Enter your choice -"); Scanner var = new Scanner(System.in); choice = var.nextInt(); System.out.print("Enter first number -"); firstnumber = var.nextInt(); System.out.print("Enter second number -"); secondnumber = var.nextInt(); calc(choice, firstnumber, secondnumber); // 3rd arg added for choice } public static void calc(int choice, int x, int y) { // 3rd param added for choice int c; switch (choice) { case 1: c = x + y; System.out.print("Output-" + c); break; case 2: c = x - y; System.out.print("Output-" + c); break; case 3: c = x / y; System.out.print("Output-" + c); break; case 4: c = x * y; System.out.print("Output-" + c); break; } } }

svn
tags question: http://stackoverflow.com/q/26748653
tags question: http://stackoverflow.com/q/26782416
type: Tag
tags question: http://stackoverflow.com/q/26792824
tags question: http://stackoverflow.com/q/26713813
tags question: http://stackoverflow.com/q/26763208
tags question: http://stackoverflow.com/q/26677506
tag name: svn
tags question: http://stackoverflow.com/q/26828456

http://stackoverflow.com/q/26774131
tagged with: spring
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42127280
has body: There is a Spring MVC application, and it has a @Scheduled(initialDelay=2000, fixedRate=3000) private void test(){ System.out.println("foo"); } simple scheduling method. I deployed it into Tomcat and it works. But when I stop the deployed application via Tomcat manager, Tomcat ( catalina.out ) says, there is a memory leak. I use Spring 4.0.6. My question is: How do I stop a scheduled method or task ? For example, I want to stop scheduled methods when contextDestroyed method has been invoked. Here is the Tomcat log : Nov 05, 2014 11:19:35 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/dataservicemodul] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
type: Question
tagged with: scheduling
has comment: http://stackoverflow.com/comment/42127495
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42127390
answer count: 0
type: UnansweredQuestion
has title: How to stop scheduled method in Spring?
upvote count: 1

http://stackoverflow.com/comment/42084955
score: 0
type: Comment
has text: @Ninad, I said inserting these parts into that $group._id (you may insert into $group._id.day) which you've issued then it will work for each day of each month of each year. If you just replace the whole $group._id, then it will group for each day ignoring other options. I didn't repeat what you have done.
comment on: http://stackoverflow.com/a/26748424
type: AnswerComment

http://stackoverflow.com/q/26800080
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
has answer: http://stackoverflow.com/a/26801811
score: 1
tagged with: java
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/26800346
upvote count: 1
accepted answer: http://stackoverflow.com/a/26801915
favorite count: 0
possible better answer: http://stackoverflow.com/a/26800346
answer count: 3
has body: I have a JSF2 application that should show a page where a number os items must be added in a list. The user wants to add those items, set some properties of them and finally persist them all together, in a single save operation. The domain object that should be handled by this page looks like this: public class Item { private long id; private String name; private Item previous; public Item() { } public Item(Item previousItem) { this.previous = previousItem; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Item getPrevious() { return previous; } } The ItemBean class looks like this: @ManagedBean public class ItemBean implements Serializable { private static final long serialVersionUID = 1L; private List<Item> items = new ArrayList<Item>(); public List<Item> getItems() { if(items.size()==0) { items.add(new Item()); // adding the first item } return items; } public void setItems(List<Item> items) { this.items = items; } public void addItem(Item previousItem) { Item newItem = new Item(previousItem); items.add(newItem); } public void save() { ... } } The view is a xhtml file that looks like this: <?xml version='1.0' encoding='UTF-8' ?> <ui:composition template="/templates/layout.xhtml"> <ui:define name="content"> Items Items being added <ui:repeat value="#{itemBean.items}" var="item"> <h:outputLabel value="Item" for="name" /> <h:inputHidden value="#{item.id}" /> <h:inputText id="name" value="#{item.name}" /> <h:commandLink action="#{itemBean.addItem(item)}">Add</h:commandLink> </ui:repeat> <h:commandButton action="#{itemBean.save}" value="Save"/> </ui:define> </ui:composition> Notice that in order to add a new item, the current one must be sent to satisfy business rules. The problem is that I can add a second item with no problema, but when I click in the Add link next to the second item, the page is rerendered with one single item, just…
has answer: http://stackoverflow.com/a/26801915
has title: How to maintain a list of objects in Java Server Faces 2

http://stackoverflow.com/comment/42149187
score: 0
type: Comment
has text: It happens not only on Chrome, on IE too. Could be caused by some javasript code that manipulates DOM while loading the page, could be a bug in chrome/ie driver or in WebRdiver ? Who knows? It happens from time to time and we must live with it, in my tests there is some nasty link - I click it, and I am checking if it fired, if no then I click it again in a loop, sometimes even 3 times.
type: QuestionComment
comment on: http://stackoverflow.com/q/26748103

http://stackoverflow.com/a/26723354
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26723197
accepted answer of: http://stackoverflow.com/q/26723197
has body: Download the Glassfish4 and extract it. When adding glassfish server to the Eclipse locate the glassfish folder inside the Glassfish4 folder. And there you go. Eclipse EE doesn't come with any server, only with tools for EE development.
score: 5

http://stackoverflow.com/comment/42329477
type: Comment
type: QuestionComment
score: 0
has text: @phanisekhar Thank you! Looks like what I am also looking for. I'll check if it works also for log4cxx.
comment on: http://stackoverflow.com/q/26798290

http://stackoverflow.com/comment/42122041
score: 0
type: QuestionComment
has text: You cannot instantiate interface in Java.
type: Comment
comment on: http://stackoverflow.com/q/26770007

http://stackoverflow.com/comment/42190567
type: QuestionComment
comment on: http://stackoverflow.com/q/26796450
score: 0
type: Comment
has text: Flush doesn't print twice, but the "why" statement prints twice and an extra new line is printed, which is what I don't understand. My program is some user interface that just takes in some input and outputs something. Everything works fine until the end with the extra printed lines.

http://stackoverflow.com/q/26767420
has title: Do I have to close all resources every time I use them?
linked to: http://stackoverflow.com/q/24129088
has answer: http://stackoverflow.com/a/26767561
has comment: http://stackoverflow.com/comment/42116033
has comment: http://stackoverflow.com/comment/42115758
type: UnansweredQuestion
score: 2
tagged with: network-programming
tagged with: java
has comment: http://stackoverflow.com/comment/42115836
has body: I'm writing a chat application in Java for didactical purposes. Of course, I met a lot of problems as I'm not an experienced programmer. Basically my question is: Do I have to close EVERY resource (BufferedReader/Writer etc.) after the use? Even if I know I will probably reuse it? For example: the client that waits for the user to input text, can reuse the same BufferedWriter or has to create it every time the user inputs something and then close it again?
tagged with: resources
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42115715
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/18002896
favorite count: 0

http://stackoverflow.com/comment/42126263
has text: Add a property to the `application.properties` file. `spring.jpa.properties.javax.persistence.validation.mode=none` should do the trick.
comment on: http://stackoverflow.com/q/26764532
score: 18
type: Comment
type: QuestionComment

http://stackoverflow.com/a/60620715
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26710017
has body: In play 2.8 the Http.Context was deprecated. This means, among other things, that the method "session()" is no longer available in a controller. This is the updated way of doing it: public Result info(Http.Request request) { //This is the equivalent to the old session() request.session() ... } The Http.Request needs to be passed down through the route defined in routes. More information here.
downvote count: 0
type: Answer

http://stackoverflow.com/a/26753951
has body: Persistence means you have strong link between your classes and database tables, which are "hard, durable" things. In your queston you are fetching data from a query, not a table, so talking about persistence in this context is not correct. What you can do is to add in your Table a custom column where you make your custom things, or make a database view and create an Entity on it (could autogenerate with JPATools) if you want to have the full power of JPAContainer. Cheers.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26727478

http://stackoverflow.com/comment/42055761
has text: @AtthaponJunpun-eak - your question is unclear. I understand that you want to parse a style sheet and return all selectors that contain a specific color. However, you do not state whether you want this done serverside (with PHP, Java, .Net etc) or clientside (JavaScript). Nor do you tell us how you want to interact with this data. Please can you clarify your requirements?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26734266
score: 2

http://stackoverflow.com/q/26816710
has comment: http://stackoverflow.com/comment/42203971
answer count: 2
has title: Windows can't run python script from within eclipse
has body: I'm on a Windows machine and using Eclipse. My java code is invoking a python script by using : Process p = Runtime.getRuntime().exec("cmd /c e:\\dev\\CodeBase\\WebService\\src\\com\\rest\\service\\PythonScript.py"); On running the code it opens the prompt for choosing a program to run the script with. What can I do to make it run implicitly?
accepted answer: http://stackoverflow.com/a/26816752
tagged with: python
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/33701729
has answer: http://stackoverflow.com/a/26816752
tagged with: eclipse
has answer: http://stackoverflow.com/a/33701729
type: Question
score: 0

http://stackoverflow.com/q/26798131
has answer: http://stackoverflow.com/a/26798418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42203925
tagged with: classloader
tagged with: urlclassloader
has body: I'm trying to load a jar file inside a program to invoke different methods. I have a class that does the work, but the class loads the jar file using a URLClassLoader, which is dependent of the system class loader, so, for example, if the loaded jar performs a System.exit() it finishes the execution of the whole application, terminating the currently running Java Virtual Machine. My intention is that, if the loaded jar do this last, it only finishes the jar, not the entire application. Also, I want to be able to close the jar so I can restart it later, if needed. I'm using the following code to instantiate the required class from the jar and to invoke the methods from my application: // Load a class with classloader = new URLClassLoader(libs); if(loadclass == null) loadclass = Class.forName(classname, true, classloader); // Execute method if(met == null) { Constructor constructor; if(params != null &amp;&amp; params.length &gt; 0) { constructor = loadclass.getConstructor(new Class[]{Object[].class}); classinstance = constructor.newInstance(new Object[]{params}); } else { constructor = loadclass.getConstructor(null); classinstance = constructor.newInstance(null); } return (Object)Boolean.TRUE; } // Generic instance if(classinstance == null) classinstance = loadclass.newInstance(); // Method invocation Method method; if(params != null) { if(params.length &gt; 1) method = loadclass.getMethod(met, new Class[]{Object[].class}); else method = loadclass.getMethod(met, new Class[]{Object.class}); } else method = loadclass.getMethod(met); method.setAccessible(true); Object ret; if(params != null) { if(params.length &gt; 1) ret = (Object)method.invoke(classinstance, new Object[]{params}); else ret = (Object)method.invoke(classinstance, params[0]); } else ret = (Object)method.invoke(classinstance, null); return ret; I don't know how to decouple my URLClassLoader from the system class loader. Any help to this point is appreciated!
score: 1
has title: Java class loader independent from the system class loader for jar files
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26798344
has answer: http://stackoverflow.com/a/26816846
answer count: 3
has comment: http://stackoverflow.com/comment/42170189
tagged with: jar
downvote count: 0
tagged with: jvm
favorite count: 0
possible better answer: http://stackoverflow.com/a/26798418
accepted answer: http://stackoverflow.com/a/26798344

http://stackoverflow.com/q/26734216
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42055556
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26734897
tagged with: linked-list
score: 1
has title: Need help on a linked list contains method
tagged with: java
has body: I have a question on linked list. I have 2 classes. one called countryNode and 2nd called countryList. CountryNode takes 2 parameters, a variable object called country and a variable called next of type countryNode. CountryList takes 1 parameter called first of type countryNode that hold the link list of countryNode object. First i created A method “add()” that takes a Country object as parameter and adds that new object to the end of the list. which i did. Below is the code for countryList: public void add(Country country) { CountryNode a = new CountryNode(country); CountryNode current = null; if(isEmpty()) { a.set(first); first = a; } else{ current = first; while(current.getNext()!=null) { current = current.getNext(); } current.set(a); } } The question i have trouble understanding is this: A method "contains" that takes a Country object as parameter and checks if the name of the country can be found in the list. to check whether object foo of type Country equals objects bar of type Country, you must override the "equals method" in class Country. I have trouble understanding the question and implementing it. Below is code i wrote for country, countryNode. public class Country { private String countryNames; private SubscriptionYear[] subscriptions; private int size; private int location; public Country(String country, int arraylength) { this.countryNames = country; this.size = arraylength; subscriptions = new SubscriptionYear[size]; location = 0; } public void addSubscriptionYear(int year, double subscription) { subscriptions[location]= new SubscriptionYear(year, subscription); ++location; } public double getNumSubscriptionsForPeriod(int start, int end) { double sum = 0; int head = start-subscriptions[0].getYear(); int tail = head+(end-start); if(head&gt;=0&amp;&amp;tail&lt;subscriptions[subscriptions.length-1].getYear()) { for(int k=head;k&lt;=tail;k++) { sum += subscriptions[k].getSubscription(); } }else{ sum = -1;} return sum; } public String toString() { System.…

http://stackoverflow.com/q/26805966
possible better answer: http://stackoverflow.com/a/26806213
has answer: http://stackoverflow.com/a/26806213
tagged with: lambda
linked to: http://stackoverflow.com/q/21968918
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: javafx
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/26814087
type: Question
has comment: http://stackoverflow.com/comment/42185346
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/42186053
favorite count: 0
has body: For performance reason I would like to use a forEach loop of a parallel Lambda stream in order to process an instance of a Collection in Java. As this runs in a background Service I would like to use the updateProgress(double,double) method in order to inform the user about the current progress. In order to indicate the current progress I need a certain progress indicator in form of a Integer counter. However, this is not possible as I can only access final variables within the Lambda expression. Code example see below, Collection is only a place holder for any possible instance of a Collection: int progress = 0; Collection.parallelStream().forEach(signer -&gt; { progress++; updateProgress(progress, Collection.size()); }); I'm aware that I can solve this problem by using a simple for-loop. However, for performance reason it would nice to solve it in this way. Does anybody know a more or less neat solution to this?
has answer: http://stackoverflow.com/a/26814087
has title: Java 8 parallel forEach progress indication

http://stackoverflow.com/comment/42029544
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26719696
type: Comment
has text: So no way to tell jooq to ignore the converters when creating the routines?

http://stackoverflow.com/a/26707279
answers question: http://stackoverflow.com/q/26706792
type: Answer
has body: I think your overall approach makes sense. Deriving the questions from one superclass is useful, because then you can for example store them in a Questions[] Array and pick a random one. I don't know if you need two different answer types, because your answer basically consists of a String, whether it's one of {"A","B","C","D"} or a standard country code (which you could create a converter for to convert a country code in one of your Country Objects.) Methods for getting and setting correct answer etc. are good, but we can't tell you what methods you need since only you know what the game will be like. If you are unsure, use MVC pattern. Your questions classes should only represent the model.
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/26686052
tagged with: many-to-many
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26686868
accepted answer: http://stackoverflow.com/a/26686868
has body: This is the concerned Java code Role.Java @Entity @Table(name = "role") public class Role extends BasicModel { private static final long serialVersionUID = 1L; @Id @Column(name = "id") private int id; @Column(name = "role_name") private String roleName; @OneToMany(mappedBy = "pk.role", cascade=CascadeType.ALL) private Set&lt;UserRoles&gt; userRoles = new HashSet&lt;UserRoles&gt;(); //Getters and Setters } User.Java @Entity @Table(name = "user") public class User extends BasicModel{ @Id @Column(name = "id") private int id; @Column(name = "name") private String name; @Column(name = "email") private String email; @Column(name = "password") private String password; @OneToMany(mappedBy = "pk.user", cascade=CascadeType.ALL) private Set&lt;UserRoles&gt; userRoles = new HashSet&lt;UserRoles&gt;(); //getters and setters } UserRoles.Java @Entity @Table(name = "user_roles") @AssociationOverrides({ @AssociationOverride(name = "pk.user", joinColumns = @JoinColumn(name = "user_id")), @AssociationOverride(name = "pk.role", joinColumns = @JoinColumn(name = "role_id")) }) public class UserRoles extends BasicModel { private static final long serialVersionUID = 1L; @Id @Column(name = "id") private int id; @EmbeddedId private UserRoleId pk = new UserRoleId(); //Getters and Setters } **UserRoleId.java** public class UserRoleId { @ManyToOne private User user; @ManyToOne private Role role; //Getters and Setters } This is the code I am using to insert tx = session.beginTransaction(); User user = new User(); user.setName("admin"); user.setPassword("admin"); user.setEmail("admin@admin.com"); Role role = new Role(); role.setRoleName("admin"); session.save(role); UserRoles userRole = new UserRoles(); userRole.setUser(user); userRole.setRole(role); user.getUserRoles().add(userRole); session.save(user); tx.commit(); In Role and User class, if I set the cascadetype as ALL like @OneToMany(mappedBy = "pk.role", cascade=CascadeType.ALL) private Set&lt;UserRoles&gt; userRoles = new HashSet&lt;UserRol…
favorite count: 0
has title: Many-to-Many mapping Hibernate getting ConstraintViolationException
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/42135440
comment on: http://stackoverflow.com/q/26770789
score: 0
has text: No, just Eclipse running it's validator on Spring Bean XML configuration files. This project has 8 different Spring config files and this is the only one with a warning flagged for it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41994272
type: AnswerComment
has text: @user3371750 it's whatever, for the moment, it works and we can work with it. I'll have an answer up for you in a few minutes..
type: Comment
comment on: http://stackoverflow.com/a/26700183
score: 0

http://stackoverflow.com/comment/42161213
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26792582
has text: @SotiriosDelimanolis I know what causes the `NullPointerException` but I dont understand what caused it in my scenario. An answer would be helpful and could help someone else as well. At least answer my question and explain WHY I had an Exception before marking this a duplicate.
score: 0

http://stackoverflow.com/comment/42144274
has text: Why do I need a lastButtonIndex for?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26726650

wijmo
type: Tag
tag name: wijmo
tags question: http://stackoverflow.com/q/26739858

http://stackoverflow.com/comment/42275253
comment on: http://stackoverflow.com/a/26784574
type: AnswerComment
type: Comment
has text: Obviously you think it appropriate to downvote the answer, but you cannot articulate what is wrong with it. When you tried, you said that are just plain illogical. I guessed, correctly and without seeing his 'clarifying' comment, that he had not put together all the rules about static methods and main methods, and provided him "exactly what [he] needed". This 'clarifying' comment gave the error message, but that wasn't all he needed. So, would anyone care to tell me just what is wrong with the answer?
score: 1

http://stackoverflow.com/comment/42034129
has text: So i changed in ScanShop class: the private double cart to public double cart and i still get the same error. Are public getters and setters the same as private?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26704757
type: AnswerComment

http://stackoverflow.com/q/26748102
has title: Are ByteBuffers a good way to store > 1MB of data in Android?
has body: I have an application that needs to store 3 ~1MB byte arrays in a queue at any given moment. It seems what ends up happening is I get this message I/dalvikvm-heap﹕ Grow heap (frag case) to 4.827MB for 1058412-byte allocation And then my byte[] is allocated with a size of 0. I have tried setting android:LargeHeap="true" in the manifest but this still occurs. If I use ByteBuffers instead of byte[] is it possible to store these 3 byte[] objects without memory problems?
has comment: http://stackoverflow.com/comment/42150953
type: Question
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/42080853
answer count: 1
tagged with: bytebuffer
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/26748266
has comment: http://stackoverflow.com/comment/42081400
type: UnansweredQuestion

http://stackoverflow.com/q/26693470
has comment: http://stackoverflow.com/comment/41986365
answer count: 0
has comment: http://stackoverflow.com/comment/41982813
has title: Java server application to emulate Mysql
upvote count: 2
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/106551518
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/134693251
has comment: http://stackoverflow.com/comment/41982888
score: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41982591
tagged with: sockets
has body: I have a client Java application which connects over JDBC to MySql server. I would like to replace MySql with prototype Java server application. This application should receive and send bytes back to client over the socket, so that client „thinks“ that it communicates with Mysql. I have done the Wireshark capture and got hex values. Now I would like to emulate, send the same Server Greeting bytes from server to client so that client starts to send sql commands to server. This is the capture from Wireshark when Mysql responds to Java client. This is Mysql Greeting server response: 0000 00 19 99 5d 6f 53 00 12 00 85 4c ce 08 00 45 00 ...]oS....L...E. 0010 00 60 3e 49 40 00 3f 06 e8 84 8d 1d 7d 35 8d 1d .`&gt;I@.?.....}5.. 0020 7d 5a 0c ea ef dc 14 56 67 8e 17 b8 70 a8 50 18 }Z.....Vg...p.P. 0030 00 73 af 71 00 00 34 00 00 00 0a 35 2e 31 2e 36 .s.q..4....5.1.6 0040 31 00 74 00 00 00 4a 29 2e 4b 6d 66 38 22 00 ff 1.t...J).Kmf8".. 0050 f7 08 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0060 00 3f 56 72 5c 58 23 44 6d 76 2c 73 22 00 .?Vr\X#Dmv,s". and this is another Wireshark capture, when I have my Java server which is replacement for Mysql. My Java server application emulates Mysql Server Greeting message but it sends to much bytes for some reason: 0000 00 19 99 5d 6f 53 00 12 00 85 4c ce 08 00 45 00 ...]oS....L...E. 0010 00 96 8d 8d 40 00 3f 06 99 0a 8d 1d 7d 35 8d 1d ....@.?.....}5.. 0020 7d 5a 0c ea fd 4b a8 2d 3f 6d 96 b3 42 b3 50 18 }Z...K.-?m..B.P. 0030 00 73 85 d7 00 00 00 19 99 5d 6f 53 00 12 00 85 .s.......]oS.... 0040 4c ce 08 00 45 00 00 60 3e 49 40 00 3f 06 e8 84 L...E..`&gt;I@.?... 0050 8d 1d 7d 35 8d 1d 7d 5a 0c ea ef dc 14 56 67 8e ..}5..}Z.....Vg. 0060 17 b8 70 a8 50 18 00 73 af 71 00 00 34 00 00 00 ..p.P..s.q..4... 0070 0a 35 2e 31 2e 36 31 00 74 00 00 00 4a 29 2e 4b .5.1.61.t...J).K 0080 6d 66 38 22 00 ff f7 08 02 00 00 00 00 00 00 00 mf8"............ 0090 00 00 00 00 00 00 00 3f 56 72 5c 58 23 44 6d 76 .......?Vr\X#Dmv 00a0 2c 73 22 00 …
tagged with: jdbc
tagged with: wireshark

http://stackoverflow.com/comment/42069423
has text: @edhamed, thanks - you may be correct that each should be in it's own JVM. I've added more details to the question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26718522

http://stackoverflow.com/comment/42034430
comment on: http://stackoverflow.com/a/26722210
score: 0
type: AnswerComment
type: Comment
has text: You are right, it looks like i have two instances. I was wondering how would I be able to refer to the same save_button in both my activity and my adapter?

http://stackoverflow.com/comment/41996438
comment on: http://stackoverflow.com/q/26700800
type: Comment
type: QuestionComment
has text: Yes, it's from the official link, and there is no install.exe
score: 0

http://stackoverflow.com/a/68684213
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26788464
has body: private fun setToolbarNavigationIconColor(context: Context, toolbar: Toolbar?, color: Int) { val drawableBack = toolbar?.navigationIcon drawableBack?.let { val drawableWrap = DrawableCompat.wrap(drawableBack).mutate() DrawableCompat.setTint( drawableWrap, ContextCompat.getColor(context, white) ) toolbar.navigationIcon = drawableWrap } }

http://stackoverflow.com/a/26677079
accepted answer of: http://stackoverflow.com/q/26676507
has comment: http://stackoverflow.com/comment/41959957
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26676507
has body: Try to use timestamp &lt;property name="start_dt" type="timestamp"&gt; &lt;column name="Start_time"/&gt; &lt;/property&gt; ANSI SQL DATE doesn't contain time Mapping type: date Java type: java.util.Date or java.sql.Date ANSI SQL Type:DATE Mapping type: timestamp Java type: java.util.Date or java.sql.Timestamp ANSI SQL Type: TIMESTAMP
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41954347
type: Answer

http://stackoverflow.com/q/26810962
tagged with: spring
has answer: http://stackoverflow.com/a/26813529
tagged with: java
has comment: http://stackoverflow.com/comment/42195402
type: Question
has body: I have a simple spring app that I'm trying to run on Tomcat 7. My web.xml looks like: <?xml version="1.0" encoding="UTF-8"?> springapp org.springframework.web.servlet.DispatcherServlet 1 springapp *.htm index.jsp Then I have a springapp-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <bean name="/hello.htm" class="springapp.web.HelloController"/> My actual controller is: package springapp.web; import org.springframework.web.servlet.mvc.Controller; import org.springframework.web.servlet.ModelAndView; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class HelloController implements Controller { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ System.out.println("Returning hello view"); return new ModelAndView("hello.jsp"); } } I have two jsp's that I can browse straight to, index.jsp and hello.jsp, but when I try to browse to localhost:8080/springapp/hello.htm, I get an error that says that Servlet springapp is not available. I tried several things including different versions of Spring Framework, but nothing seems to work.
answer count: 2
has title: Servlet springapp is not available
score: 0
has answer: http://stackoverflow.com/a/26846827
type: UnansweredQuestion

http://stackoverflow.com/q/26695433
has title: Restaurant Menu: how to efficiently implement a nested loop to collect user input and conduct error checking
possible better answer: http://stackoverflow.com/a/26697476
has answer: http://stackoverflow.com/a/26697476
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26697817
tagged with: error-handling
type: AnsweredQuestion
score: 2
tagged with: algorithm
tagged with: nested-loops
tagged with: java
tagged with: loops
type: Question
has body: I have these two methods which I cant quite figure out the best way to go about their algorithm. I am writing a program that acts like a restaurant menu and collects user order. The implementation is, welcome user and present him with the menu while the user has not entered 'q', send the user input to a method called getGoodOrderLine(String str) this method will then check the input for the following, - First, it must check that a number is present before trying to read it; if there is no number, the entry is an error unless it starts with ‘q’ or ‘Q’, which tells the program to quit. - then, determine which item the user is asking for by looking at just the first letter. So an input “2 Hello” means 2 hamburgers. the assumption is that if there is a digit in the string, the digit appears before the word, for simplicity - finally, if the first letter is not (H,C,F or D), print an error message and ask that it be re-entered. My problem is that, I created a while loop that should loop until the user input is valid, but it doesn't seem to be working, here is my code: import java.util.*; public class MenuApp { //global variables public static double HAM = 3.75; public static double CHEESE = 4.10; public static double FRIES = 2.50; public static double DRINKS = 1.75; public static void main(String [] args) { //variables String order; double total = 0.0; boolean stopLoop; //print welcome message &amp;&amp; collect order welcomeCustomer(); order = collectItem(); order = getGoodOrderLine(order); stopLoop = order.equalsIgnoreCase("q"); while(!stopLoop)//while user hasnt typed q { if(order.equalsIgnoreCase("q")) { break; } order = getGoodOrderLine(order); //will add the value of user order to total here if order is valid //leave loop if useer inputs q } //ending program Date today = new Date(); System.out.println("Date: " + today); System.out.println("Please pay " + total + "\n"); System.out.println("End of processing"); } public static void welcomeCustomer() { System.out.print…
answer count: 2
accepted answer: http://stackoverflow.com/a/26697817
downvote count: 0
has comment: http://stackoverflow.com/comment/41986320

http://stackoverflow.com/comment/42029504
has text: ooook..then just one more question.. How can i still have the ripple effect onClick? Now disappears..
comment on: http://stackoverflow.com/a/26719469
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42143694
has text: It would also help if you could tell us which JSON parser do you use.
comment on: http://stackoverflow.com/q/26783291
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42166631
comment on: http://stackoverflow.com/q/26796066
type: Comment
type: QuestionComment
score: 0
has text: Then why has the '4' been removed, ASCII value 52?

http://stackoverflow.com/comment/42163488
type: QuestionComment
comment on: http://stackoverflow.com/q/26794356
type: Comment
has text: Please show what you have tried already.
score: 0

http://stackoverflow.com/q/26806160
has body: Here is another one of those 'how do I get a JTextArea to update in real time' questions. I've read every one of the existing posts, and I think that I am threading this correctly. However, I'm still having that same problem - my JTextArea doesn't update until the loop has finished and then it updats in one big blast. Can somebody see where I am doing this incorrectly? I can't see it. Thanks! EDIT: switch the text area updating the called method. But I still have the same result! private void saveImagesToDisk() { textArea.append("\nPreparing to save photos to photos directory\n\n"); for (MediaFeedData mfd : imagesMetaDataList) { try { String imageURL = mfd.getImages().getLowResolution().getImageUrl(); final String filename = mfd.getId(); // just name the file using the image id from instagram System.out.println(filename); SaveImageFromUrl.saveImage(imageURL, filename, textArea); } catch (IOException e) { e.printStackTrace(); } } } Then, on in the save method, I have this: public class SaveImageFromUrl { public static Boolean saveImage(final String imageUrl, String destinationFile, final JTextArea textArea) throws IOException { String directoryName = "photos"; if (!makePhotosDirectory(directoryName, textArea)) {return false;} File file = new File(directoryName, destinationFile); URL url = new URL(imageUrl); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(file); byte[] b = new byte[2048]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close(); new Thread() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { textArea.append(imageUrl + " written to photos directory\n"); } }); } }.start(); return true; }
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2064427
score: 1
tagged with: java
upvote count: 1
has title: JTextArea not updating in real time despite attempt at correct threading
type: Question
has comment: http://stackoverflow.com/comment/42186419
has answer: http://stackoverflow.com/a/26806472
has comment: http://stackoverflow.com/comment/42185467
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/42186977
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42185670
accepted answer: http://stackoverflow.com/a/26806472
favorite count: 0
tagged with: multithreading
tagged with: swing

http://stackoverflow.com/a/26722706
type: Answer
score: 2
has body: Put a continue; in your exception handling. It will break the loop an reenters it.
downvote count: 0
has comment: http://stackoverflow.com/comment/42035187
upvote count: 2
has comment: http://stackoverflow.com/comment/42035836
answers question: http://stackoverflow.com/q/26722639
has comment: http://stackoverflow.com/comment/42035617

http://stackoverflow.com/a/26687446
has comment: http://stackoverflow.com/comment/41972386
downvote count: 0
has comment: http://stackoverflow.com/comment/41972482
has body: if i run 10 threads, and one of these acquire lock inside foo1() other threads which want to execute foo1 will wait outside foo1() or they can loop and execute code inside foo2? Assuming they're being called on the same object, they'll all queue up when they need to execute foo1(). Any that have already finished foo1() for that iteration can execute foo2()... but then will queue up again on the next iteration when they need to execute foo1(). if i run 10 threads, and one of these acquire lock inside foo1() , in this case threads which want to execute foo1 are not blocked outside foo1? Well they're not blocked outside foo1(), but they'll be blocked inside foo1(). The only difference you might see between your examples is in terms of the stack trace. Fundamentally in both cases, executing the main chunk of foo1() requires the thread to own the lock. (Note that your unlock call should be in a finally block.)
accepted answer of: http://stackoverflow.com/q/26687421
answers question: http://stackoverflow.com/q/26687421
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/41972426
has comment: http://stackoverflow.com/comment/41972375
type: Answer
upvote count: 4

http://stackoverflow.com/q/26712275
linked to: http://stackoverflow.com/q/18300465
has title: Spring Data JPA QueryDslPredicateExecutor find distinct results
tagged with: spring
upvote count: 3
type: UnansweredQuestion
score: 3
has answer: http://stackoverflow.com/a/49282530
tagged with: java
tagged with: hibernate
has body: I have a Spring Data &amp; JPA QueryDSL based project in which I have many repository interfaces extending QueryDslPredicateExecutor like below: public interface ProductRepository extends JpaRepository&lt;Product, Long&gt;, QueryDslPredicateExecutor&lt;Product&gt; { } I am performing findAll() queries with BooleanExpressions all over my application to fetch data. However I now need to find the distinct results of a query based on a particular column. I am also using Projections &amp; Custom repositories in some cases to select particular columns based on this post. Is there a way to select distinct so that I only get the distinct values of a particular column for a query, based on any of the above approaches?
has answer: http://stackoverflow.com/a/27133896
type: Question
answer count: 2
downvote count: 0
favorite count: 0
tagged with: spring-data-jpa
tagged with: querydsl

http://stackoverflow.com/comment/42121793
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26770771
has text: How to I go about fixing this problem then? I need to be able to enter my names in without this problem. By making my array `String students = new String[students];` Will this always be a problem?
type: Comment

http://stackoverflow.com/comment/41961687
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26681427
has text: Well what results are you seeing, and what do you expect to see? (Your code would be a lot clearer if you used more line breaks, by the way... especially for multi-statement blocks.)

http://stackoverflow.com/a/48360730
upvote count: 0
has body: public class Main { public static void main(String[] args) { String [] names = {"Greg", "Aleksandra", "Martha", "Oliwka"}; String wynik = findLongestName(names); System.out.println( wynik); } public static String findLongestName(String [] names){ int size = names.length; String longestName = names[0]; for(int i = 0; i &lt;= 3; i++){ if(names[i].length() &gt; longestName.length()){ longestName = names[i]; }} return longestName; } }
has comment: http://stackoverflow.com/comment/83708296
downvote count: 3
answers question: http://stackoverflow.com/q/26725296
has comment: http://stackoverflow.com/comment/83708426
score: -3
type: Answer

http://stackoverflow.com/comment/42141788
has text: Ok. But please take the time to explain the whole scenario. Do I have to discover that from code?
comment on: http://stackoverflow.com/q/26778807
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26809273
downvote count: 2
has answer: http://stackoverflow.com/a/26812553
type: Question
tagged with: weblogic
score: -2
tagged with: java
has title: WebLogic 10.3.2 Performance issues
upvote count: 0
answer count: 1
favorite count: 0
tagged with: weblogic-10.x
has body: If I deploy to my local machine the application runs 4 times faster then when it is deployed to our Sun Application Server. Im not getting any memory errors and it does not mater how many sessions i have going. It just seems like every request waits before it runs. If I plug my machine into the same port as the server it still runs faster so im guessing its a Weblogic setting My start up specifics weblogic.Server Virtual Machine: Java HotSpot(TM) 64-Bit Server VM version 14.3-b01 Vendor: Sun Microsystems Inc. Name: Uptime: 15 days 21 hours 18 minutes Process CPU time: 16 days 16 hours 19 minutes JIT compiler: HotSpot 64-Bit Server Compiler Total compile time: 12 minutes Live threads: 69 Peak: 71 Daemon threads: 68 Total threads started: 51,573 Current classes loaded: 27,654 Total classes loaded: 33,709 Total classes unloaded: 6,055 Current heap size: 1,324,827 kbytes Maximum heap size: 1,867,776 kbytes Committed memory: 1,730,240 kbytes Pending finalization: 0 objects Garbage collector: Name = 'PS MarkSweep', Collections = 153, Total time spent = 37 minutes Garbage collector: Name = 'PS Scavenge', Collections = 21,402, Total time spent = 40 minutes Operating System: SunOS 5.10 Architecture: sparcv9 Number of processors: 48 Committed virtual memory: 3,013,032 kbytes Total physical memory: 66,879,488 kbytes Free physical memory: 21,949,936 kbytes Total swap space: 20,932,024 kbytes Free swap space: 20,932,024 kbytes VM arguments: -Dweblogic.nodemanager.ServiceEnabled=true -Dweblogic.security.SSL.ignoreHostnameVerification=false -Dweblogic.ReverseDNSAllowed=false -Xms1024m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m
type: UnansweredQuestion

http://stackoverflow.com/comment/42131943
score: 0
type: Comment
has text: Read about interning http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.5
type: QuestionComment
comment on: http://stackoverflow.com/q/26776753

http://stackoverflow.com/q/26690283
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/25649288
tagged with: thrift
upvote count: 2
possible better answer: http://stackoverflow.com/a/26696456
has answer: http://stackoverflow.com/a/26758745
accepted answer: http://stackoverflow.com/a/26758745
answer count: 2
has body: I have been looking on the net for an example of how to use thrift with facebook-swift in java but couldn't find anything. Hasn't anyone got an example to share?
favorite count: 0
has title: Example of java facebook-swift, thrift usage
tagged with: twitter-finagle
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26696456

http://stackoverflow.com/q/26702284
has comment: http://stackoverflow.com/comment/41998196
has answer: http://stackoverflow.com/a/26702402
has comment: http://stackoverflow.com/comment/41998157
has title: Spliting ArrayList into several ArrayLists based on variable
has comment: http://stackoverflow.com/comment/41998078
has comment: http://stackoverflow.com/comment/41998008
tagged with: arraylist
has body: I need to split an ArrayList containing primitive data types, String and ArrayLists to several ArrayLists based on a variable in this ArrayList. I have my ArrayList purchaseOrderList with "brand" of type String among many others. I want to split this ArrayList into as many new ArrayLists as I have different brands. I keep ending up in an infinite loop no matter how I do it. ArrayList&lt;Brand&gt; brandList = new ArrayList&lt;Brand&gt;(); brandList.add(new Brand(purchaseOrderList.get(0).getBrand())); for (int i = 0; i &lt; brandList.size(); i++) { for (Item item : purchaseOrderList) { if (brandList.get(i).getBrand().equals(item.getBrand())) { brandList.get(i).setItemList(item); //Add the items from the purchaseOrderList } else { brandList.add(new Brand(item.getBrand())); } } } Any advice?
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26702454
has answer: http://stackoverflow.com/a/26702454
possible better answer: http://stackoverflow.com/a/26702402
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41997985
type: Question

http://stackoverflow.com/a/26712929
answers question: http://stackoverflow.com/q/26709629
has comment: http://stackoverflow.com/comment/42044292
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26709629
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42049788
has body: Not exactly. There are no triggers or such. What you could do is a (very) poor man's solution of a message queue with MongoDB. Create a capped collection, which can be used as a FIFO buffer for messages. Connect it via a tailable cursor Skip all existing entries in the capped collection and wait for new ones.
upvote count: 2

http://stackoverflow.com/q/26709026
upvote count: 0
has answer: http://stackoverflow.com/a/26709102
has answer: http://stackoverflow.com/a/26709186
has comment: http://stackoverflow.com/comment/42032124
favorite count: 0
has title: Clarification on class initialization
has comment: http://stackoverflow.com/comment/42010185
answer count: 3
linked to: http://stackoverflow.com/q/16304733
has body: A class initialization rule states that: If Class initialization is triggered due to access of static field, only Class which has declared static field is initialized and it doesn't trigger initialization of super class or sub class even if static field is referenced by Type of Sub Class, Sub Interface or by implementation class of interface. Then in the following code, "Initializing Superclass" only should be printed. Superclass.java : public class Superclass { public static long INIT_TIME = System.currentTimeMillis(); static { System.out.println("Initializing Superclass"); } } Subclass.java: public class Subclass extends Superclass { static { System.out.println("Initializing Subclass"); } } public static void main(String[] args) { long time = Subclass.INIT_TIME; } } When I run this, output : Initializing Superclass Initializing Subclass
tagged with: classloader
has comment: http://stackoverflow.com/comment/42009981
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26709373
downvote count: 1
has comment: http://stackoverflow.com/comment/42009956
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42050155
has comment: http://stackoverflow.com/comment/42010108

http://stackoverflow.com/q/26690996
has comment: http://stackoverflow.com/comment/41978689
tagged with: java-8
has comment: http://stackoverflow.com/comment/41988015
type: AnsweredQuestion
tagged with: 32bit-64bit
has title: Differences in collections implementations between 32 bit and 64 bit, any pitfalls we need to worry about?
tagged with: java
type: Question
has body: We have a 32 bit client process that communicates via CORBA to a legacy server application running on a remote machine. This has run well and reliably for about 12 years. We needed to (temporarily) switch our client process to 64 bit to get more memory (pending an imminent rewrite) and almost immediately ran into some problems with the remote application. The process crashed repeatedly. Initially this made no sense, how can a remote application be sensitive to a client application VM if it uses a platform agnostic protocol such as CORBA? After a couple of days investigation we found that the remote process crashing has nothing to do with the client VM but does appear to be down to the ordering of parameters we send. We send an array of requested result types to the server, this is originally taken from config and put into a HashSet, converting to an array at the last minute. The server application appears to be sensitive to the order of the requested result types. E.g. If we send PV (0), DELTA (1), NPV (2), GAMMA (3) it's fine. If we send GAMMA (3), PV (0), DELTA (1), NPV(2) the remote application crashes. This just appears to be a weird bug in the remote application that has never been exposed before because the order has always been numeric (by chance). It's the switch to 64 bit that appeared to make the difference, the 64 bit version produces a different ordering of elements from the HashSet. This isn't something I expected but I suspect that HashCodes are only deterministic on a platform basis. Ensuring that the array is sorted before sending has fixed the issue. Switching to a TreeSet would help as well but thats deep in a library somewhere. Are there any other oddities between 32 bit and 64 bit we need to worry about? So far, I've been impressed as to how easy the conversion was, no other code changes at all. At the moment we are on Java 6 and the move to Java 8 is imminent. Can we expect similar issues when moving to Java 8?
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/26691146
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26691146
favorite count: 0
has comment: http://stackoverflow.com/comment/41978607
has comment: http://stackoverflow.com/comment/41978726

http://stackoverflow.com/a/26829970
has body: The throws clause is there to convey useful information to the calling method about what might go wrong during invocation of this method. That means that how specific you are will depend on how much information you want to convey; and that will be application-dependent. For instance, declaring throws Exception is almost always a bad idea: the information this conveys is just "something might go wrong", which is too vague to be useful. But whether calling classes are going to need perfectly fine-grained information in the throws clause is something you need to decide by looking at your program. There's no set answer.
answers question: http://stackoverflow.com/q/26829844
score: 0
type: Answer

http://stackoverflow.com/comment/42165446
type: QuestionComment
comment on: http://stackoverflow.com/q/26795483
has text: Possible duplicate [How should HTML for Java components reference resources?](http://stackoverflow.com/q/26795598/418556)
score: 0
type: Comment

http://stackoverflow.com/comment/42166112
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26781201
has text: That was it. With the latest version of EL it works like a charm.
score: 0

http://stackoverflow.com/q/26709538
tagged with: java
type: Question
has title: Running only one background thread in google appengine backend
has body: As mentioned in documentation I am running a background thread in a backend with 1 instance infinitely for some continuous background processing. import com.google.appengine.api.ThreadManager; import java.util.concurrent.AtomicLong; AtomicLong counter = new AtomicLong(); Thread thread = ThreadManager.createBackgroundThread(new Runnable() { public void run() { try { while (true) { counter.doStuff() Thread.sleep(10); } } catch (InterruptedException ex) { throw new RuntimeException("Interrupted in loop:", ex); } } }); thread.start(); I have tied this code to _ah/start endpoint so that it gets executed once the instance is started. However while running in local server I see _ah/start request is coming in multiple times during the runtime and it starts multiple such thread . I need only one thread to exist at a time to reduce contention in my background processing. Is there any way to catch hold of the existing bg thread and check if its running so that new thread creation can be avoided ? Update After uploading this code to cloud I also observed that every time _ah/start is invoked on the backend it spawns a new thread as part of _ah/background endpoint and keeps running . In this way there would be many threads running together if we fail to stop the earlier ones.
tagged with: singleton
has comment: http://stackoverflow.com/comment/42017767
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/26721143

http://stackoverflow.com/a/26784778
has body: Given : String[] aryLines = { "This is Line One.", "This is Line Two.", "This is Line three.", "End." }; To obtain the result you're seeking, you need to split the content of the array, not the array itself : ArrayList&lt;List&lt;String&gt;&gt; arrayList = new ArrayList&lt;List&lt;String&gt;&gt;(); for (String aString : aryLines) { arrayList.add(Arrays.asList(aString.split("\\s+"))); } If you print arrayList it you'll get : [[This, is, Line, One.], [This, is, Line, Two.], [This, is, Line, three.], [End.]]
answers question: http://stackoverflow.com/q/26784319
score: 0
type: Answer

http://stackoverflow.com/q/26735519
has body: I am writing a simple java program to perform Addition and Multiplication using Object Oriented technique. First it asks about the operation Addition, Multiplication or Exit. When Addition and Multiplication button is pressed it gets two numbers from user, performs the task and gives the result.But my problem is when Exit button is pressed it does not terminates instead it ask for numbers. And second thing which i want to ask is that am i following the Object Oriented approach. import javax.swing.JOptionPane; public class Calculator { private static int number1; private static int number2; public static void setNumber1(int n1) { number1 = n1; } public static void setNumber2(int n2) { number2 = n2; } public static int getNumber1() { return number1; } public static int getNumber2() { return number2; } public static void numbers(){ int n=Integer.parseInt(JOptionPane.showInputDialog("Enter first number:")); int nn=Integer.parseInt(JOptionPane.showInputDialog("Enter first number:")); setNumber1(n); setNumber2(nn); } public static void calculate(int o){ switch(o){ case 0: JOptionPane.showMessageDialog(null, "Addition is :"+(number1+number2)); break; case 1: JOptionPane.showMessageDialog(null, "Product is :"+(number1*number2)); break; case 2: System.exit(0); break; } } public static void main(String[] args) { // TODO Auto-generated method stub //Custom button text Object[] options = {"Addition","Product", "Exit!"}; int op = JOptionPane.showOptionDialog(null,"What operation Would you like to perform ?","Addition or Product Calculator", JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE, null,options,options[2]); Calculator c=new Calculator(); c.numbers(); c.calculate(op); } }
score: 0
has comment: http://stackoverflow.com/comment/42057421
possible better answer: http://stackoverflow.com/a/26735939
has comment: http://stackoverflow.com/comment/42058406
has comment: http://stackoverflow.com/comment/42058264
has comment: http://stackoverflow.com/comment/42057627
has title: System.exit(0) not working & Object Oriented Design.
has comment: http://stackoverflow.com/comment/42057573
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/42057802
has answer: http://stackoverflow.com/a/26735951
tagged with: java
accepted answer: http://stackoverflow.com/a/26735951
has comment: http://stackoverflow.com/comment/42057767
has answer: http://stackoverflow.com/a/26735939
has comment: http://stackoverflow.com/comment/42057483
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42057965
has comment: http://stackoverflow.com/comment/42058333
has comment: http://stackoverflow.com/comment/42057549
has comment: http://stackoverflow.com/comment/42058461

http://stackoverflow.com/a/26831022
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42229034
has body: your code is a bit strange and confusing but I have taken the time to go through it, any questions feel free to ask: import java.util.Scanner; import java.util.Random; public class HiLoGame { public static void main(String[] args) { Random generator = new Random(); Scanner input = new Scanner(System.in); String guess = null, result = null; Boolean won = false; int nextCard, card = 3, count = 0; System.out.println("Current card is: " + card); switch (card) { case 11: System.out.println("Which means it is card jack!"); break; case 12: System.out.print("which means it is card queen!"); break; case 13: System.out.print("which means it is card king!"); break: case 14: System.out.println("Which means it is card Ace!"); break; } System.out.println("WELCOME! to High-Low game.\nGuess four times in a row to win."); while (!won) { nextCard = generator.nextInt(14) + 1; System.out.println("You current card is: " + card + "\nWill the next card be high, low or equal?"); guess = input.next().toLowerCase(); System.out.println("The next card is:" + nextCard); if(card&lt;nextCard){ result = "high"; } else if(card&gt;nextCard){ result = "low"; } else if(card==nextCard){ result = "equal"; } if(guess.equals(result)){ System.out.println("NICE GUESS\nKEEP PLAYING"); card = nextCard; count++; } else { System.out.println("Sorry WRONG GUESS!\nBetter luck next time"); count=0; } if(count==4){ System.out.println("Congratulations, you have beaten the game!!!\nWould you like to play again? Yes/No"); guess = input.next().toLowerCase(); if(guess.equals("yes")) { count = 0; card = generator.nextInt(14) + 1; } else{ System.out.println("Thank you for playing, goodbye"); System.exit(0); } } } } } Good luck with your learning! A few of the things used in this code compared to the code in question are: I have used a switch block, this is used instead of multiple if statements, you can pass in the variable and then in the line: case you put in what you want to match it against, this looks a lot nicer and …
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26830377
has comment: http://stackoverflow.com/comment/42229231
answers question: http://stackoverflow.com/q/26830377

http://stackoverflow.com/comment/42230693
type: Comment
comment on: http://stackoverflow.com/q/26830490
has text: Sounds like a memory problem, the old boards semm not to be garbage-collected and sum up in Heap... if Java get near max heap, the garbage collector will use up all the CPU.... perhaps your old boards are still referenced somehow (timeline or listener registrations...)... is it possible to post the source?...
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42123533
comment on: http://stackoverflow.com/q/26771594
type: QuestionComment
has text: If this is shell script, you cannot have whitespace around the equals sign, and many of the standard regex tools (`grep` etc) don't support Perl extensions like `\d`.
type: Comment
score: 0

http://stackoverflow.com/comment/67972511
type: AnswerComment
comment on: http://stackoverflow.com/a/26768711
type: Comment
has text: After two years I stumbled upon the same problem and solved it because of your answer. Many thanks!
score: 0

http://stackoverflow.com/comment/42001271
comment on: http://stackoverflow.com/a/26703718
type: AnswerComment
score: 0
type: Comment
has text: You could either use Thread-safe lists (like CopyOnWriteArrayList) or synchronize those error-throwing blocks yourself. The second option is way more complicated, read about synchronizing and concurrency if you want to do it manually. Synchronization basically gives a ,,key'' to an object to some method as long as it works on it, and other methods cant access that object until this key is available again.

http://stackoverflow.com/a/26822451
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42214367
accepted answer of: http://stackoverflow.com/q/26822030
has comment: http://stackoverflow.com/comment/42214349
answers question: http://stackoverflow.com/q/26822030
type: Answer
upvote count: 2
has body: To implement getMin with generics you need to be able to compare them. You can, for instance, provide a custom Comparator to your method: public T getMin(Comparator&lt;? super T&gt; comparator) { Node&lt;T&gt; temp = head.getNext(); T min = head.getData(); while(temp != null) { T candidateValue = temp.getData(); if (comparator.compare(candidateValue, min) &lt; 0) { // equivalent to candidate &lt; min min = candidateValue; } temp = temp.getNext(); } return min; } Then, calling your method for Integer : getMin(new Comparator&lt;Integer&gt;() { @Override public int compare(Integer arg0, Integer arg1) { return arg0.compareTo(arg1); } }); Another approach is to make your list only keep Comparable items : public class DoublyLinkedList&lt;T extends Comparable&lt;? super T&gt;&gt; { and then have your getMin() method use compareTo method : public T getMin() { Node&lt;T&gt; temp = head.getNext(); T min = head.getData(); while(temp != null) { T candidateValue = temp.getData(); if (candidateValue.compareTo(min) &lt; 0) { // equivalent to candidate &lt; min min = candidateValue; } temp = temp.getNext(); } return min; } Second approach is less verbose, as Integer is Comparable (i.e. implements Comparable for you already), so you won't need to change any other code.
score: 2

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26743820
tag name: deserialization
tags question: http://stackoverflow.com/q/26761553

http://stackoverflow.com/a/26795540
downvote count: 0
has comment: http://stackoverflow.com/comment/42165736
answers question: http://stackoverflow.com/q/26795485
has comment: http://stackoverflow.com/comment/42165451
type: Answer
has body: use ArrayList.indexOf() to get get index of object. eg: int index=ARRAYLETTERS.indexOf("b");
has comment: http://stackoverflow.com/comment/42165348
has comment: http://stackoverflow.com/comment/42165414
score: 1
upvote count: 1

http://stackoverflow.com/q/26772080
has title: java.lang.IllegalArgumentException: WASX7122E: Expected "-" not found
has body: I can update the application manually by this command AdminApp.update('CUSWS', 'app', 'the options below') but when I update from the jython script appName = '\'' +appName+ '\'' updatetype = '\'app\'' appOptions = \'' +options+ '\'' AdminApp.update(appName, updatetype, appOptions ) I got an error below. java.lang.IllegalArgumentException: WASX7122E: Expected "-" not found. '[ -operation update -contents /data/CUSWS-uat-20141106.war -nopreCompileJSPs -installed.ear.destination $(APP_INSTALL_ROOT)/cusws1cell01 -distributeApp -nouseMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -contextroot /CUSWS -MapModulesToServers "Apache-Axis" CUSWS-uat-20141106.war,WEB-INF/web.xml WebSphere:cell=cusws1cell01,cluster=cuswsGWCluster+WebSphere:cell=cusws1cell01,node=cuswsIHSnode1,server=webserver1 -MapWebModToVH "Apache-Axis" CUSWS-uat-20141106.war,WEB-INF/web.xml default_host -CtxRootForWebMod "Apache-Axis" CUSWS-uat-20141106.war,WEB-INF/web.xml /CUSWS ]' I've tried to solve this problem for 2 days but can't find the mistake. What do I miss ? Please help, Thanks..
has answer: http://stackoverflow.com/a/26922408
tagged with: java
type: Question
answer count: 2
tagged with: websphere
tagged with: jython
score: 0
tagged with: deployment
tagged with: wsadmin
has answer: http://stackoverflow.com/a/26775653
type: UnansweredQuestion

http://stackoverflow.com/q/26751496
type: UnansweredQuestion
tagged with: android
upvote count: 1
answer count: 0
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/26502993
has body: Scenario: Activity starts a service to download n files(zip files)[n varies from 10 to 60, size of each file varies from 100 kb to 20 MB] sends List&lt;String&gt; urlsToBeDownloaded In Service start method, first one file is kept for download, once file is downloaded(Using Android's Download manager) there is a broadcast receiver which receives and process the file for unzipping. Once file is zipped, another file is kept for download. The code is like this: public class DownloadService extends Service { List&lt;String&gt; urlsToBeDownloaded; @Override public int onStartCommand(Intent intent, int flags, int startId) { // set urlsToBeDownloaded registerReceiver(onComplete, new IntentFilter( DownloadManager.ACTION_DOWNLOAD_COMPLETE)); Utility.downloadFromUrl(urlsToBeDownloaded.get(0),this); } BroadcastReceiver onComplete = new BroadcastReceiver() { public void onReceive(Context ctxt, Intent intent) { new ProcessNext().execute(intent); } }; ProcessNext extends AsyncTask&lt;Intent, Integer, Integer&gt; { @Override protected Integer doInBackground(Intent... params) { return processNext(params[0]); } } protected int processNext(Intent intent) { Query query = new Query(); ObjectOutputStream oos = null; Long dwnId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); query.setFilterById(dwnId); DownloadManager manager = (DownloadManager) (this) .getSystemService(Context.DOWNLOAD_SERVICE); Cursor cursor = manager.query(query); if (cursor.moveToFirst()) { int status = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_STATUS)); String title = cursor.getString(cursor .getColumnIndex(DownloadManager.COLUMN_TITLE)); File f1 = new File(Environment .getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath() + &quot;/&quot; + title); if (status == DownloadManager.STATUS_SUCCESSFUL) { Utility.extractFile(title); urlsToBeDownloaded.remove(0); if(urlsToBeDownloaded.size() != 0) Utility.downloadFromUrl(urlsToBeDownloaded.get(0)) else //show do…
has comment: http://stackoverflow.com/comment/42087289
has title: Download and unzip files sequencely one after the other
downvote count: 0
has comment: http://stackoverflow.com/comment/42089649
has comment: http://stackoverflow.com/comment/42086597
favorite count: 0
tagged with: android-download-manager

http://stackoverflow.com/q/26813935
has body: So I cannot figure this out for the life of me. I am trying to write a program that prompts the user to enter a phone number. This will be entered as a string and converted to an array of integers later on in the program. However, the situation I am running into now is validating that the string entered by the user ONLY!!! contains digits from 2-9. I have tried the .contains method as well as the .match method, however using these always provides me with false results. If anyone could please shed some light on how to solve this I would greatly appreciate it. Thanks in advanced. Here is what I have so far: Scanner user_input = new Scanner(System.in); String number = user_input.nextLine(); if(number.contains("[2-9]+")) { for(int count = 0; count &lt; number.length(); count++) { digits[count] = number.charAt(count)-'0'; } System.out.println(Arrays.toString(digits)); //printWord(digits, out, length, 0); } else { System.out.println("Invalid phone number!"); System.exit(0); }
answer count: 5
type: UnansweredQuestion
tagged with: input
has comment: http://stackoverflow.com/comment/42199530
has comment: http://stackoverflow.com/comment/42199579
has answer: http://stackoverflow.com/a/26813967
has comment: http://stackoverflow.com/comment/42199625
has comment: http://stackoverflow.com/comment/42199575
tagged with: java
has comment: http://stackoverflow.com/comment/42199549
type: Question
tagged with: digits
has comment: http://stackoverflow.com/comment/42199599
linked to: http://stackoverflow.com/q/10575624
has answer: http://stackoverflow.com/a/26813952
has title: Checking if string contains letters
has answer: http://stackoverflow.com/a/26814043
score: 0
has comment: http://stackoverflow.com/comment/42199648
tagged with: contains
has comment: http://stackoverflow.com/comment/42199622
has answer: http://stackoverflow.com/a/47440623
has answer: http://stackoverflow.com/a/26813984
tagged with: string

http://stackoverflow.com/a/26728235
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26728191
has comment: http://stackoverflow.com/comment/42045135
has comment: http://stackoverflow.com/comment/42044997
has body: One option would be to simply copy their contents into a new project, either with two different source directories (e.g. cp -R Project1/src Project/src1, cp -R Project2/src Project/src2) or even just merging the file contents into the same directory, if you literally want to combine them. Better, however, would be to have Project reference the existing two projects, you can keep developing Project1 and Project2 and Project will just reference the code in those projects.

http://stackoverflow.com/comment/42303280
type: Comment
comment on: http://stackoverflow.com/a/26770771
has text: Thanks a bunch for helping me with that code. I'm wondering how I should go about outputting the code then? I don't know how to average my grade using the array and my program still won't work because my method of outputting is incorrect.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26706220
type: Question
has title: What sdk versions do I need installed?
score: 0
has answer: http://stackoverflow.com/a/26706282
has body: OS: Ubuntu 14.04 -- IDE: Android Studio I am having trouble getting my app to run. Currently android 4.4.2(api 19) is my target sdk, and my minimum is 2.3.3(api 10). So my build.gradle looks like this(just the relevant bit): android { compileSdkVersion 19 buildToolsVersion '21.1.0' defaultConfig { applicationId "com.example.yerman.sunshine.app" minSdkVersion 10 targetSdkVersion 19 versionCode 1 versionName "1.0" } However, my app won't run. When I press the run button, android studio doesn't freeze completely, but says I am getting 101 errors, and won't let me look at the Gradle console or event log. I believe from seeing errors earlier though that they are like those listed at the end of this post. I asked a question on here earlier, when I was having a similar problem, and by uninstalling all but the Android 5.0(API 21) I got my app working. But I don't want to be restricted to that api. That previous question is here. What sdk versions or other downloads from the sdk manager should I have installed to make this work? It occurred to me I might need all versions between my minimum and my target SDKs... is this the case? Complete list of what I currently have installed: Tools: Android SDK Tools 23.0.5 Android SDK Platform-tools 21 Android SDK Build-tools 21.1 Android 5.0(API 21): sdk platform Intel x86 Atom system image Google APIs Google APIs Intel x86 Atom system image Android 4.4.2(API 19): sdk platform intel x86 atom system image Google APIs (x86 system image) Extras: Android support Repository 8 Android support Library 21.0.1 Errors from Gradle console(edited: full output was too long): /home/yerman/AndroidStudioProjects/Sunshine2/app/build/intermediates/res/debug/values-v21/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. /home/yerman/AndroidStudioProjects/Sunshine2/app/build/intermediates/res/debug/values-v21/values.xml:6: error: Error retrieving parent for item: No resourc…
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: android-studio
tagged with: java

http://stackoverflow.com/a/26793693
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26793280
has body: I think this is what you want, it supports the whole key and a only part of the activity to search, please check the output : public class ActivityManager { Map&lt;String, Set&lt;String&gt;&gt; map = new HashMap&lt;String, Set&lt;String&gt;&gt;(); public static void main(String[] args) { ActivityManager testMap = new ActivityManager(); testMap.addActivity("football game"); testMap.addActivity("basketball game"); Set&lt;String&gt; football=testMap.getActivities("football"); Set&lt;String&gt; basketball=testMap.getActivities("basketball"); Set&lt;String&gt; game=testMap.getActivities("game"); Set&lt;String&gt; footballGame=testMap.getActivities("football game"); System.out.println("-------football------"); printActivities(football); System.out.println("-------game------"); printActivities(game); System.out.println("-------basketball------"); printActivities(basketball); System.out.println("-------football game------"); printActivities(footballGame); } public void addActivity(String activity) { String[] keyWords = activity.split(" ");// split key words, change to what you want if needed Set&lt;String&gt; activities=null; for (String key : keyWords) { activities = map.get(key); if (activities == null) {// do not have any activities mapped to this key yet activities = new HashSet&lt;String&gt;(); map.put(key, activities); } activities.add(activity);// put new value into it. } if (keyWords.length&gt;1){ Set&lt;String&gt; activitiesUsingWholeKey =map.get(activity);//get the activities using the whole word if(activitiesUsingWholeKey==null){ activitiesUsingWholeKey=new HashSet&lt;String&gt;(); map.put(activity, activitiesUsingWholeKey); } activitiesUsingWholeKey.add(activity); } } public Set&lt;String&gt; getActivities(String key){ return this.map.get(key); } private static void printActivities(Set&lt;String&gt; activities){ for(String activity:activities) System.out.println(activity); } } Output : -------football------ football game -------game------ basketball game footbal…

http://stackoverflow.com/comment/42080115
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26747568
has text: actually i did everything you said i just didnt past it here . in the Light class. i cant use extends. and ineed to initialize the int red, gree and blue parameters to something. and i cant do this without creating private members for Light.
score: 0

http://stackoverflow.com/comment/42211968
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26821071
has text: Your link before your edit worked for me, i wonder why you changed it :3
type: AnswerComment

http://stackoverflow.com/comment/41984721
has text: @user3466314: see edit to answer. I can tell you that you will only achieve madness by trying to add an ActionListener repeatedly inside of the loop. Just don't do it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26694367
type: Comment
score: 0

http://stackoverflow.com/comment/42119215
has text: Your general approach is not quite right to begin with. WAV files store time-domain data; that is, signal vs. time (e.g. a 440 Hz tone may be, for example, sample values of a 440 Hz sine wave in the WAV file). Your concept of "tones" is frequency-domain; that is, signal strength vs. frequency. You would need to either perform some type of frequency analysis (look up discrete FFT) to extract "melody" information from the raw waveforms in a WAV file, or you would need to modify your hardware side and have the Arduino play raw digital audio instead of parameterizing the frequency.
score: 3
comment on: http://stackoverflow.com/q/26769345
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26678092
has body: We ran into this error accidentally. Here is how: We had a Lucene search code based on Lucene version 3.6.0 working perfectly fine. The compilation of the code used to be against version 3.6.0. The Lucene related jars which we use, are already there on server, so we do not bundle the Lucene jars with the deployment archive. The runtime refers the jars on the server. Inadvertently, one of the team members compiled the code against Lucene 4.8.1 WITHOUT any code change. When we deployed the code, we got ClassNotFoundError for org/apache/lucene/index/IndexableField. We are pretty sure that we DO NOT refer this class anywhere in our code, directly or indirectly. We searched and made sure of this using multiple tools. We recompiled the code using version 3.6.0 then everything worked fine. The code compiles with 3.6.0 version without any problem. The class IndexableField is only introduced in 4.8.1 version and its not here in any previous version. We are using JDK7 Now the question is: How does the compilation of same source using different library versions affect the generated bytecode ? In our code we never referred to IndexableField, but in the compile code, the reference to IndexableField creeps in when compiled against different version !
has title: Strange Lucene error for IndexableField
tagged with: lucene
score: 0
has comment: http://stackoverflow.com/comment/41961094
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41975868
has comment: http://stackoverflow.com/comment/41955405
answer count: 0
has comment: http://stackoverflow.com/comment/41976259
tagged with: java
type: Question

http://stackoverflow.com/q/26687775
has comment: http://stackoverflow.com/comment/41988584
linked to: http://stackoverflow.com/q/25317405
accepted answer: http://stackoverflow.com/a/26709748
tagged with: rest
linked to: http://stackoverflow.com/q/26437834
has comment: http://stackoverflow.com/comment/41977257
tagged with: authentication
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/41975516
has body: I have been struggling with this the last couple of days and haven't found a reliable, understandable solution on the web. I have a web app that is comprised of a rest api and a presentation layer consuming it. Presentation layer has a login form, the data introduced by the user is sent to the REST api which then uses a third party service to authenticate the user. This part I have already set up. What I want now is to inrtoduce a token-based authentication for every subsequent request so I don't have to send credentials on every request and then authenticate again against the third party service. So basically, using Spring Security (v. 3.1.3), I am lost as to how to create a reliable, secure token, return it to the requester, then authenticate request based on said token. Can you point me to the right direction? Or to some example online? How do you generate the token? How do you return the token to the client? How would you send the token in subsequent requests? How do you set the whole thing up so the first time you can somehow send the credentials (user/pass) then the subsequent requests send only the token? How do you authenticate against the token? I've seen implementations where token includes some expiryTime. So what happnes after expiryTime is exhausted? The user must login again, even if he's been making requests the whole time? Should I renew the token "behind the scenes"?
has title: Securing REST api with Token
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41997154
has answer: http://stackoverflow.com/a/26709748
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41989218
type: Question
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/a/26940481
type: Answer
answers question: http://stackoverflow.com/q/26745364
has body: In Ubuntu there is a command alternatives that i use it for this purpose. alternatives --install /usr/bin/java java /usr/java/jdk1.8*/jre/bin/java 200000 alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8*/jre/bin/javaws 200000 alternatives --install /usr/bin/javac javac /usr/java/jdk1.8*/bin/javac 200000 alternatives --install /usr/bin/jar jar /usr/java/jdk1.8*/bin/jar 200000 After alternatives install use the following command to change your version. alternatives --config java and then select your newer java. If this is not available you should first find out what where is your new java actually. locate *jdk1.8* Then find out which java you run as binary. which java this will returns the path of binary. this is the old java binary, So remove it and link new java binary in the same place. For example : ln -s /path/to/java1.8*/bin/java /usr/bin/java In addtion you need to update your CLASS_PATH environment variable that is necessary for the VM. for example: export CLASS_PATH=/usr/java/jdk1.8*/jre/lib and you can add this line in your bashrc file to register this configuration.
score: 0

http://stackoverflow.com/a/26797270
has comment: http://stackoverflow.com/comment/42169538
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26797211
has comment: http://stackoverflow.com/comment/42169639
has comment: http://stackoverflow.com/comment/42168911
has comment: http://stackoverflow.com/comment/42170596
has comment: http://stackoverflow.com/comment/42170899
answers question: http://stackoverflow.com/q/26797211
has comment: http://stackoverflow.com/comment/42169465
type: Answer
has comment: http://stackoverflow.com/comment/42168542
has body: You are assuming that this is a 32-bit in big endian, you could also assume that BitConverter has a default of little endian (or you could change it to big endian and not reverse it in the first place) BTW ByteBuffer supports little endian too. You could also send little endian os.write(ByteBuffer.allocate(4) .order(ByteOrder.LITTLE_ENDIAN) .putInt(data) .array()); What about the case the some unknown source sends me data and I don't know if he sent it big or small endian ? Then you don't know how to decode it, for sure. You can guess if you have enough data. He would have to send me a first byte to indicate right ? She could but you would have to know that the first byte tells you the order and how to interperate that first byte. Simpler to assume a given byte order. but the first byte is also subject to endianness So imagine a byte is written in little or big endian. How would it be any different? ;)
has comment: http://stackoverflow.com/comment/42171280
upvote count: 3
has comment: http://stackoverflow.com/comment/42168628
score: 3
has comment: http://stackoverflow.com/comment/42169594
has comment: http://stackoverflow.com/comment/42169275
has comment: http://stackoverflow.com/comment/42168799
has comment: http://stackoverflow.com/comment/42168513
has comment: http://stackoverflow.com/comment/42168642

http://stackoverflow.com/comment/42179359
comment on: http://stackoverflow.com/q/26803063
score: 7
has text: With the code given here, yes it is. The only thing that can result in a `SQLException` is the assignment. If the assignment fails `con` is always `null`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42211880
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26820922
has text: @Novice: Without your full stacktrace and an indication of where the exception is thrown, I have no idea just what your problem is at the moment, but it will help fix what appears to me to be a design flaw in your program.

http://stackoverflow.com/comment/42161728
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26793095
type: Comment
has text: Thanks this helped quite a bit, so I made a class and had long type variables for hour,minute,seconds and used eclipse's feature for getters and setters, would I then add the setTime method you mentioned below my getters and setters section that was created?

http://stackoverflow.com/comment/42053063
score: 0
type: Comment
type: QuestionComment
has text: Thank you for the highlited points, I understand now.
comment on: http://stackoverflow.com/q/26724919

http://stackoverflow.com/comment/42229231
score: 0
has text: zenon bruratta thank you for the time! however my code seems confusing because lack of actual question mentioned
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26831022

http://stackoverflow.com/q/26686095
tagged with: adjacency-matrix
has title: How to calculate minimum distance in arraylist
answer count: 0
has body: I have a matrix, the distance in matrix is calculated using euclidean distance. After that, i have to search the minimum distance between object. But i have to keep the destination vertex as source vertex. I give the example. P1 P2 P3 P4 0 3,0014 1,1245 1,1000 3,0014 0 3,0571 2,5374 1,1245 3,0571 0 1,0651 1,1000 2,5374 1,0651 0 The minimum distance based on object P1 is : (P1,P4: 1,1000), (P1,P3: 1,1245), (P1,P2: 3,0014) But i have to display the trail in object P1, the trail should be: (P1, P4), (P4,P3), (P3,P2) P1 is source vertex, and P4 is destination vertex, then P4 should be the source vertex and ect. I have to write in java code This is the method i try: public LinkedList&lt;EdgeTest&gt; getKruskalEdge(Double kDistance, int index) { PriorityQueue&lt;EdgeTest&gt; edge = new PriorityQueue&lt;EdgeTest&gt;(); if (index == -1) { System.out.println("Kosong"); } else { for (int i = 0; i &lt; vertexList.length; i++) { if (adjMat[index][i] != -1 &amp;&amp; adjMat[index][i] != 0) { if (adjMat[index][i] &lt;= kDistance) { edge.add(new EdgeTest(vertexList[index].toString(), vertexList[i].toString(), adjMat[index][i])); } } } System.out.println(""); while (!edge.isEmpty()) { insertEdge(edge.remove()); } } return kruskalEdge; }
tagged with: java
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/41970201
tagged with: arrays
has comment: http://stackoverflow.com/comment/41970811
score: 0
tagged with: multidimensional-array
type: UnansweredQuestion

http://stackoverflow.com/comment/42075065
type: Comment
type: QuestionComment
has text: Got that. Thanks:) But Is that the problem when I invoke Perl script from Java, report.txt file is not getting created?
comment on: http://stackoverflow.com/q/26744694
score: 0

http://stackoverflow.com/comment/42101719
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26760037
type: AnswerComment
has text: Please check how I'm asking to do ! .. http://stackoverflow.com/a/26760083/1085186

http://stackoverflow.com/a/26742941
has body: The current solution would be to update swagger-client.js - The part where the SwaggerClient is built, it is hard coded with application/json as the mime type. The current line of code is https://github.com/swagger-api/swagger-ui/blob/master/dist/lib/swagger-client.js#L335 though that may obviously change in different versions (so may not be relevant in the future when reading this answer). The swagger-client.js exists in two places - the /dist/lib dir for the pre-built application or directly under the /lib dir for the build process. You should change the value depending on what you're using.
has comment: http://stackoverflow.com/comment/55751931
has comment: http://stackoverflow.com/comment/55761867
type: Answer
has comment: http://stackoverflow.com/comment/42073232
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26741167
accepted answer of: http://stackoverflow.com/q/26741167
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26717621
tagged with: java
has comment: http://stackoverflow.com/comment/42026857
tagged with: openfire
type: Question
has comment: http://stackoverflow.com/comment/42132108
score: 0
has comment: http://stackoverflow.com/comment/42132523
tagged with: xmpp
has body: I am having a problem with the smack API. I have to create a chat and need to send files. There is a class for that (FileTransferManager) but when I try to initialize it I am getting an error. CF reports that it doesn't know the arg of the constructor. The arg constructor is a XMPPConnection type and when I supply it, this error occurs: Unable to find a constructor for class org.jivesoftware.smackx.filetransfer.FileTransferManager that accepts parameters of type ( org.jivesoftware.smack.XMPPConnection ). Here's the code XMPPConnection1 = createObject("java", "org.jivesoftware.smack.XMPPConnection").init("jabber.cz"); FileManager = createObject("java", "org.jivesoftware.smackx.filetransfer.FileTransferManager").init(XMPPConnection1); FileManager.createOutgoingFileTransfer("yoyonana@jabber.at"); Someone to help me please ? Thank you in advance
has title: no connection with smack api coldfusion
tagged with: smack
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42030352
tagged with: coldfusion

eclipselink
tags question: http://stackoverflow.com/q/26767180
type: Tag
tags question: http://stackoverflow.com/q/26781201
tags question: http://stackoverflow.com/q/26741762
tags question: http://stackoverflow.com/q/26758301
tags question: http://stackoverflow.com/q/26798182
tags question: http://stackoverflow.com/q/26743505
tags question: http://stackoverflow.com/q/26820539
tags question: http://stackoverflow.com/q/26748640
tags question: http://stackoverflow.com/q/26816650
tags question: http://stackoverflow.com/q/26711887
tags question: http://stackoverflow.com/q/26717257
tag name: eclipselink
tags question: http://stackoverflow.com/q/26774684

http://stackoverflow.com/a/26804528
type: AcceptedAnswer
score: 0
has body: "Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk." ArrayList Tutorial
type: Answer
accepted answer of: http://stackoverflow.com/q/26804489
answers question: http://stackoverflow.com/q/26804489

http://stackoverflow.com/q/26699317
tagged with: java
has comment: http://stackoverflow.com/comment/41994570
has comment: http://stackoverflow.com/comment/41993737
has comment: http://stackoverflow.com/comment/41994521
has comment: http://stackoverflow.com/comment/42005593
has comment: http://stackoverflow.com/comment/41992863
has comment: http://stackoverflow.com/comment/41992828
has body: I have a problem converting byte array to String using new String() method. Even with the encoding, the output is still output garbage. I am working on UDP socket programming and able to send encrypted and decrypted messages between host/ client. What I am trying to do is to convert the decrypted message in byte to String for hex function using SHA-1 which takes in String. //received encrypted data from client byte[] cipherKB = new byte[8]; cipherKB = receivePacket.getData(); System.out.println(Arrays.toString(cipherKB)); //this output correct data from byte array //contents of cipherKB [-36, 120, 90, 1, -51, 99, 27, 97] //decrypt the above message using "decrypt" method byte[] KB = new byte[8]; KB = r.decrypt(cipherKB); // r is an object System.out.println(Arrays.toString(KB)); //this output correct data from byte array //contents of KB [82, -127, 11, -40, -60, 81, 12, 65] String KBString = new String (KB,"UTF-8"); System.out.println(KBString); //this is giving me garbage message when I output in console System.out.println("KB.toString(): output " + KB.toString()); //KB.toString(): output [B@578088c0 ..... } //Decrypt function private final static byte[] S = new byte[256]; private final byte[] T = new byte[256]; private final int keylen; public static byte[] encrypt(final byte[] plaintext) { final byte[] ciphertext = new byte[plaintext.length]; int i = 0, j = 0, k, t; byte tmp; for (int counter = 0; counter &lt; plaintext.length; counter++) { i = (i + 1) &amp; 0xFF; j = (j + S[i]) &amp; 0xFF; tmp = S[j]; S[j] = S[i]; S[i] = tmp; t = (S[i] + S[j]) &amp; 0xFF; k = S[t]; ciphertext[counter] = (byte) (plaintext[counter] ^ k); } return ciphertext; } public static byte[] decrypt(final byte[] ciphertext) { return encrypt(ciphertext); } } Output data to show encryption is working: //HOST - Alice Alice Random KA:[45, 58, -4, 93, -1, -127, 127, 20] Alice Random KA in string:[B@6791d8c1 //output of String KAString = new String (KA); Alice encrypted KA sent to Client: [-63, 81…
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41992514
answer count: 2
has comment: http://stackoverflow.com/comment/41999993
tagged with: arrays
has title: Converting byte array to String shows garbage
accepted answer: http://stackoverflow.com/a/26714174
has answer: http://stackoverflow.com/a/31412987
tagged with: string
has comment: http://stackoverflow.com/comment/42005374
favorite count: 0
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/41992778
has comment: http://stackoverflow.com/comment/41992946
possible better answer: http://stackoverflow.com/a/31412987
has comment: http://stackoverflow.com/comment/41993497
has comment: http://stackoverflow.com/comment/41995968
upvote count: 2
has comment: http://stackoverflow.com/comment/41993396
downvote count: 2
has comment: http://stackoverflow.com/comment/42010387
has answer: http://stackoverflow.com/a/26714174
has comment: http://stackoverflow.com/comment/41994879
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42005657

http://stackoverflow.com/a/26728399
has comment: http://stackoverflow.com/comment/42046292
has comment: http://stackoverflow.com/comment/42046660
has body: ok i think already you understood the second part and your confusion in first part ++i will increment the value of i, and then return the incremented value. i = 1; j = ++i; here --&gt;i is 2, j is 2 i++ will increment the value of i, but return the original value that i held before being incremented. i = 1; j = i++; here --&gt;i is 2, j is 1) check the example above from that you can understand easly what happends here .... as per your code int i=1; i=i++; i=++i; i=i++; System.out.println(i); first i=i++; then the value of i will be 1 then next setp i=++i; then it will be incremented by 1 and now i will be 2 next step again i=i++; then also i value remain same that is 2 ! // if the last step is i=++i; then the result will be 3
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26728216

http://stackoverflow.com/q/26691945
score: 1
upvote count: 1
tagged with: libraries
type: Question
tagged with: java
has body: I have a program that requires many libraries. I was wondering how I would make a program to automatically download library updates. Would I have to navigate each download page and their links to find a newer version from code? Or would I have to check these websites regularly and then put them on my own website for the program to download from?
has title: Automaticly download library updates
accepted answer: http://stackoverflow.com/a/26692038
has comment: http://stackoverflow.com/comment/41980123
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26692038
type: AnsweredQuestion

http://stackoverflow.com/q/26692079
has comment: http://stackoverflow.com/comment/41979984
type: Question
has answer: http://stackoverflow.com/a/26692251
has answer: http://stackoverflow.com/a/26693460
tagged with: java
has comment: http://stackoverflow.com/comment/41979970
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/41980018
favorite count: 0
tagged with: arraylist
has body: This code is supposed to print all the elements in an ArrayList. It should deal with an empty ArrayList by reporting it. Here's my code: import java.util.ArrayList; public class Lab4ex1 { public static String prtElem(ArrayList&lt;String&gt; arr){ if(arr.size() == 0) { return "Error: The ArrayList must have elements to print out."; } else { for(int i=0;i&lt;arr.size();i++){ return arr.get(i); } return ""; } } public static void main(String[] args){ prtElem([]); } } However, when I try to execute it, I get an error in line 16 whether I have elements in the array or not. Why do I get this error and how could I fix this?
has answer: http://stackoverflow.com/a/26692124
has title: Printing elements in an ArrayList
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41980109
score: -3
downvote count: 3

http://stackoverflow.com/comment/42071152
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26742723
has text: You just told the algorithms with words. Putting it into Java code is just a scribe work
score: 0

http://stackoverflow.com/comment/42104610
type: Comment
comment on: http://stackoverflow.com/q/26728133
type: QuestionComment
score: 0
has text: Ah so more like: http://stackoverflow.com/questions/4123324/how-to-enable-browser-caching-of-static-contentimages-css-js-with-tomcat You should probably tag your question with spring and spring-mvc to see if someone more knowledgeable can come help

http://stackoverflow.com/comment/42086967
type: Comment
type: QuestionComment
has text: that `fill.setFillBackgroundColor(new XSSFColor(new java.awt.Color(80, 80, 100));` is custom R=80 G=80 B=100 right? what is the problem by using that?
score: 0
comment on: http://stackoverflow.com/q/26688945

http://stackoverflow.com/a/26722236
upvote count: 1
answers question: http://stackoverflow.com/q/26722140
has comment: http://stackoverflow.com/comment/42035203
type: Answer
has comment: http://stackoverflow.com/comment/42035322
has comment: http://stackoverflow.com/comment/42035236
has comment: http://stackoverflow.com/comment/42035381
downvote count: 0
has comment: http://stackoverflow.com/comment/42036672
score: 1
has body: I think, rather than trying to remove to the file mid-read (and I don't even really know how you'd do that, and if you could it'd be a horrible idea) you might have an easier time of this by just reading the entire file in and storing each value in an index of an ArrayList&lt;string&gt;: ArrayList&lt;string&gt; lines = new ArrayList&lt;string&gt;(); while ((input = in.readLine()) != null) { lines.add(input); } Then write the file again after you've finished reading it, skipping any index of lines that's equal to "0": for (String line : lines) { // skip "0" if (line.equals("0")) { continue; } // write to file if not writer.write(line); writer.newLine(); } Note that == compares reference equality in Java, and .equals compares value equality, so for almost all cases you want to use .equals. Granted, if as your comment states above, you have another file constantly writing to this one, you're better off looking for an entirely new idea. For that matter, if you've got a script writing these, why not change the script so that it just doesn't write lines for null values in the first place? Unless you have literally no way at all of changing the script, spinning another one up to constantly rewrite parts of its work (on the same constantly-accessed file!) is going to be a. ineffective and b. extremely problematic.
has comment: http://stackoverflow.com/comment/42035182

http://stackoverflow.com/comment/42130794
comment on: http://stackoverflow.com/a/26768150
type: Comment
has text: OK. Now I've added the complete solution to my answer. Not very educational, but I hope now you will understand what I meant. It's important to try to consider a problem in such a way that you can solve it if some conditions are true (it's positive), and again the same way with a slight change, when the conditions are a little different (it's negative, in this case).
score: 0
type: AnswerComment

http://stackoverflow.com/q/26725316
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42040033
has answer: http://stackoverflow.com/a/26808499
accepted answer: http://stackoverflow.com/a/26808499
type: Question
has title: How to check user status on each request in spring security
answer count: 2
upvote count: 6
has comment: http://stackoverflow.com/comment/42040070
linked to: http://stackoverflow.com/q/26393518
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/42040285
has answer: http://stackoverflow.com/a/77792964
has body: I am using spring security and I implemented UserDetailsService which perfectly handles my user login process. The question is this: Is there a standard way to check the user status from database on each request such that if the user's account status changes to "locked" or his roles get changed while he is STILL signed-in, the application prevents him from continuing his work. The issue here is that "public UserDetails loadUserByUsername(String arg0)" in my custom UserDetailsService class is only called at the sign-in process and the userDetails object keeps data since the sign-in process was carried-out and userDetails information is not fresh. I could solve this by some workaround like getting the user object from database and check its status by a listener. But I feel that spring security might have a general solution for this situation. Please help. Thanks.
downvote count: 0
possible better answer: http://stackoverflow.com/a/77792964
score: 6

http://stackoverflow.com/q/26803018
has answer: http://stackoverflow.com/a/26803154
tagged with: scala
possible better answer: http://stackoverflow.com/a/26803154
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26803366
type: Question
has body: I am using Akka with java. I see that AbstractActorContext has a method : scala.collection.immutable.Iterable&lt;akka.actor.ActorRef&gt; children(); How do I get the java javadoc for scala.collection.immutable.Iterable ? I can only find the scala version?
answer count: 2
has title: where to find the "java" javadoc for scala.collection.immutable.Iterable?
score: 0
tagged with: akka
accepted answer: http://stackoverflow.com/a/26803366

http://stackoverflow.com/comment/42101273
type: QuestionComment
comment on: http://stackoverflow.com/q/26759954
score: 1
has text: As always: it depends. If the possibility for null values is given, check for null (or prevent adding null values). If not, don't.
type: Comment

http://stackoverflow.com/comment/42002927
comment on: http://stackoverflow.com/q/26704904
has text: Can we see some code you've written to try to solve this problem?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42145525
type: Comment
type: QuestionComment
has text: @AlanHay updated my test class. Please check.
comment on: http://stackoverflow.com/q/26783852
score: 0

http://stackoverflow.com/comment/96430033
score: 0
type: Comment
has text: So how exactly do I modularize the JavaCC grammar (.jj-file) into several files?
comment on: http://stackoverflow.com/a/54823246
type: AnswerComment

http://stackoverflow.com/comment/42015511
comment on: http://stackoverflow.com/q/26712130
has text: sorry, I didn't realize. Thank you ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26778769
downvote count: 0
tagged with: fonts
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/54419934
type: Question
has title: Display Emoji character in JTable
tagged with: encoding
linked to: http://stackoverflow.com/q/17157915
linked to: http://stackoverflow.com/q/2934914
score: 4
tagged with: jtable
accepted answer: http://stackoverflow.com/a/26806763
answer count: 1
has comment: http://stackoverflow.com/comment/42150655
favorite count: 0
has answer: http://stackoverflow.com/a/26806763
has body: I want to display loudspeaker character in a JTable: @Override public Object getValueAt(int row, int col) { switch (col) { [...] case 2: String symbol = "\uD83D\uDD0A"; return "State " + symbol; default: return ""; } } Unfortunaly i just see an square box. I'm not sure if i have to set an specific Font supporting this character or to apply an other encoding. For Googlers looking for a solution: I implemented a CustomRenderer for the JTable like @trashgod sugested. Examples are available here or here.
linked to: http://stackoverflow.com/q/2833482
upvote count: 4
has comment: http://stackoverflow.com/comment/42243365
type: AnsweredQuestion

http://stackoverflow.com/a/26810327
has body: These two classes, although they shares the same name, are two totally different, incompatible classes. The Book in client package and server package does not have a Is-A relationship so the cast will surely fail. You don't have to have two classes with the exactly the same implementation. If this class is used both by the client and the server, the standard way is to put this class in another package, say "common" and shares between the client and server code.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26808987
answers question: http://stackoverflow.com/q/26808987
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26773942
tagged with: itext
type: Question
has body: I have a small problem and I'm trying for some time to find out a solution. Long story short I have to remove the top part of each page from a pdf with itext. I managed to do this with CROPBOX, but the problem is that this will make the pages smaller by removing the top part. Can someone help me to implement this so the page size remains the same. My idea would be to override the top page with a white rectangle, but after many tries I didn't manage to do this. This is the current code I'm using to crop the page. PdfRectangle rect = new PdfRectangle(55, 0, 1000, 1000); PdfDictionary pageDict; for (int curentPage = 2; curentPage &lt;= pdfReader.getNumberOfPages(); curentPage++) { pageDict = pdfReader.getPageN(curentPage); pageDict.put(PdfName.CROPBOX, rect); }
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26775197
has title: iText - crop out a part of pdf file
tagged with: java
downvote count: 0
answer count: 1
tagged with: crop
favorite count: 0
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/26775197
upvote count: 3

http://stackoverflow.com/q/26830692
tagged with: java
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/42229535
type: Question
has comment: http://stackoverflow.com/comment/42228229
has comment: http://stackoverflow.com/comment/42229931
has body: I'm currently trying working on an own game and created a Animation class, my problem is that i want the programm to be able to still find all the images when i create a jar out of it so I tried to load an Image via BufferedImage img = ImageIO.read(getClass().getClassLoader().getResourceAsStream("player.png")); but when I start the code I get a NullPointerException, i checked the location twice but the image exists and there should be no problems, can anyone help me out a bit?
score: 0
has title: Loading a BufferedImage in a .jar
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26830757

http://stackoverflow.com/comment/42017716
comment on: http://stackoverflow.com/q/26713504
type: Comment
has text: it is a bad desigining technique to use a large no. of subclasses. try to break the functionality by using either helper classes or design patterns like Factory or Strategy. To sum up you should not spwan subclasses greater then 2 -3 child classes
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42166052
type: QuestionComment
comment on: http://stackoverflow.com/q/26795934
has text: Okay, out of context code, wall of explanation, no stack trace...we're off to a good start here
score: 4
type: Comment

http://stackoverflow.com/comment/42176882
type: QuestionComment
has text: You can read Oracle's [Troubleshooting System Crashes](http://www.oracle.com/technetwork/java/javase/crashes-137240.html) guide but I doubt you will find much. There is also http://stackoverflow.com/questions/11275814/eclipse-has-randommly-stopped-loading which has a similar crash which might have been caused by hard drive errors. There is no obvious `InputStream` or similar in your case though.
score: 0
comment on: http://stackoverflow.com/q/26801109
type: Comment

http://stackoverflow.com/q/26714341
has comment: http://stackoverflow.com/comment/42020529
has comment: http://stackoverflow.com/comment/42045271
has comment: http://stackoverflow.com/comment/42020123
has title: Run SWT Object in Background
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
type: Question
tagged with: editor
has comment: http://stackoverflow.com/comment/42029673
has comment: http://stackoverflow.com/comment/42019505
tagged with: java
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/42022772
linked to: http://stackoverflow.com/q/2306190
has comment: http://stackoverflow.com/comment/42021780
has body: I created a custom eclipse editor and I need to set the status message in background (another thread). The message is too costly to be calculated and I need to run in background. To set this message I use this code: IActionBars actionBars = this.getEditorSite().getActionBars(); actionBars.getStatusLineManager().setMessage(text); And to run In background, I tried to create new Java Thread and I got the error "invalid thread access exception". I tried to use Display.getDefault().asyncExec and syncExec, but Its not run in background. Thanks a lot.
tagged with: eclipse-plugin

performance
tags question: http://stackoverflow.com/q/26830490
tags question: http://stackoverflow.com/q/26757398
tags question: http://stackoverflow.com/q/26819015
tags question: http://stackoverflow.com/q/26747426
tags question: http://stackoverflow.com/q/26817143
tags question: http://stackoverflow.com/q/26679557
tags question: http://stackoverflow.com/q/26681427
tags question: http://stackoverflow.com/q/26787617
tags question: http://stackoverflow.com/q/26676200
tags question: http://stackoverflow.com/q/26693007
tags question: http://stackoverflow.com/q/26796419
tags question: http://stackoverflow.com/q/26745014
tags question: http://stackoverflow.com/q/26748723
tags question: http://stackoverflow.com/q/26673780
tags question: http://stackoverflow.com/q/26821135
tags question: http://stackoverflow.com/q/26750963
tags question: http://stackoverflow.com/q/26824570
tags question: http://stackoverflow.com/q/26756785
tags question: http://stackoverflow.com/q/26772455
tags question: http://stackoverflow.com/q/26689133
tags question: http://stackoverflow.com/q/26739579
tags question: http://stackoverflow.com/q/26809537
tags question: http://stackoverflow.com/q/26827523
tags question: http://stackoverflow.com/q/26725693
tags question: http://stackoverflow.com/q/26753180
tags question: http://stackoverflow.com/q/26684007
tags question: http://stackoverflow.com/q/26772777
tag name: performance
tags question: http://stackoverflow.com/q/26779966
tags question: http://stackoverflow.com/q/26684954
tags question: http://stackoverflow.com/q/26735138
tags question: http://stackoverflow.com/q/26695904
type: Tag
tags question: http://stackoverflow.com/q/26748102
tags question: http://stackoverflow.com/q/26726868
tags question: http://stackoverflow.com/q/26802943

http://stackoverflow.com/comment/50036422
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately, I don't have any other configurations annotated with `@ComponentScan`. Code samples origin from much more complicated project, indeed, but I tried to include as many details as possible.
comment on: http://stackoverflow.com/a/30979926

http://stackoverflow.com/q/26696309
has answer: http://stackoverflow.com/a/26696379
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41987408
tagged with: java
has comment: http://stackoverflow.com/comment/41988990
has comment: http://stackoverflow.com/comment/41989590
type: Question
has title: Gridview adapter: getView() being called only 3 times when getCount() returns 9
answer count: 2
tagged with: android
has body: I'm working with a GridView. Basically, I ensured that getCount() returns 9, but when I debug the code, I see that getView() is only called 3 times. I don't understand why this occurs, as I clearly tell it to return 9 times. public class Level1BoardAdapter extends BaseAdapter { private Context context; private int level; public Level1BoardAdapter(Context context, int level) { this.context = context; this.level = level; } @Override public int getCount() { // TODO Auto-generated method stub return 9; } @Override public View getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { Button button = new Button(context); button.setOnClickListener(new ButtonPressed(context, level)); com.example.titanictictactoe.Board.keys.put(position, button); return button; } } This is being called in the following class: public class Level2BoardAdapter extends BaseAdapter { private Context context; public Level2BoardAdapter(Context context) { this.context = context; } @Override public int getCount() { // TODO Auto-generated method stub return 9; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { GridView board = new GridView(context); board.setNumColumns(3); board.setBackgroundColor(Color.BLACK); board.setAdapter(new Level1BoardAdapter(context, 2)); Log.d("Count", String.format("%1d", board.getCount())); return board; } }
tagged with: gridview
has answer: http://stackoverflow.com/a/26696359

http://stackoverflow.com/a/26711289
score: 0
has comment: http://stackoverflow.com/comment/42014109
type: Answer
has comment: http://stackoverflow.com/comment/42014170
answers question: http://stackoverflow.com/q/26711220
has body: try with below code: Intent intent = new Intent(context,DESTINATION ACTIVITY.class); intent.putExtra("data",YOUR ARRAY OF OBJECT) startActivity(intent); //Getting data in another activity ARRAY OF OBJECT = (ArrayList&lt;String&gt;) this.getIntent().getSerializableExtra("data"); //here I` have used Arraylist to explain you.

http://stackoverflow.com/a/61561802
upvote count: 3
has body: Worked for me (Gradle 6.3, Kotlin DSL): tasks.withType&lt;Test&gt; { this.classpath.forEach { println(it) } }
answers question: http://stackoverflow.com/q/26824761
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/26691214
answer count: 1
has body: I am writing a suite logger for TestNG and I am having trouble retrieving a complete list of all methods for a class in a test suite. The getAllMethods() method on the ISuite interface only gives me the methods annotated by @Test. I have several public methods on my class that are annotated with @BeforeClass, @AfterClass and so on. I want to retrieve those methods as well. How do I access them? There is nothing in ISuite that seems to do what I want.
score: 0
has comment: http://stackoverflow.com/comment/42015340
tagged with: testng
accepted answer: http://stackoverflow.com/a/26693171
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42026211
has answer: http://stackoverflow.com/a/26693171
tagged with: java
has title: Getting list of _all_ methods in a class for a TestNG test suite
type: Question

http://stackoverflow.com/q/26685752
has body: I am having issues running a Hadoop job, receiving a FileNotFoundException when trying to retrieve a file from the Distributed Cache, even though the file exists. When I run it on my local file system, it works. The cluster is hosted on Amazon Web Services, using Hadoop version 1.0.4 and Java version 1.7. I don't have any control over the cluster, or how it's set up. In the main function I add the file to the distributed cache. This seems to work fine. I think, at least it's not throwing any exceptions. .... JobConf conf = new JobConf(Driver.class); conf.setJobName("mean"); conf.set("lookupfile", args[2]); Job job = new Job(conf); DistributedCache.addCacheFile(new Path(args[2]).toUri(), conf); ... In the Setup function being called before Map I create a Path for the file, and call a function that loads the file into a hash map. Configuration conf = context.getConfiguration(); String inputPath = conf.get("lookupfile"); Path dataFile = new Path(inputPath); loadHashMap(dataFile, context); The exception occurs on the first line of the function that loads the hash map. brReader = new BufferedReader(new FileReader(filePath.toString())); I start the job like so. hadoop jar Driver.jar Driver /tmp/input output /tmp/DATA.csv I get the following error Error: Found class org.apache.hadoop.mapreduce.Counter, but interface was expected attempt_201410300715_0018_m_000000_0: java.io.FileNotFoundException: /tmp/DATA.csv (No such file or directory) attempt_201410300715_0018_m_000000_0: at java.io.FileInputStream.open(Native Method) attempt_201410300715_0018_m_000000_0: at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) attempt_201410300715_0018_m_000000_0: at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:101) attempt_201410300715_0018_m_000000_0: at java.io.FileReader.&lt;init&gt;(FileReader.java:58) attempt_201410300715_0018_m_000000_0: at Map.loadHashMap(Map.java:49) attempt_201410300715_0018_m_000000_0: at Map.setup(Map.java:98) attempt_201410300715_0018…
score: 0
tagged with: java
tagged with: filenotfoundexception
has answer: http://stackoverflow.com/a/39889125
type: UnansweredQuestion
has title: FileNotFoundExcepton when reading file from Hadoop distributed cache
tagged with: hadoop
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/29238966

http://stackoverflow.com/q/26706313
possible better answer: http://stackoverflow.com/a/31013482
favorite count: 0
has title: Java ATM Program
answer count: 3
has comment: http://stackoverflow.com/comment/42005413
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26706604
upvote count: 3
downvote count: 1
accepted answer: http://stackoverflow.com/a/26706604
type: Question
has answer: http://stackoverflow.com/a/40831599
tagged with: java
has answer: http://stackoverflow.com/a/31013482
has body: I'm doing an atm program and I'm having a hard time trying to figure out how to get it to actually deposit and withdraw. The balance starts off automatically as $0 but I can't get anything I type in to actually add on or subtract to it what am I doing wrong? public class ATM { static Scanner keyboard = new Scanner(System.in); static String acctNum, pwd, result; static double oldBalance, newBalance, deposit, withdraw; static int choose; public static void main(String[] args) { for (int run = 0; run &lt; 3; run++) { System.out.println("Enter your account number"); acctNum = keyboard.nextLine(); System.out.println("Enter your account password"); pwd = keyboard.nextLine(); result = checkID(acctNum, pwd); if (!result.equals("ERROR")) { break; } else if (run == 2) {// you cannot try to log in anymore than 3 // times System.out.println("MAXIMUM TRIES EXCEEDED"); return; } } menu(); } public static String checkID(String acctNum, Object pwd) { String result = "ERROR"; String a = "44567-5 mypassword 520.36"; String b = "1234567-6 anotherpassword 48.20"; String c = "4321-0 betterpassword 96.74"; if (acctNum.equals("44567-5") &amp;&amp; pwd.equals("mypassword")) { result = "520.36"; } else if (acctNum.equals("1234567-6") &amp;&amp; pwd.equals("anotherpassword")) { result = "48.20"; } else if (acctNum.equals("4321-0") &amp;&amp; pwd.equals("betterpassword")) { result = "96.74"; } System.out.println(result); return result; } public static int menu() { System.out .println("Choose one of the following: \n1.Display Balance\n2.Deposit\n3.Withdraw\n4.Log Out"); choose = keyboard.nextInt(); if (choose == 1) {// 1. Display Balance displayBalance(); menu(); return 1; } if (choose == 2) {// 2. Deposit deposit(); menu(); return 2; } if (choose == 3) {// 3. Withdraw withdraw(); menu(); return 3; } if (choose == 4) {// 4. Log out System.out.println("You are logged out."); return 4; } if (choose &lt;= 5) {// type in anything greater than 4 and you will get a // system error System.out.println…

http://stackoverflow.com/comment/42226382
type: Comment
comment on: http://stackoverflow.com/q/26829280
score: 0
type: QuestionComment
has text: @raj even if the listener is for the button that is within the item's layout?

http://stackoverflow.com/a/46085741
upvote count: 2
score: 1
downvote count: 1
has body: I was doing an exercise in my book and the exercise said, "Make a method that tests to see if the end of a string ends with 'ger.' Write the code to where it tests for any combination of upper-case and lower-case letters in the phrase 'ger.'" So, basically, it asked me to test for a phrase within a string and ignore the case so it doesn't matter if letters in "ger" are upper or lower-case. Here is my solution: package exercises; import javax.swing.JOptionPane; public class exercises { public static void main(String[] args) { String input, message = "enter a string. It will" + " be tested to see if it " + "ends with 'ger' at the end."; input = JOptionPane.showInputDialog(message); boolean yesNo = ends(input); if(yesNo) JOptionPane.showMessageDialog(null, "yes, \"ger\" is there"); else JOptionPane.showMessageDialog(null, "\"ger\" is not there"); } public static boolean ends(String str) { String input = str.toLowerCase(); if(input.endsWith("ger")) return true; else return false; } } as you can see from the code, I simply converted the string that a user would input to all lower-case. It would not matter if every letter was alternating between lower and upper-case because I negated that.
type: Answer
answers question: http://stackoverflow.com/q/26794275

http://stackoverflow.com/a/52248643
has comment: http://stackoverflow.com/comment/107099988
has comment: http://stackoverflow.com/comment/98237414
has comment: http://stackoverflow.com/comment/94346347
downvote count: 2
has comment: http://stackoverflow.com/comment/94346483
has comment: http://stackoverflow.com/comment/107124872
score: 19
answers question: http://stackoverflow.com/q/26684562
upvote count: 21
has body: I am not very sure I am supposed to answer this, but every time I face someone that does not understand this, I use the same example. Imagine you have an apple. A map is transforming that apple to apple-juice for example or a one-to-one mapping. Take that same apple and get only the seeds out of it, that is what flatMap does, or a one to many, one apple as input, many seeds as output.
has comment: http://stackoverflow.com/comment/107099884
has comment: http://stackoverflow.com/comment/107109384
has comment: http://stackoverflow.com/comment/100553801
has comment: http://stackoverflow.com/comment/111641242
type: Answer

http://stackoverflow.com/a/26718589
has body: Remove the semi colon for (index = 0; index &lt; allowed.length - 1; index++); ^ which is terminating the for loop. The following code block is a standalone block which is executed only once
upvote count: 1
answers question: http://stackoverflow.com/q/26718580
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42132419
type: QuestionComment
has text: @hagubear I knew all this (the links you gave). Thanks, but this doesn't answer my question.
score: 0
comment on: http://stackoverflow.com/q/26776748
type: Comment

http://stackoverflow.com/a/26766620
score: 0
accepted answer of: http://stackoverflow.com/q/26698516
type: Answer
answers question: http://stackoverflow.com/q/26698516
has body: As Diptopol Dam said, calling the DatagramSocket.close(); method before the application is closed fixed the problem. Thanks Diptopol Dam!
type: AcceptedAnswer

http://stackoverflow.com/a/61460127
upvote count: 6
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/26788464
type: Answer
has body: Solution is very simple Just put following line into your style named as AppTheme @color/white Now your whole xml code will look like shown below (default style).

http://stackoverflow.com/comment/42179188
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26801109
has text: @user496934: You can try searching Oracle's bug DB, but that's as far as you can get. If you have a support contract with Oracle, you can talk to them. Otherwise moving to the latest available minor version, or indeed maybe to 1.7 is prob. the best thing you can do. Using older version of JVM is not advisable anyways as they may have unpatched vulnerabilities.
score: 0

http://stackoverflow.com/a/26709633
upvote count: 3
has comment: http://stackoverflow.com/comment/42011139
has comment: http://stackoverflow.com/comment/42014098
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26709314
score: 3
has comment: http://stackoverflow.com/comment/42048259
has body: Set the "insertable" and "updatable" attributes of the @Column annotation for that field to be "false".

http://stackoverflow.com/comment/42047208
comment on: http://stackoverflow.com/a/26729589
has text: bundle of thanks please share a link for any related example for clear understanding.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42018135
has text: Actually, if he can read the Certificate in as a String like that, then he could use the `PEMParser` class from Bouncycastle.
type: Comment
comment on: http://stackoverflow.com/a/26712084
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42133417
type: Comment
comment on: http://stackoverflow.com/a/26777574
score: 1
has text: I have also tried regex. Can you explain why `xml = xml.replaceAll("&lt;", "\\<");` is not valid ?
type: AnswerComment

http://stackoverflow.com/q/26821555
has body: i have two arrays. double number[] = new double[5]; char oper[] = new char[4]; in my program when user press any operator sign like +,-,*,/ the number array is taking user input for example if he is entering 345 it is taking and saving it in number[0] and [0] become [1] and also save the current operation input from user and save it in oper[0] and so on. but i dont know how can i get the result using both arrays. i am pasting whole code here. package com.example.calculatortesting; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends ActionBarActivity implements OnClickListener { TextView textdisplay; EditText currentcalc; EditText et1; double number[] = new double[5]; //for saving numbers in array char oper[] = new char[4]; //for saving operation in array int numposition = 0; //for position of number array int operposition = 0; //for position of operation array double currentnum; //saving current number before operation int last_button = 0; //checking last button pressed char operator; //saving pressed operation value String newnum = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calculator); et1 = (EditText) findViewById(R.id.editText1); textdisplay = (TextView) findViewById(R.id.editText1); currentcalc = (EditText) findViewById(R.id.textView1); Button b1 = (Button) findViewById(R.id.b1); Button b2 = (Button) findViewById(R.id.b2); Button b3 = (Button) findViewById(R.id.b3); Button b4 = (Button) findViewById(R.id.b4); Button b5 = (Button) findViewById(R.id.b5); Button b6 = (Button) findViewById(R.id.b6); Button b7 = (Button) findViewById(R.id.b7); Button b8 = (Button) findViewById(R.id.b8); Button b9 = (Button) findViewById(R.id.b9); Button b0 = (Button) findViewById(R.id.…
has answer: http://stackoverflow.com/a/26821778
answer count: 2
upvote count: 0
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/26821616
tagged with: android
accepted answer: http://stackoverflow.com/a/26821778
possible better answer: http://stackoverflow.com/a/26821616
has title: how to add Double and Char arrays with each other in my scientific calculator program
tagged with: java
downvote count: 2
type: Question
type: AnsweredQuestion
score: -2

http://stackoverflow.com/comment/41997648
score: 2
type: Comment
has text: [Dependency injection](http://en.wikipedia.org/wiki/Dependency_injection) might be a solution
type: QuestionComment
comment on: http://stackoverflow.com/q/26702120

http://stackoverflow.com/comment/42079486
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26735334
has text: Wow helped me a lot. Thanks!! Yes now ,i have no more the red lines. is everything okay. But when i try to do this tutorial(parse oficial) https://parse.com/apps/quickstart#parse_data/mobile/android/native/new i don't have sucess ( nothing good ,nothing wrong).

http://stackoverflow.com/comment/42230684
type: QuestionComment
has text: Just to give something constructive and steer you away from thinking about sysout and clickable links, see this thread: http://stackoverflow.com/questions/527719/how-to-add-hyperlink-in-jlabel
comment on: http://stackoverflow.com/q/26832038
score: 0
type: Comment

http://stackoverflow.com/q/26787961
upvote count: 0
has answer: http://stackoverflow.com/a/26788190
favorite count: 0
has answer: http://stackoverflow.com/a/26788381
type: Question
accepted answer: http://stackoverflow.com/a/26788190
answer count: 2
score: -2
possible better answer: http://stackoverflow.com/a/26788381
tagged with: java
downvote count: 2
tagged with: jsoup
has body: I have a problem with parsing a website. The website contains a phrase like this: ... How can I get the title (Highschool)? I'm programming with jsoup and java. Thanks for your help.
has title: Get title attribute with jsoup
type: AnsweredQuestion

http://stackoverflow.com/comment/42204904
score: 0
comment on: http://stackoverflow.com/q/26816385
type: QuestionComment
has text: When the user press the EditText...
type: Comment

http://stackoverflow.com/q/26704179
has title: Java error: The method XXX in the type XXX is not applicable for the arguments
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5495383
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26704289
has answer: http://stackoverflow.com/a/26704237
has comment: http://stackoverflow.com/comment/42001652
has answer: http://stackoverflow.com/a/26704289
has comment: http://stackoverflow.com/comment/42001897
has body: There is an error in the method add in the following java text: import java.util.Vector; public class test { Vector&lt;? extends CellObject&gt; v = new Vector&lt;&gt;(); class Cell extends CellObject { // some definitions here public Cell() { v.add(this); } } } Why I can't use bounded wildcard? My problem that at the moment (and in the place) of creating the vector v I really don't know future subclass that will be stored in the vector. I know that in the case Vector&lt;CellObject&gt; v = new Vector&lt;&gt;(); there will be no error, but components of the vector are not of the class CellObject.
duplicate of: http://stackoverflow.com/q/5495383
possible better answer: http://stackoverflow.com/a/26704237

http://stackoverflow.com/comment/42142064
has text: Why don't you answer the question?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26782305

http://stackoverflow.com/q/26800733
type: Question
tagged with: debugging
answer count: 2
has title: Android useful debug/release macros (using gradle?)
downvote count: 0
has body: I am writing an android app. I need to use different variable values for release and debug versions. As mentioned somewhere on this site, I do like this: private static final boolean debug = true; if(debug){ // do some debug work } else{ // do release work } but in some cases I need different values of final variables (which are members of the class) for debug/release versions and this solution obviously doesn't work. Is there any solution of this problem (except changing variables manually), maybe somehow using Gradle scripting (like buildConfigField, but in any class)?
accepted answer: http://stackoverflow.com/a/27044295
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/28662688
has answer: http://stackoverflow.com/a/28662688
tagged with: macros
upvote count: 1
type: AnsweredQuestion
tagged with: android-gradle-plugin
has answer: http://stackoverflow.com/a/27044295
score: 1
tagged with: java

http://stackoverflow.com/a/26805142
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26805076
has comment: http://stackoverflow.com/comment/42183415
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42183595
answers question: http://stackoverflow.com/q/26805076
has body: The V is used for generics. If you write // ClassName is the class newHashSet is declared in ClassName.&lt;String&gt;newHashSet(); it will work just as well as ClassName.&lt;Integer&gt;newHashSet(); This way you can reuse this method for different types. It's called generics. Set is what the function returns. Static means the function belongs to a class, not to an instance of the class.
type: Answer
has comment: http://stackoverflow.com/comment/42183926

http://stackoverflow.com/q/26809922
has body: I am trying to do a quizz app so I followed a tutorial this one: https://www.youtube.com/watch?v=3sDo9afuPOI and thanks to it a I made the quizz, but I have a slight problem is that for first question I have something like: What is Spain capital? Malaga Madrid Barcelona But for questions 2 and 3 and so on answers are like that What is France capital? Paris Paris1 Paris2 Here the part of code that actually does the work if (flag &lt; questions.length) { textviewquest.setText(questions[flag]); radiobtn1.setText(options[flag * 3]); radiobtn2.setText(options[flag * 3] + 1); radiobtn3.setText(options[flag * 3] + 2); and flag is an integer initialized to 0 and I have 30 questions But I can't really figure out how to repair it. I wish someone can help.
has answer: http://stackoverflow.com/a/26809958
type: AnsweredQuestion
tagged with: java
type: Question
has title: I have the same answers on each Radio Button
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26809958
score: 0
tagged with: android

http://stackoverflow.com/comment/42153908
score: 0
type: Comment
type: QuestionComment
has text: Also, having the runnable post itself every time it runs is a recipe for trouble. You've just created an infinite loop which should result in your application running very sluggishly. Why isn't the runnable posted when you receive new data? Why do you do it in onResume? There are some design issues that need to be addressed here.
comment on: http://stackoverflow.com/q/26783038

http://stackoverflow.com/a/26793774
type: Answer
score: 2
downvote count: 0
has body: The error I get when I paste all the things into my IDE is CarpetCalculatorProgram cannot be resolved to a type Assuming that there are no classes you didn't post: There is no CarpetCalculatorProgram class and there are no inner RoomDimension / RoomCarpet classes in there. RoomDimension is actually an independent top level class. The code must either be // Create RoomDimension and RoomCarpet objects. RoomDimension dimensions = new RoomDimension(length, width); RoomCarpet roomCarpet = new RoomCarpet(dimensions, CARPET_PRICE_PER_SQFT); instead of using new EnclosingClass().new InnerClass() syntax. OR // Create RoomDimension and RoomCarpet objects. CarpetCalculatorProgram calculatorProgram = new CarpetCalculatorProgram(); CarpetCalculatorProgram.RoomDimension dimensions = calculatorProgram.new RoomDimension(length, width); CarpetCalculatorProgram.RoomCarpet roomCarpet = calculatorProgram.new RoomCarpet(dimensions, CARPET_PRICE_PER_SQFT); AND the two classes moved into the CarpetCalculatorProgram class: public class CarpetCalculatorProgram { public class RoomDimension { ... } public class RoomCarpet { ... } }
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26793599
accepted answer of: http://stackoverflow.com/q/26793599

http://stackoverflow.com/comment/42161274
has text: If you read the duplicate, you learn that a `NullPointerException` occurs for a single reason, dereferencing a `null` value. So something has to be `null` in your scenario. That something is `testScores`. The linked duplicate question/answer in this case is a _canonical_ question/answer. It is very rarely useful for others to debug one person's problem. It is much more useful to understand what causes a NPE and how to handle it. _Give a man a fish, he'll eat for a day. Teach a man to fish, and he'll eat for a lifetime._
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26792582

http://stackoverflow.com/comment/41998709
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26702464
type: AnswerComment
has text: why the previous for ( for the sum) remains "atomic" for each threads?

http://stackoverflow.com/q/26799874
has answer: http://stackoverflow.com/a/26800571
has title: Java 8 interface/class loader changes?
tagged with: java
type: Question
answer count: 2
has body: I have found some difficult cautious between Java 1.7_51 and Java 1.8_20. The initial situation: One Interface: interface InterfaceA { public void doSomething(); } Two classes: public class ClassA implements InterfaceA { public void doSomething() { System.out.println("Hello World!"); } } public class ClassB { public static void main(String[] args) { ClassA a = new ClassA(); a.doSomething(); } } Next i have compiled the classes with (Java 1.8) -> javac *.java after the compiler finished i removed the InterfaceA.java and InterfaceA.class file's. Now i try again too compile only the ClassB.java and got the error message: ClassB.java:4: error: cannot access InterfaceA a.doSomething(); class file for InterfaceA not found 1 error The same i have tried with java 1.7.. -> javac *.java after the compiler finished i removed the InterfaceA.java and InterfaceA.class file's. But know i got no error message .. Can someone explain me this? .. sorry for my bad english ..
tagged with: java-7
has comment: http://stackoverflow.com/comment/42173686
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26801621
upvote count: 4
tagged with: compiler-errors
type: UnansweredQuestion
tagged with: java-8

http://stackoverflow.com/comment/42027161
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26717883
has text: @Thomas you are right, but OP wanted to invoke parametrized `super`, while what is invoked implicitly is `super()`.

http://stackoverflow.com/comment/42043879
type: AnswerComment
type: Comment
has text: Is this <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> in your AndroidManifest.xml ?
comment on: http://stackoverflow.com/a/26726668
score: 0

http://stackoverflow.com/q/26716226
accepted answer: http://stackoverflow.com/a/26716353
upvote count: 1
type: Question
tagged with: java
score: -1
answer count: 6
has comment: http://stackoverflow.com/comment/42022630
has answer: http://stackoverflow.com/a/26716324
has title: Are multiple values possible in a switch statement?
has answer: http://stackoverflow.com/a/26716495
has body: import java.io.FileNotFoundException; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { Scanner kb = new Scanner(System.in); System.out.println("Which file would you like to test?"); System.out.println(); System.out.println("Enter '1' for life1"); System.out.println("Enter '2' for life2"); System.out.println("Enter '3' for life3"); System.out.println("Enter '4' for life4"); System.out.println("Enter '5' for life5"); kb.nextInt(); int one, two, three, four, five; one = 1; two = 2; three = 3; four = 4; five = 5; switch(one || two || three || four || five){ case 1:{ GameOfLife gol = new GameOfLife("Input/life1.txt"); gol.print("Input/life1.txt"); break; } } } } This is the following code example that I am working with. Basically what I would like this to do is evaluate what the user enters from the keyboard, and then instantiate the GameOfLife class and the respective text file to print on the screen. After this, the user would then be prompted to update the file or not with the next iteration. I'm not sure why this is not working the way I'd like it to, I thought my reasoning and logic was sound.
favorite count: 0
has answer: http://stackoverflow.com/a/26717510
has answer: http://stackoverflow.com/a/26716353
has answer: http://stackoverflow.com/a/26716366
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26716275
downvote count: 2
has answer: http://stackoverflow.com/a/26716275

http://stackoverflow.com/a/26889068
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26803277
has body: If you look in the documentation (cf. @alain.janinm's comment) and the XSD it says .... &lt;xs:element name="cache"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; ... &lt;xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheDecoratorFactory"/&gt; ^^^^^^^ So, your problem is a typo - change &lt;cacheDecorator class="net.sf.ehcache.... to &lt;cacheDecoratorFactory class="net.sf.ehcache.... and you will be fine. Cheers,
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26803277

http://stackoverflow.com/a/26741027
type: Answer
has body: Your code: for (int run = 0; run&lt;count;count++) needs to be: for (int run = 0; run&lt;count;run++) Each time it runs, it tries to grab more lines than it can, because run will always be less than count the way you have it written.
answers question: http://stackoverflow.com/q/26740725
score: 0

http://stackoverflow.com/comment/41964460
comment on: http://stackoverflow.com/a/26682255
has text: The java performance turning team disagrees with you int he following quote: " Brian Goetz confirms that with the latest Java memory model, volatile-read and monitor-acquire have the same memory semantics, and volatile-write and monitor-release have the same memory semantics, so a volatile operation can never be more expensive than the corresponding monitor operation, and could be less." -http://www.javaperformancetuning.com/news/qotm051.shtml. But otherwise great answer!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42171692
has text: Please format your code in a readable manner.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26798896

http://stackoverflow.com/q/26686084
score: 9
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/41970514
accepted answer: http://stackoverflow.com/a/26686345
answer count: 3
downvote count: 0
tagged with: intel-edison
favorite count: 0
has comment: http://stackoverflow.com/comment/41970381
tagged with: path
has title: Linux JAVA in path but permissions denied
tagged with: permissions
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26686115
has answer: http://stackoverflow.com/a/26686345
tagged with: java
has answer: http://stackoverflow.com/a/26686115
has body: Im trying to get JAVA enabled on Intel Edison which uses Yocto (Linux), the problem is that after extracting the zip, im able to check the version, and when putting it into the path, im not able to access java at all due permissions. Specifically im trying to follow this tutorial but i get "stuck" at the . .profile since next step java -version throws same issue as pasted below, permissions denied or as earlier, java was not found. Heres a quick overview of output: root@dedsec1:~/java/jdk1.7.0_67/bin# ./java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode) root@dedsec1:~/java/jdk1.7.0_67/bin# cd root@dedsec1:~# echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/root/bin:/home/root/java/jdk1.7.0_67/bin:/home/root/java/jdk1.7.0_67/bin root@dedsec1:~# ./java -version -sh: ./java: Permission denied root@dedsec1:~# What the hell am i missing ? I have set chmod -x on java but it doesnt seem to affect it.
has answer: http://stackoverflow.com/a/26686178

http://stackoverflow.com/q/26714735
score: 0
has comment: http://stackoverflow.com/comment/42086278
has comment: http://stackoverflow.com/comment/42019883
tagged with: email
answer count: 0
has comment: http://stackoverflow.com/comment/42127005
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42126955
has comment: http://stackoverflow.com/comment/42084591
tagged with: java
tagged with: servlets
type: Question
has title: Mail not sending from Spring Controller
has body: org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [servlet-web] in context with path [/xxx] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException] with root cause java.lang.ClassNotFoundException: javax.mail.MessagingException this is throwing internal server error in browser and no mail is sent with javax api. While simple java file with the code : EmailSender emailSender = new EmailSender(); emailSender.setDefaultProperties(); emailSender.sendEmail(EmailSender.USERNAME, EmailSender.PASSWORD, EmailSender.FROM, "vkeerocks@gmail.com", "Test Mail", "&lt;b&gt; Hi there!!! &lt;/b&gt;"); But the same if I put in the controller then throwing error. this is my controller code: @RequestMapping(value = {"register"}, method = {RequestMethod.PUT}, consumes = "application/json", produces = "application/json") public @ResponseBody User registerUser(@RequestBody User user, HttpServletResponse response) { if (logger.isDebugEnabled()) { logger.debug("Serving request for registering user: " + user.toString()); } boolean success; try { logger.warn("Registering user : " + user.toString()); this.userService.insertUser(this.convertUserToUserDto(user)); EmailSender emailSender = new EmailSender(); emailSender.setDefaultProperties(); emailSender.sendEmail(EmailSender.USERNAME, EmailSender.PASSWORD, EmailSender.FROM, "vkeerocks@gmail.com", "Test Mail", "&lt;b&gt; Hi there!!! &lt;/b&gt;"); success = true; } catch (Exception e) { logger.error("While serving the request for registering user :", e); success = false; } return user; }

http://stackoverflow.com/comment/42079394
has text: Sorry my bad, the MalformedURLException is now gone!
comment on: http://stackoverflow.com/a/26746346
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26793982
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26793269
upvote count: 4
downvote count: 0
has body: You could use a GridBagLayout, for example... GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; add(shrished, gbc); gbc.gridx++; gbc.weightx = 1; add(shrishing, gbc); "Wow", you say, "that looks complicated, why would I want to do that when other methods look easier"...good question, you could also do this... GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; add(shrished, gbc); gbc.gridx++; gbc.weightx = 1; gbc.weighty = 1; add(shrishing, gbc); or this... GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.SOUTHWEST; add(shrished, gbc); gbc.gridx++; gbc.weightx = 1; gbc.weighty = 1; add(shrishing, gbc); With flexibility comes complexity, but it really comes down to exactly what you want to achieve...

http://stackoverflow.com/q/26693720
linked to: http://stackoverflow.com/q/336144
has answer: http://stackoverflow.com/a/26693790
has body: Say you have a team of 3 where 2 members are working in Java and the other member is working in Scala. Is it possible to compile and run this program with the Java compiler / JVM or do you need to use the Scala compiler / JVM? What is the best way to run a program that has both Java and Scala source code? Any further elaboration on this topic would be helpful.
upvote count: 1
has title: What is the best way to run a Java program that also has Scala code?
has answer: http://stackoverflow.com/a/26693766
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/26696544
tagged with: scala
answer count: 4
accepted answer: http://stackoverflow.com/a/26693785
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41982921
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26693785
type: Question
possible better answer: http://stackoverflow.com/a/26696544

http://stackoverflow.com/comment/42001897
score: 0
has text: Notice that `<>` expands to `<CellObject>` in both cases. Both vectors have the same type. The only difference is that in first case you are using more generic type on `v`.
type: QuestionComment
comment on: http://stackoverflow.com/q/26704179
type: Comment

http://stackoverflow.com/a/26782354
type: Answer
score: 0
has body: I don't know where you have taken the method signature visit(MethodPattern node) from. But you could override visit(MethodInvocation node) in order to be able to inspect method invocations. Then you can use the passed node to query method arguments and the like. public class MyVisitor extends org.eclipse.jdt.core.dom.ASTVisitor { public boolean visit(MethodInvocation node) { List&lt;?&gt; arguments = node.getArguments(); // do something with the arguments, etc. } }
accepted answer of: http://stackoverflow.com/q/26781663
answers question: http://stackoverflow.com/q/26781663
type: AcceptedAnswer

http://stackoverflow.com/comment/41985782
has text: What error is it giving? By the way you didn't forget the semicolumn at button_list.get(0).setText("a") right?
comment on: http://stackoverflow.com/q/26695210
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42173950
has text: Never mind guys i found the solution while searching at stack overflow itself i found a suggestion by @Pradip Bhatt (http://stackoverflow.com/questions/10090715/running-jersey-project-rest-web-service-to-tomcat?rq=1) i added this property to web.xml com.sun.jersey.api.json.POJOMappingFeature true which leads me to specific problem there was some req file missing used for db connection(specific to my project) added and solved :) thanks
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26781613

http://stackoverflow.com/a/26682828
has body: Instead of creating a bunch of JButton objects on their own, create an array of size 9. JButton[] buttons = new JButton[9]; for(int i = 0; i &lt; 9; ++i) { buttons[i] = new JButton("Button " + (i+1)); } Then you can do n=1; buttons[n-1].setIcon();
has comment: http://stackoverflow.com/comment/41964391
answers question: http://stackoverflow.com/q/26682775
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/41964713
downvote count: 0
has comment: http://stackoverflow.com/comment/41964343
score: 4
has comment: http://stackoverflow.com/comment/41967081
has comment: http://stackoverflow.com/comment/41964327
accepted answer of: http://stackoverflow.com/q/26682775
type: AcceptedAnswer

http://stackoverflow.com/comment/41990336
score: 0
type: AnswerComment
has text: @ifLoop I guess that's a matter of opinion. Which Pair class are you referring too? I searched for Pair in my IDE and got several suggestions (android.util.Pair, sun.security.tools.Pair, etc...), none of them part of the JavaSE (or even JavaEE) packages.
type: Comment
comment on: http://stackoverflow.com/a/26697970

http://stackoverflow.com/comment/42106430
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26743098
has text: @user50210 The problem is that you are trying to cast `Object[]` in to a `String[]` and it's not a valid cast.

http://stackoverflow.com/comment/42188670
has text: you can use System.out.println(new SimpleDateFormat("h:mm a").format(new Date()));
type: QuestionComment
comment on: http://stackoverflow.com/q/26807839
type: Comment
score: 0

http://stackoverflow.com/a/26778123
has comment: http://stackoverflow.com/comment/99296534
type: Answer
score: 1559
upvote count: 1559
accepted answer of: http://stackoverflow.com/q/26777083
has comment: http://stackoverflow.com/comment/86705348
answers question: http://stackoverflow.com/q/26777083
has comment: http://stackoverflow.com/comment/116726869
has comment: http://stackoverflow.com/comment/85370348
has comment: http://stackoverflow.com/comment/89836653
has comment: http://stackoverflow.com/comment/108004526
has comment: http://stackoverflow.com/comment/113515291
has comment: http://stackoverflow.com/comment/112593259
has comment: http://stackoverflow.com/comment/106381609
has comment: http://stackoverflow.com/comment/85385584
type: AcceptedAnswer
downvote count: 0
has body: How token-based authentication works In token-based authentication, the client exchanges hard credentials (such as username and password) for a piece of data called token. For each request, instead of sending the hard credentials, the client will send the token to the server to perform authentication and then authorization. In a few words, an authentication scheme based on tokens follow these steps: The client sends their credentials (username and password) to the server. The server authenticates the credentials and, if they are valid, generate a token for the user. The server stores the previously generated token in some storage along with the user identifier and an expiration date. The server sends the generated token to the client. The client sends the token to the server in each request. The server, in each request, extracts the token from the incoming request. With the token, the server looks up the user details to perform authentication. If the token is valid, the server accepts the request. If the token is invalid, the server refuses the request. Once the authentication has been performed, the server performs authorization. The server can provide an endpoint to refresh tokens. What you can do with JAX-RS 2.0 (Jersey, RESTEasy and Apache CXF) This solution uses only the JAX-RS 2.0 API, avoiding any vendor specific solution. So, it should work with JAX-RS 2.0 implementations, such as Jersey, RESTEasy and Apache CXF. It is worthwhile to mention that if you are using token-based authentication, you are not relying on the standard Java EE web application security mechanisms offered by the servlet container and configurable via application's web.xml descriptor. It's a custom authentication. Authenticating a user with their username and password and issuing a token Create a JAX-RS resource method which receives and validates the credentials (username and password) and issue a token for the user: @Path("/authentication") public class AuthenticationEndpoint { @POST @P…
has comment: http://stackoverflow.com/comment/99297008
has comment: http://stackoverflow.com/comment/116129613

http://stackoverflow.com/a/26867500
type: Answer
downvote count: 0
has body: On report right click and Properties > +More under the Properties > Add this parameters; net.sf.jasperreports.export.xls.ignore.graphics = false and on Jasper Server : jasperreports-server-cp-5.0.0/apache-tomcat/webapps/jasperserver/WEB-INF/classes/jasperreports.properties add this parameter; net.sf.jasperreports.export.xls.ignore.graphics = false
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26801946
answers question: http://stackoverflow.com/q/26801946

http://stackoverflow.com/comment/42060737
score: 1
has text: archiveClasses only packages your classes into a jar and places it to the /lib of your target. It will not install it in your local repo however. According to the plugin documentation "you can deploy the classes and resources included in your webapp as an 'attached' artifact". You may try it by also using attach-classes in addition to archiveClasses
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26735518

http://stackoverflow.com/q/26826455
tagged with: methods
has answer: http://stackoverflow.com/a/26826564
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: roman-numerals
accepted answer: http://stackoverflow.com/a/26826564
tagged with: return
upvote count: 1
has title: How do I reprompt to allow user to continue converting values?
type: AnsweredQuestion
score: 1
tagged with: java
has body: I need to convert a numeric value to roman numerals and I'm having some trouble. When I test my code and a user inputs a number, the code converts it to a roman numeral, but I can't get the prompt to appear again afterwards; it reprompts fine after an incorrect integer is placed, but not after a correct one. I'm not sure how to make it so that the user can continue converting values until they choose -1 to quit. Below is what I have come up with thus far. import java.util.Scanner; public class arabicToRoman { static String a = ""; public static void main (String[] args){ Scanner input = new Scanner(System.in); System.out.println("Enter a number between 1 and 3999 (-1 to quit): "); while (!input.hasNext("-1")) { String a = input.next(); try { Integer number = Integer.parseInt(a); if ((number &lt;= 3999) &amp;&amp; (number &gt; 0)) { System.out.println(arabicToRoman(number)); } else if (number &gt; 3999) { System.out.println("Error: number must be between 1 and 3999"); } else if (number == 0) { System.out.println("Error: The Romans did not have a way to represent negative numbers or zero."); } else { System.out.println("Error: The Romans did not have a way to represent negative numbers or zero."); } } catch (NumberFormatException e) { System.out.println("You did not enter a number!"); } } } public static String arabicToRoman(int arabic) { while (arabic &gt;= 1000){ a += "M"; arabic -= 1000; } while (arabic &gt;= 900){ a += "CM"; arabic -= 900; } while (arabic &gt;= 500){ a += "D"; arabic -= 500; } while (arabic &gt;= 400){ a += "CD"; arabic -= 400; } while (arabic &gt;= 100){ a += "C"; arabic -= 100; } while (arabic &gt;= 90){ a += "XC"; arabic -= 90; } while (arabic &gt;= 50){ a += "L"; arabic -= 50; } while (arabic &gt;= 40){ a += "XL"; arabic -= 40; } while (arabic &gt;= 10){ a += "X"; arabic -= 10; } while (arabic &gt;= 9){ a += "IX"; arabic -= 10; } while (arabic &gt;= 5){ a += "V"; arabic -= 5; } while (arabic &gt;= 4){ a += "IV"; arabic -= 4; } while (arabic &g…
tagged with: loops

http://stackoverflow.com/comment/42130276
score: 0
has text: **A** Which API do you use for PDF processing? ... **B** Please also show the stack trace of the exception.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26769074

http://stackoverflow.com/q/26825383
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42219344
accepted answer: http://stackoverflow.com/a/26825577
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/26825577
type: Question
has comment: http://stackoverflow.com/comment/42219324
has body: I have a file that has data inside of it. In my main method I read in the file and closed the file. I call another method that created a new file inside of the same folder of the original file. So now I have two files, the original file and the file that is being made from the method that I call. I need another method that takes the data from the original file and writes it to the new file that is created. How do I do that? import java.io.*; import java.util.Scanner; import java.util.*; import java.lang.*; public class alice { public static void main(String[] args) throws FileNotFoundException { String filename = ("/Users/DAndre/Desktop/Alice/wonder1.txt"); File textFile = new File(filename); Scanner in = new Scanner(textFile); in.close(); newFile(); } public static void newFile() { final Formatter x; try { x = new Formatter("/Users/DAndre/Desktop/Alice/new1.text"); System.out.println("you created a new file"); } catch (Exception e) { System.out.println("Did not work"); } } private static void newData() { } }
upvote count: 2
has title: Taking data from one text file and moving it to a new text file

http://stackoverflow.com/q/26755421
has comment: http://stackoverflow.com/comment/42108264
type: Question
has comment: http://stackoverflow.com/comment/42093208
upvote count: 0
has comment: http://stackoverflow.com/comment/42093250
downvote count: 4
has answer: http://stackoverflow.com/a/26755566
has body: I want to forward from current activity to other Activity. But when i click the button i am not able to perform it.I want to move from MainActivity to FeedActivity Please tell what is fault in my code. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.sample.test.MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginLeft="53dp" android:layout_marginTop="92dp" android:text="Button" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/button1" android:layout_marginLeft="20dp" android:layout_toRightOf="@+id/button1" android:text="@string/button2" /&gt; &lt;/RelativeLayout&gt; MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button) findViewById(R.id.button1); Button btn2 = (Button) findViewById(R.id.button2); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Toast.makeText(getApplicationContext(), "Welcome to android by Vivek", Toast.LENGTH_LONG) .show(); } }); btn2.setOnClickListener(new OnClickListener() { public void onClick(View view) { Intent intent = new …
has comment: http://stackoverflow.com/comment/42093336
answer count: 1
has comment: http://stackoverflow.com/comment/42093942
has comment: http://stackoverflow.com/comment/42093283
favorite count: 0
has comment: http://stackoverflow.com/comment/42099849
score: -4
tagged with: android
has title: Android intent to other Activity
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/26755566
has comment: http://stackoverflow.com/comment/42093447
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42093347
tagged with: java

http://stackoverflow.com/q/26794908
tagged with: servlets
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/26795298
has title: Servlet URL pattern match with slash prefix
has body: I have the servlet annotation as: @WebServlet (name="PageServlet", urlPatterns={"*.zt"}) zt is the file extension I am using. However if I use @WebServlet (name="PageServlet", urlPatterns={"/*.zt"}) It does not match the URL such as /app/index.zt , nor /app/foo/test.zt... How can I match only the zt files under root /app/?
has answer: http://stackoverflow.com/a/26795222
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26795222
tagged with: java
possible better answer: http://stackoverflow.com/a/26795298

http://stackoverflow.com/comment/42192808
has text: Credit where due, this possibility was pointed out by @Pokechu22 while I was writing my answer.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26810141
score: 1

http://stackoverflow.com/comment/42219907
type: Comment
comment on: http://stackoverflow.com/a/26825458
has text: I completely do not agree to not use `setPreferredSize()` in JFrame. Because in whatever way jframe lays out components, but if you need to jframe of your custom dimensions, then thats only better way.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42035836
type: Comment
comment on: http://stackoverflow.com/a/26722706
has text: Thanks! That worked! I also had an error at the bottom of the do while where I was putting the data into the Person obj even if it was incorrect. Didn't realize that wasn't included in the try block. All works now!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42208591
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26818291
type: Comment
has text: true, the method `public void payMembership()` is being executed only one time... but no errors shown :( i must investigate more...

http://stackoverflow.com/q/26800771
has comment: http://stackoverflow.com/comment/42176652
score: 0
has answer: http://stackoverflow.com/a/26801015
answer count: 1
type: UnansweredQuestion
has title: Which Map data structure in Java for getting highest element most efficiently?
tagged with: java
has comment: http://stackoverflow.com/comment/42175651
type: Question
tagged with: data-structures
has body: TreeMap has O(log n) performance (best case), however, since I need the following operations efficiently: get the highest element get XY highest elements insert Other possibility would be to make a PriorityQueue with the following: use "index" element as order for PriorityQueue equals implementation to check only "index" element equality but this would be a hack since "equals" method would be error prone (if used outside of PriorityQueue). Any better structure for this? More details below which you might skip since the first answer provided good answer for this specifics, however, I'm keeping it active for the theoretical discussion. NOTE: I could use non standard data structures, in this project I'm already using UnrolledLinkedList since it most likely would be the most efficient structure for another use. THIS IS USE CASE (in case you are interesting): I'm constructing AI for a computer game where OffensiveNessHistory myOffensiveNess = battle.pl[orderNumber].calculateOffensivenessHistory(); With possible implementations: public class OffensiveNessHistory { PriorityQueue&lt;OffensiveNessHistoryEntry&gt; offensivenessEntries = new PriorityQueue&lt;OffensiveNessHistoryEntry&gt;(); .. or public class OffensiveNessHistory { TreeMap&lt;Integer, OffensiveNessHistoryEntry&gt; offensivenessEntries = new TreeMap(); .. I want to check first player offensiveness and defensiveness history to calculate the predict if I should play the most offensive or the most defensive move.

http://stackoverflow.com/a/26757448
has comment: http://stackoverflow.com/comment/42165693
has body: I would take "ScrollintoView" any day. It will scroll and check for the element simultaneously and halt when it has the element on view For help with the code, please follow this link
answers question: http://stackoverflow.com/q/26729532
has comment: http://stackoverflow.com/comment/42104455
has comment: http://stackoverflow.com/comment/42165509
downvote count: 0
has comment: http://stackoverflow.com/comment/42165390
type: Answer
has comment: http://stackoverflow.com/comment/42165656
score: 1
has comment: http://stackoverflow.com/comment/42169558
upvote count: 1
has comment: http://stackoverflow.com/comment/42097770

http://stackoverflow.com/comment/41982240
has text: `String` is `final`, meaning that it is immutable. Changing the text, creates a new object.
comment on: http://stackoverflow.com/q/26693369
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42080667
has text: @Gangadi Edited to use Arrays instead of ArrayLists
type: Comment
comment on: http://stackoverflow.com/a/26746678
score: 0
type: AnswerComment

http://stackoverflow.com/q/26739865
answer count: 3
has comment: http://stackoverflow.com/comment/42065799
has title: How to increment an integer by reference?
has answer: http://stackoverflow.com/a/26739997
tagged with: reference
tagged with: integer
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/26739997
has comment: http://stackoverflow.com/comment/42065850
has comment: http://stackoverflow.com/comment/42065625
linked to: http://stackoverflow.com/q/40480
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42065765
has body: Is it possible to increment an integer value by reference? int counterA = 0; int counterB = 0; int counter = (condition) ? counterA : counterB; //use counter counter++; Result: both counterA + counterB will remain = 0, instead being incremented.
has answer: http://stackoverflow.com/a/26739953
tagged with: java
accepted answer: http://stackoverflow.com/a/26739953
type: Question
has answer: http://stackoverflow.com/a/26740234
downvote count: 0
has comment: http://stackoverflow.com/comment/42065957

http://stackoverflow.com/comment/42210005
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26820190
type: AnswerComment
has text: But you can choose a primitive array as the type argument, which seems to be what he's trying to pass in (not just a primitive value, but an array object full of primitives, which is allowed in generics). If you want, check out my comment and steal the answer if you please

http://stackoverflow.com/comment/42228719
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26830830
has text: @VinceEmigh: If it were *me*, I would just stay away from the entire term, I don't think it's useful. That said, to me the definition you're implying would be a better fit for how I think of it than the one in the OP's question. There's no question that there are things you can do with classes that you can't do with primitives, so...

http://stackoverflow.com/comment/42155683
type: Comment
has text: @LuiggiMendoza You're right, but that is also the normal behavior of an array. So the danger is that it breaks expectations of the List abstraction.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26789590

http://stackoverflow.com/comment/42107735
type: QuestionComment
score: 0
has text: Need a few more pieces of info to help: show how you're generating the ID for these classes (post your baseentity class), show how you're persisting and retrieving the data
comment on: http://stackoverflow.com/q/26763213
type: Comment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/26764260
tags question: http://stackoverflow.com/q/26730873
tag name: google-oauth

http://stackoverflow.com/a/26737792
type: Answer
has comment: http://stackoverflow.com/comment/47520369
score: 0
has body: you can try to use the The positional $ operator. This is an exemple using your collection : db.Order.update({itemId : "A1", 'items.itemId' : "i001"}, {$inc : {'items.itemId.$.qty' : 10}}); but be careful to only use it with an update query vecause it doesn't work with an upsert
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26730758
answers question: http://stackoverflow.com/q/26730758

http://stackoverflow.com/q/26831043
tagged with: listview
has comment: http://stackoverflow.com/comment/42228901
has comment: http://stackoverflow.com/comment/42228940
has comment: http://stackoverflow.com/comment/42229366
has comment: http://stackoverflow.com/comment/42661861
has answer: http://stackoverflow.com/a/26831308
has body: Rewrote the entire question. Here's a reduced example of what I am trying to do. I have a listview with a custom adapter. Each row generated by the adapter has multiple textviews. On two of the textviews, a longclick will generate a dialog. Whereas in the other view, nothing is done. On all 3 views, if I click on them. The listview's onitemclick should be fired. I hope this reduced example will help someone understand better what I am trying to achieve and a solution could be proposed. The problem with the code (If you try it yourself), is that onitemclick is not fired for the two textviews which has an onlongclicklistener implemented. Anyone has any clue how to get onitemclick to fire for those two textviews? Thanks. I have a listview with a custom arrayadapter: public class TestListView extends ListView{ final Context mContext; List&lt;String&gt; list = new ArrayList&lt;String&gt;(); public TestListView(Context context, AttributeSet attrs) { super(context, attrs); this.mContext = context; list.add("Blue"); list.add("Green"); list.add("Red"); list.add("Black"); MyArrayAdapter adapter = new MyArrayAdapter(context, 0, list); this.setAdapter(adapter); this.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view,int position, long id) { Log.i("ApplicationName", "onItemClick " + position); Intent intent = new Intent(mContext, MainActivity.class); mContext.startActivity(intent); } }); } private class MyArrayAdapter extends ArrayAdapter&lt;String&gt; { Context context; HashMap&lt;String, Integer&gt; mIdMap = new HashMap&lt;String, Integer&gt;(); public MyArrayAdapter(Context context, int textViewResourceId, List&lt;String&gt; objects) { super(context, textViewResourceId, objects); this.context = context; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_…
has answer: http://stackoverflow.com/a/29665469
type: Question
tagged with: android-listview
tagged with: android
has title: Android listview setOnItemClickListener and textview setOnLongClickListener together?
has comment: http://stackoverflow.com/comment/42228829
score: 0
has comment: http://stackoverflow.com/comment/42663310
answer count: 3
has comment: http://stackoverflow.com/comment/42512420
tagged with: android-layout
has comment: http://stackoverflow.com/comment/42229474
tagged with: java
has answer: http://stackoverflow.com/a/26831183
type: UnansweredQuestion

http://stackoverflow.com/comment/42067009
type: Comment
has text: @carlspring unfortunately it's not possible to do this directly on Set you have to include it in your own class.
comment on: http://stackoverflow.com/a/26740432
type: AnswerComment
score: 0

http://stackoverflow.com/q/26741733
has comment: http://stackoverflow.com/comment/42069357
has title: Property and Field in Java way
type: Question
tagged with: computer-science
duplicate of: http://stackoverflow.com/q/70471
has comment: http://stackoverflow.com/comment/42069414
has comment: http://stackoverflow.com/comment/42069321
has comment: http://stackoverflow.com/comment/42070027
linked to: http://stackoverflow.com/q/70471
has body: Is it correct to assume that Property in Java it is simple getter and setter?
downvote count: 6
has comment: http://stackoverflow.com/comment/42069310
has comment: http://stackoverflow.com/comment/42069367
has comment: http://stackoverflow.com/comment/42069496
linked to: http://stackoverflow.com/q/10115588
answer count: 2
has answer: http://stackoverflow.com/a/26742547
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26741903
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42069293
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/42069256

http://stackoverflow.com/q/26704334
type: AnsweredQuestion
tagged with: java
tagged with: naming
accepted answer: http://stackoverflow.com/a/26704399
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42001944
has comment: http://stackoverflow.com/comment/42001784
favorite count: 0
has body: I'm currently writing a program involving random card selection and I'm wondering if there is a way to get the program to replace the numbers 11, 12, and 13 with jack, queen and king respectively? I could use an if statement to detect values greater than 10 but that would force me to write the same code around 4 times which seems counterproductive. Any and all responses greatly appreciated! int card0 = (cardGenerator.nextInt(13) + 2); int winTest = 4; while(winTest &gt; 0) { Object[] highLowEqual = { "higher", "lower", "equal", "Quit" }; Object userChoice = JOptionPane.showInputDialog(null, "The current card is " + card0 + ". Which do you think the next card will be? Remember: Ace is the highest possible.", "HiLo", JOptionPane.INFORMATION_MESSAGE, null, highLowEqual, highLowEqual[0]); int card1 = (cardGenerator.nextInt(13) + 2);
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/26704399
has title: Assigning a name to a number
upvote count: 1
possible better answer: http://stackoverflow.com/a/26704426
downvote count: 1
has answer: http://stackoverflow.com/a/26704426

http://stackoverflow.com/a/26798844
upvote count: 1
has body: make sure while you 're exporting the project , to check the export files and resources , not only the java classes
answers question: http://stackoverflow.com/q/26798731
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26798731
type: Answer
has comment: http://stackoverflow.com/comment/42171717

http://stackoverflow.com/comment/41950412
comment on: http://stackoverflow.com/a/26675168
type: Comment
score: 0
type: AnswerComment
has text: Actually I do not get OOM exception, but on production from time to time tomcat starts to use 99% cpu load and not responsing anymore.

http://stackoverflow.com/comment/42084927
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26750210
type: Comment
has text: After modifying a few things I found that setting the termination condition to being just s.length() <= 1 and dealing with the 'a' and 'A' inside was best, and for the case of the substring turning up null the recursive method should pass (i + 1). Your code was very helpful by the way, thanks again!

http://stackoverflow.com/a/26791104
has body: I haven't used this before, but my guess is you need to use ${ctsDictionary[status.index-1] instead of ${cts[status.index-1] because cts is only the current item.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26791070
answers question: http://stackoverflow.com/q/26791070
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42053524
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26730575
has text: Yes, i know where to load it from. But i don't know how to load it to pass ClassNotFoundException to readObject

http://stackoverflow.com/comment/42195949
score: 0
type: AnswerComment
has text: As I said, it's untested, so probably. I'm not exclusively a Java dev, so I might miss some of the finer details.
type: Comment
comment on: http://stackoverflow.com/a/26811776

for-loop
tags question: http://stackoverflow.com/q/26781536
tags question: http://stackoverflow.com/q/26725341
tags question: http://stackoverflow.com/q/26720731
tags question: http://stackoverflow.com/q/26716771
tags question: http://stackoverflow.com/q/26732846
tags question: http://stackoverflow.com/q/26802423
tags question: http://stackoverflow.com/q/26790854
tags question: http://stackoverflow.com/q/26759954
tags question: http://stackoverflow.com/q/26830947
tags question: http://stackoverflow.com/q/26794488
tags question: http://stackoverflow.com/q/26742867
tag name: for-loop
tags question: http://stackoverflow.com/q/26734240
tags question: http://stackoverflow.com/q/26773403
tags question: http://stackoverflow.com/q/26723504
tags question: http://stackoverflow.com/q/26817047
tags question: http://stackoverflow.com/q/26820620
tags question: http://stackoverflow.com/q/26817013
tags question: http://stackoverflow.com/q/26808858
tags question: http://stackoverflow.com/q/26763109
tags question: http://stackoverflow.com/q/26707639
tags question: http://stackoverflow.com/q/26816474
tags question: http://stackoverflow.com/q/26720071
tags question: http://stackoverflow.com/q/26823168
tags question: http://stackoverflow.com/q/26700742
tags question: http://stackoverflow.com/q/26774087
type: Tag
tags question: http://stackoverflow.com/q/26796138
tags question: http://stackoverflow.com/q/26808062
tags question: http://stackoverflow.com/q/26795100
tags question: http://stackoverflow.com/q/26809588
tags question: http://stackoverflow.com/q/26692795
tags question: http://stackoverflow.com/q/26783278
tags question: http://stackoverflow.com/q/26718580
tags question: http://stackoverflow.com/q/26805754

http://stackoverflow.com/q/26761717
tagged with: apache
has body: I want to run cmd.exe commands from java (for example md C:\blabla to create a new directory C:\blabla ) My code looks like this and it runs without any errors: import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; public class Test { public static void main(String[] args) throws ExecuteException, IOException { CommandLine cmdLine = new CommandLine("cmd.exe"); cmdLine.addArgument("md"); cmdLine.addArgument("C:\\blabla"); DefaultExecutor executor = new DefaultExecutor(); executor.execute(cmdLine); } } But if I go to C:\ there is no folder blabla as I would expect, since manually typing md C:\blabla in cmd.exe works fine. I also tried "C:\Windows\System32\cmd.exe" instead of "cmd.exe" but no use. The output in the Console looks like this: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Selphiron\workspace\Test> Where is the mistake?
score: 0
answer count: 1
tagged with: cmd
tagged with: apache-commons-exec
type: AnsweredQuestion
tagged with: java
has title: running simple cmd.exe commands with apache commons exec
has answer: http://stackoverflow.com/a/26761816
accepted answer: http://stackoverflow.com/a/26761816
type: Question

jersey-2.0
tags question: http://stackoverflow.com/q/26738564
tags question: http://stackoverflow.com/q/26794176
type: Tag
tags question: http://stackoverflow.com/q/26829456
tags question: http://stackoverflow.com/q/26752880
tags question: http://stackoverflow.com/q/26748646
tags question: http://stackoverflow.com/q/26715130
tags question: http://stackoverflow.com/q/26696880
tags question: http://stackoverflow.com/q/26689104
tags question: http://stackoverflow.com/q/26697880
tags question: http://stackoverflow.com/q/26787511
tags question: http://stackoverflow.com/q/26751854
tags question: http://stackoverflow.com/q/26675967
tags question: http://stackoverflow.com/q/26763039
tags question: http://stackoverflow.com/q/26777083
tags question: http://stackoverflow.com/q/26702196
tag name: jersey-2.0
tags question: http://stackoverflow.com/q/26796363

http://stackoverflow.com/a/26828758
type: AcceptedAnswer
downvote count: 0
has body: Try to use interrupt method to fully stop the thread instead of cancel : newThread.interrupt(); Note that if you interrupt the Thread in onPause/onStop, you might need to create the thread again in onRestart/onStart.
type: Answer
answers question: http://stackoverflow.com/q/26828735
score: 4
accepted answer of: http://stackoverflow.com/q/26828735
upvote count: 4

http://stackoverflow.com/a/26809780
answers question: http://stackoverflow.com/q/26806249
score: 0
has body: If it is the UnknownHostException you want to get rid of, that would be by assigning a valid IP address. Example follows: addr = InetAddress.getByName("192.168.85.67"); See Javadocs for more information regarding the format.
type: Answer

http://stackoverflow.com/comment/42214436
score: 0
has text: [This thread](http://stackoverflow.com/questions/998737/integrating-tomcat-and-eclipse-as-a-hot-deploy-environment) seem to be doing somewhat what you ask for, but it's kind of hard to know your setup over there, how you did to run it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26822505

http://stackoverflow.com/q/26789125
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26789398
score: 1
tagged with: java
type: Question
has title: Start another thread after SwingWorker completes in Java
answer count: 2
tagged with: swingworker
downvote count: 0
has comment: http://stackoverflow.com/comment/42154708
possible better answer: http://stackoverflow.com/a/26789398
has comment: http://stackoverflow.com/comment/42154680
favorite count: 0
has answer: http://stackoverflow.com/a/26789178
accepted answer: http://stackoverflow.com/a/26789178
has body: I know there many questions on SO but non of them has good enough answer and before asking here I googled a lot specially SO but nothing could make it clear. I just simply wants to start my other thread when my SwingWorker finish its work. I want to start a timer when the SwingWorker finishes it's work but cannot figure out how. class createGUI extends SwingWorker&lt;Void, Void&gt; { @Override protected Integer doInBackground() throws Exception { //Some long processing } @Override protected void done() { //Doing GUI work here prgBar.setInderminent(false); } } //Starts a progressBar and calls createGUI(); prgBar.setInderminent(true); new createGUI().execute(); Now there is another startTimer Thread which I want to start when this SwingWork finishes. public class startTimer implements Runnable { @Override public void run() { while(true) { Thread.sleep(1000); //Update Database } } } But I don't understand how can I do so?
has comment: http://stackoverflow.com/comment/42154808
tagged with: multithreading
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/26825650
tagged with: string
has answer: http://stackoverflow.com/a/26831278
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27401198
has answer: http://stackoverflow.com/a/26825685
has answer: http://stackoverflow.com/a/26825687
has answer: http://stackoverflow.com/a/26825682
upvote count: 1
type: Question
score: 1
tagged with: java
has body: For instance, if I have the string "Bob Bakes Brownies", is there any way I can get this method to produce a list of three strings: "Bob", "Bob Bakes", and "Bob Bakes Brownies" Any feed back would be appreciated.
has answer: http://stackoverflow.com/a/26825699
has title: return List<String> from string that can be split by words and then appended in Java
tagged with: split
has comment: http://stackoverflow.com/comment/42219720
has answer: http://stackoverflow.com/a/26826224
downvote count: 0
answer count: 7

http://stackoverflow.com/comment/42087751
has text: how long does it take with this method?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26751971

http://stackoverflow.com/q/26673885
favorite count: 0
has answer: http://stackoverflow.com/a/26681036
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41954728
tagged with: java
accepted answer: http://stackoverflow.com/a/26681036
has title: use regular expression to prase specified protocol
has comment: http://stackoverflow.com/comment/41954057
upvote count: 0
has comment: http://stackoverflow.com/comment/41959530
type: Question
has body: My server receive a message like #1037szdx001A8911*,now I need to get szdx001 called sid The length of sid is decided by the character 7. The length will be 8 or 9 ． It is easy to use String.substring() to get the length first. Then I will get the sid according to the length. But Now I try to use regular expression.Here is my pattern． #(\\d)(\\d{2})(\\d)(\\w{7})(\\w)(\\d{4})* My Problem is that how I can replace 7 with the following group in java grammar.
type: AnsweredQuestion
tagged with: regex
score: -1

http://stackoverflow.com/q/26715965
score: -1
type: Question
has answer: http://stackoverflow.com/a/26716917
answer count: 2
tagged with: mobile
has answer: http://stackoverflow.com/a/26716046
favorite count: 0
tagged with: android
has title: how can i go back in android development
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: my android app has 5 pages. page1->pag2->pag3->pag4->pag5. i need to create a button on page 5 to go directly page2. can use Intent object. but then if i press back(phone back button) again it will come to page 5. please help me. public void onClick(View v) { Intent itn = new Intent(page5.this,page2.class); startActivity(itn); }
tagged with: session
tagged with: java

http://stackoverflow.com/q/26706878
tagged with: websphere
answer count: 1
has comment: http://stackoverflow.com/comment/42011467
has comment: http://stackoverflow.com/comment/42321469
has answer: http://stackoverflow.com/a/30022034
has title: PMI client SOAP error
score: 0
tagged with: soap
has comment: http://stackoverflow.com/comment/42319347
has body: I have been trying to create a JAVA PMI Client for remote monitoring of the IBM WebSphere Application server(v 6.0). The points to condider prior to any discussions are: 1. Security has been enabled under global security. 2. I am using IBM java hopefully(downloaded the trail client from IBM). 3. Copied the certificates from remote server to my local PMI client location. 4. Ports connectivity checked. The problem: When trying to create the connection the error returned is: java.lang.NoSuchMethodError: com/ibm/ws/management/AdminHelper.getPlatformHelper()Lcom/ibm/ws/util/PlatformHelper; at com.ibm.ws.management.connector.soap.SOAPConnectorClient.setupSslSetting(SOAPConnectorClient.java:1103) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.access$100(SOAPConnectorClient.java:94) at com.ibm.ws.management.connector.soap.SOAPConnectorClient$1.run(SOAPConnectorClient.java:249) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:247) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.(SOAPConnectorClient.java:188) Any help would be appreciated. Thanks and Regards, Kunal Soni
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42042078
type: Question
has comment: http://stackoverflow.com/comment/42042116
tagged with: java
has comment: http://stackoverflow.com/comment/42007040

spring
tags question: http://stackoverflow.com/q/26733704
tags question: http://stackoverflow.com/q/26771064
tags question: http://stackoverflow.com/q/26791323
tags question: http://stackoverflow.com/q/26702568
tags question: http://stackoverflow.com/q/26782414
tags question: http://stackoverflow.com/q/26803277
tags question: http://stackoverflow.com/q/26774131
tags question: http://stackoverflow.com/q/26745801
tags question: http://stackoverflow.com/q/26754060
tags question: http://stackoverflow.com/q/26677890
tags question: http://stackoverflow.com/q/26761870
tags question: http://stackoverflow.com/q/26731081
tags question: http://stackoverflow.com/q/26750738
tags question: http://stackoverflow.com/q/26716050
tags question: http://stackoverflow.com/q/26762559
tags question: http://stackoverflow.com/q/26751883
tags question: http://stackoverflow.com/q/26744789
tags question: http://stackoverflow.com/q/26815299
tags question: http://stackoverflow.com/q/26782436
tags question: http://stackoverflow.com/q/26740310
tags question: http://stackoverflow.com/q/26810962
tags question: http://stackoverflow.com/q/26676405
tags question: http://stackoverflow.com/q/26698071
tags question: http://stackoverflow.com/q/26747121
tags question: http://stackoverflow.com/q/26690867
tags question: http://stackoverflow.com/q/26723788
tags question: http://stackoverflow.com/q/26777627
tags question: http://stackoverflow.com/q/26774494
tags question: http://stackoverflow.com/q/26729310
tags question: http://stackoverflow.com/q/26777207
tags question: http://stackoverflow.com/q/26767993
tags question: http://stackoverflow.com/q/26715026
tags question: http://stackoverflow.com/q/26737402
tags question: http://stackoverflow.com/q/26819832
tags question: http://stackoverflow.com/q/26727036
tags question: http://stackoverflow.com/q/26740345
tags question: http://stackoverflow.com/q/26736716
tags question: http://stackoverflow.com/q/26740489
tags question: http://stackoverflow.com/q/26693126
tags question: http://stackoverflow.com/q/26800170
tags question: http://stackoverflow.com/q/26816568
tags question: http://stackoverflow.com/q/26679768
tags question: http://stackoverflow.com/q/26709332
tags question: http://stackoverflow.com/q/26757690
tags question: http://stackoverflow.com/q/26719981
tags question: http://stackoverflow.com/q/26793336
tags question: http://stackoverflow.com/q/26820785
tags question: http://stackoverflow.com/q/26752213
tags question: http://stackoverflow.com/q/26697880
tags question: http://stackoverflow.com/q/26744060
tags question: http://stackoverflow.com/q/26736331
tags question: http://stackoverflow.com/q/26712935
tags question: http://stackoverflow.com/q/26829281
tags question: http://stackoverflow.com/q/26743299
tags question: http://stackoverflow.com/q/26800131
tags question: http://stackoverflow.com/q/26794198
tags question: http://stackoverflow.com/q/26687588
tags question: http://stackoverflow.com/q/26752994
tags question: http://stackoverflow.com/q/26714607
tags question: http://stackoverflow.com/q/26744914
tags question: http://stackoverflow.com/q/26814958
tags question: http://stackoverflow.com/q/26738219
tags question: http://stackoverflow.com/q/26746680
tags question: http://stackoverflow.com/q/26693708
tags question: http://stackoverflow.com/q/26743756
tags question: http://stackoverflow.com/q/26769989
type: Tag
tags question: http://stackoverflow.com/q/26796687
tags question: http://stackoverflow.com/q/26828175
tags question: http://stackoverflow.com/q/26828610
tags question: http://stackoverflow.com/q/26730388
tags question: http://stackoverflow.com/q/26778800
tags question: http://stackoverflow.com/q/26801901
tags question: http://stackoverflow.com/q/26702145
tags question: http://stackoverflow.com/q/26739738
tags question: http://stackoverflow.com/q/26679171
tags question: http://stackoverflow.com/q/26716458
tags question: http://stackoverflow.com/q/26709389
tags question: http://stackoverflow.com/q/26792824
tags question: http://stackoverflow.com/q/26817902

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/26735997

http://stackoverflow.com/q/26765423
answer count: 2
possible better answer: http://stackoverflow.com/a/26786063
upvote count: 1
tagged with: google-api-client
favorite count: 0
has title: Not regonize the createRequestFactory() method for the type HttpTransport
has body: I start working with FreeBase api so I only copy the following code from this page but I got the following error: The method createRequestFactory() is undefined for the type HttpTransport from this line of the sample code: (HttpRequestFactory requestFactory = httpTransport.createRequestFactory()). I try to find the problem but I could not. import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.jayway.jsonpath.JsonPath; import java.io.FileInputStream; import java.util.Properties; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; public class TopicSample { public static Properties properties = new Properties(); public static void main(String[] args) { try { properties.load(new FileInputStream("freebase.properties")); HttpTransport httpTransport = new NetHttpTransport(); HttpRequestFactory requestFactory = httpTransport.createRequestFactory(); JSONParser parser = new JSONParser(); String topicId = "/en/bob_dylan"; GenericUrl url = new GenericUrl("https://www.googleapis.com/freebase/v1/topic" + topicId); url.put("key", properties.get("API_KEY")); HttpRequest request = requestFactory.buildGetRequest(url); HttpResponse httpResponse = request.execute(); JSONObject topic = (JSONObject)parser.parse(httpResponse.parseAsString()); System.out.println(JsonPath.read(topic,"$.property['/type/object/name'].values[0].value").toString()); } catch (Exception ex) { ex.printStackTrace();}}} I do not know what should I do to solve this problem.
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26805427
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26805427
has answer: http://stackoverflow.com/a/26786063
tagged with: freebase

http://stackoverflow.com/q/26804746
has comment: http://stackoverflow.com/comment/42183584
tagged with: java
has answer: http://stackoverflow.com/a/26805002
has body: I want to get a String from a website, and convert it to a Array. It is working in eclipse, but if I want to use it in an Android-App it wont work. I know, it must be a stupid mistake but I dont know where it is. InternetHandler: package de.blender4me.einkaufsliste; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.regex.Pattern; public class internetHandler { //Einkaufsplaner-API aufrufen public static String[] getList(){ InputStream is = null; try { URL url = new URL("https://einkaufsplaner.blender4me.de/api.php?name=Username&amp;pass=SuperSecretPass&amp;addValue=&amp;removeValue="); BufferedReader in = new BufferedReader( new InputStreamReader(url.openStream())); String Values = null; for(int i = 0; i &lt; 4; ++i){ Values = in.readLine(); } in.close(); String[] List = Values.split( Pattern.quote( ";" ) ); return List; } catch ( Exception e ) { e.printStackTrace(); } finally { if ( is != null ) try { is.close(); } catch ( IOException e ) { } } String[] error = {"error"}; return error; } } Main package de.blender4me.einkaufsliste; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; public class MainActivity extends Activity { //Widgets Button addItem; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //listView populateListView(); //register Widgets addItem =(Button) findViewById(R.id.addItem); addItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openDialog(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; t…
type: Question
linked to: http://stackoverflow.com/q/12849014
tagged with: bufferedreader
has title: Android - InputStreamReader not working
answer count: 2
tagged with: sdk
downvote count: 0
has answer: http://stackoverflow.com/a/26805010
accepted answer: http://stackoverflow.com/a/26805010
possible better answer: http://stackoverflow.com/a/26805002
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42182697
tagged with: android
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/26823296
possible better answer: http://stackoverflow.com/a/26823320
has title: Using exceptions for user error
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26823532
type: AnsweredQuestion
tagged with: java
has body: I'm working on an IRC bot that should handle some user commands, lets take !login &lt;username&gt; &lt;password&gt; for example. Sometimes the user forgets to enter their password, so instead of sending !login myUser hunter2 they might use !login myUser. In this case, the user should be replied to with an error message. The method that actually handles the command handleCommand is always wrapped by another method wrapperMethod. Which of the following ways should I use to handle user errors: should handleCommand just message the user about what happened and exit itself, or should it throw an exception with the error message and let wrapperMethod do the rest? (String[] command is the original command without the ! and split by spaces, so !login myUser hunter2 would become {"login", "myUser", "hunter2"}) Using exceptions: public void wrapperMethod(Object sender, Object receiver, String[] command) { try { handleCommand(sender, receiver, command); catch(CommandExecutionException e) { receiver.sendTo(sender, e.getMessage()); } } private void handleCommand(Object sender, Object receiver, String[] command) { if(command.length != 3) throw new CommandExecutionException("Things went wrong"); //Do things } Not using exceptions: public void wrapperMethod(Object sender, Object receiver, String[] command) { handleCommand(sender, receiver, command); } private void handleCommand(Object sender, Object receiver, String[] command) if(command.length != 3) { receiver.sendTo(sender, "Things went wrong"); return; } //Do things } Which type should I prefer and why? Right now, I'm thinking of going with exceptions simply because I can save a few lines of code that I really don't need. When a user error is detected, handleCommand is always halted immediately. There's also the possiblility of having handleCommand return Optional&lt;Error&gt; or something like that, but this seems really fishy.
type: Question
has answer: http://stackoverflow.com/a/26823320
has answer: http://stackoverflow.com/a/26823532

http://stackoverflow.com/comment/42544458
type: AnswerComment
has text: @Courtney I'm not sure whether you're still working on this. I guess I'm rather late to the party. But the formula you quoted for the angles (four comments above this one) is not correct. To figure out the angles once you have the lengths, you need something called the "cosine rule" or "cosine law". I suggest you google this.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26819976

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/26819788
tags question: http://stackoverflow.com/q/26777338
tags question: http://stackoverflow.com/q/26797194

http://stackoverflow.com/a/26814439
score: 2
has body: Try adding an alias for idPerfil: criteria.createAlias("idPerfil", "idp"); and then reference it in your projection: proList.add(Projections.property("idp.idPerfil"), "idPerfil"); Then remove the transformer: criteria.setResultTransformer(Transformers.aliasToBean(User.class)); and change the result to: List list = criteria.list(); Each element in the list will be an Object[] array: for(Object data : list) { Object[] projection = (Object[]) data; Integer idUser = projection[0]; String user = projection[1]; Integer idPerfil= projection[3]; ... }
downvote count: 0
has comment: http://stackoverflow.com/comment/42271289
upvote count: 2
has comment: http://stackoverflow.com/comment/42268682
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26810900
answers question: http://stackoverflow.com/q/26810900
type: Answer
has comment: http://stackoverflow.com/comment/42268669
has comment: http://stackoverflow.com/comment/42277508

http://stackoverflow.com/q/26792526
has answer: http://stackoverflow.com/a/26946007
answer count: 3
has title: Google Cardboard VR sensors
has comment: http://stackoverflow.com/comment/42451829
tagged with: android
favorite count: 0
has body: I'm using the Google Cardboard (its HeadTracker class) to detect certain things about device rotation in an AR application. It works very well. However, on some devices, it doesn't work (nothing happens). I assume this is because they don't have the necessary sensors. My questions: 1) I want to detect at runtime whether the current device supports the HeadTracker, i.e. it has the necessary sensors available. For this, I need to know which sensors are used by HeadTracker, so that I can query if those sensors are present. What are these sensors? 2) Is there a way to specify the necessary sensors in AndroidManifest? As far as I can see, there is no way. Therefore, if a user downloads my app, the app will have to inform the user at runtime that his device is not supported. This is not nice. Any thoughts?
possible better answer: http://stackoverflow.com/a/28939341
has answer: http://stackoverflow.com/a/28939341
has comment: http://stackoverflow.com/comment/42396004
tagged with: google-cardboard
tagged with: augmented-reality
accepted answer: http://stackoverflow.com/a/26946007
has answer: http://stackoverflow.com/a/36050229
upvote count: 17
type: AnsweredQuestion
tagged with: java
score: 17
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42425348

http://stackoverflow.com/comment/42017157
has text: Linked List is only a collection , you should tell it the type , like how you say `int[]` , an array of type integer , similarly give LinkedList a type parameter such as `LinkedList<Integer>`, or `LinkedList<PrintWriter>` in your case
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26713094

http://stackoverflow.com/comment/42148466
type: Comment
type: QuestionComment
has text: For one, arrays are not resizable in Java; then, why don't you just use `Files.readAllLines()`?
comment on: http://stackoverflow.com/q/26785873
score: 0

http://stackoverflow.com/a/26735956
has comment: http://stackoverflow.com/comment/42058314
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42059444
upvote count: 2
has body: You wrote an AsyncTask class, and you are not using it. Your stack trace shows that you are calling ViewEventsOnMap() from selectItem() on the main application thread, and that you are not using MyAsyncTask anywhere.
has comment: http://stackoverflow.com/comment/42059286
has comment: http://stackoverflow.com/comment/42078702
has comment: http://stackoverflow.com/comment/42059476
accepted answer of: http://stackoverflow.com/q/26735814
has comment: http://stackoverflow.com/comment/42059633
answers question: http://stackoverflow.com/q/26735814
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/111655166
type: Comment
has text: @TechDog I appreciate your example. I was stuck trying to find how to split up lines into words and stream them.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/37120688

http://stackoverflow.com/q/26709967
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I got this request : TypedQuery&lt;ParamGenerauxExternes&gt; q = entityMgr .createQuery("SELECT p FROM ParamGenerauxExternes p " + "WHERE EXISTS " + "(SELECT q FROM ParamGenerauxExternes q " + "WHERE q.key.origine = :pOrigine " + "AND q.key.typeParam LIKE :pTypeParametreBis " + "AND p.key.sousType LIKE CONCAT('%',q.libelleParam) " + "AND q.actif = 'Y') " + "ORDER BY p.libelleParam", ParamGenerauxExternes.class) //.setParameter("pTypeParametre", "REL_TO_HOUSEHOLD") .setParameter("pOrigine", pOrigineGrc) .setParameter("pTypeParametreBis", "GRC_HOUSEHOLD_TYPE_P%"); But it doesn't work, I got this error message that tell a prenthesis is missing : GRAVE: EJB Exception: : javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: ORA-00907: missing right parenthesis The generated SQL by JPA has a parenthesis after the second select : select paramgener0_.CODE_PARAM as CODE1_2823_, paramgener0_.ORIGINE as ORIGINE2823_, paramgener0_.SOUS_TYPE as SOUS3_2823_, paramgener0_.TYPE_PARAM as TYPE4_2823_, paramgener0_.ACTIF as ACTIF2823_, paramgener0_.LIBELLE_PARAM as LIBELLE6_2823_ from FOA_PARAM_GEN_EXTERNE paramgener0_ where exists ( select (paramgener1_.CODE_PARAM, paramgener1_.ORIGINE, paramgener1_.SOUS_TYPE, paramgener1_.TYPE_PARAM) from FOA_PARAM_GEN_EXTERNE paramgener1_ where paramgener1_.ORIGINE=? and ( paramgener1_.TYPE_PARAM like ? ) and ( paramgener0_.SOUS_TYPE like '%'||paramgener1_.LIBELLE_PARAM ) and paramgener1_.ACTIF='Y' ) order by paramgener0_.LIBELLE_PARAM I don't know why hibernate add a parenthesis after the second select ? Please if you know what to do...
has answer: http://stackoverflow.com/a/26845121
type: Question
tagged with: java
tagged with: hibernate
has title: JPA - Join on same table
upvote count: 1
tagged with: jpa
type: UnansweredQuestion

http://stackoverflow.com/a/26815271
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26785842
answers question: http://stackoverflow.com/q/26785842
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/107681720
has comment: http://stackoverflow.com/comment/117228548
type: Answer
has body: You'll need a different c3p0 DataSource for each JDBC url. A Connection pool must contain homogeneous Connections: all checked out Connections must be equivalent from a client's perspective. If Connections from multiple databases were included in the same pool, clients would have no way of specifying or knowing which db they were communicating with. (If you are replicating, say, a read-only DB and you really want Connections from multiple sources to live in a single pool, because they are guaranteed to be equivalent from a client's point of view, you could do that by defining a custom, unpooled DataSource that round-robined or randomly chose a replicant, and then pooling the DataSource via c3p0's DataSources factory.) It is very easy to dynamically create and configure c3p0 DataSources. See example code here. If you capture your dynamic config as a map of c3p0 property names to values, there's also an alternative, more concise way to get a DataSource with that configuration.

http://stackoverflow.com/comment/42051911
score: 3
has text: The lack of `break` statements at the end of each `case` is at least one problem...
type: Comment
comment on: http://stackoverflow.com/q/26732326
type: QuestionComment

http://stackoverflow.com/comment/42165348
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26795540
has text: Please can you explain what this answer adds, that was not present in the two earlier answers?

http://stackoverflow.com/comment/41980975
type: Comment
has text: remember that when posting code in a question, all your code needs to be indented by 4 spaces. You didn't do that.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26692689

http://stackoverflow.com/a/26762018
answers question: http://stackoverflow.com/q/26761568
has body: Please try to scan the initial input as String. Based on the input string try to perform the operation as follows: Scanner input = new Scanner(System.in); System.out.print("Welcome to the round object calculator.\n This program will calculate the area of a circle or the volume of a Sphere. \nEnter C for circle, S for sphere, or X t exit\n"); String userInput = input.next(); if ("C".equals(userInput)) { System.out.print("Enter radius of sphere: "); float radius = input.nextFloat(); } else if ("S".equals(userInput)) { System.out.println("Sphere volume is : " + (4.0 / 3.0) * Math.PI * Math.pow(radius, 3)); System.out.println("Sphere Surface Area is : " + 4.0 * Math.PI * Math.pow(radius, 3)); } else if ("X".equals(userInput)) { System.out.println("End program"); }
has comment: http://stackoverflow.com/comment/42105358
has comment: http://stackoverflow.com/comment/42106842
type: Answer
has comment: http://stackoverflow.com/comment/42107014
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/26823157
has title: What is the purpose of @NamedArg annotation in javaFX 8?
has answer: http://stackoverflow.com/a/26824088
accepted answer: http://stackoverflow.com/a/26824088
has comment: http://stackoverflow.com/comment/42217939
upvote count: 38
downvote count: 0
answer count: 1
favorite count: 0
score: 38
has comment: http://stackoverflow.com/comment/102646098
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: annotations
has body: I would like to know what is the use case of @NamedArg annotation in JavaFX 8 The javadoc does not give us more details, Javadoc : Annotation that provides information about argument's name. And no more information, documentation, examples on the internet. Maybe someone could help ? Regards.
type: Question

http://stackoverflow.com/comment/42164145
type: QuestionComment
type: Comment
has text: Check `AlexR's` answer.
comment on: http://stackoverflow.com/q/26794747
score: 0

http://stackoverflow.com/q/26801555
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sendmail
tagged with: java
downvote count: 1
has title: Send email to multiple recipients with different content
type: Question
has body: I'm trying to send mails to multiple recipients with JavaMail. The content of each message is to be different. The program sends me an e-mail to different recipients but with the same content. Can any one help me. Her is my source code. public static void postMail(String[] recipients, String subject, Timestamp time)throws MessagingException { String nachricht = null; String link = null; Session session = MailUtil.getGMailSession("username", "password"); Message msg = new MimeMessage(session); msg.setSubject(subject); for(int i=0; i&lt;=recipients.length-1;i++){ System.out.println(recipients[i]); link = recipients[i] + "/" + time; msg.addRecipient(Message.RecipientType.TO, new InternetAddress(recipients[i])); }//endOf forSchleife message = link msg.setContent(message, "text/plain"); Transport.send(msg); }
score: -1
tagged with: jakarta-mail
has answer: http://stackoverflow.com/a/26801618
upvote count: 0

http://stackoverflow.com/comment/42032045
type: Comment
type: QuestionComment
has text: @RolfSmit Are you using context.getSharedPreferences or PreferenceManager.getDefaultSharedPreferences???
comment on: http://stackoverflow.com/q/26720815
score: 0

http://stackoverflow.com/a/32906640
upvote count: 1
answers question: http://stackoverflow.com/q/26790505
downvote count: 0
has body: There are two different approach to connect Java and R. If you want to use JRI, you have to start your java program using the JVM parameter -Djava.library.path pointing at the folder that contains JRI library. For instance: $JAVA_HOME/bin/java -Djava.library.path=/app/vendor/R/lib/R/library/rJava/jri/ -jar target/myapp.jar If you have trouble finding JRI installation directory, try to look for the JRI SO library: find / -name "libjri.*" In addition, make sure you have created R_HOME and LD_LIBRARY_PATH in your environment: R_HOME: Pointing to your local R installation (Ej: /Library/Frameworks/R.framework/Resources) LD_LIBRARY_PATH: Pointing to R lib directory as well as JRI directory (EJ: $LD_LIBRARY_PATH:/app/vendor/R/lib/R/lib:/app/vendor/R/lib/R/bin) Here is an example: @Test public void testMeanFunction() { // just making sure we have the right version of everything if (!Rengine.versionCheck()) { System.err.println("** Version mismatch - Java files don't match library version."); fail(String.format("Invalid versions. Rengine must have the same version of native library. Rengine version: %d. RNI library version: %d", Rengine.getVersion(), Rengine.rniGetVersion())); } // Enables debug traces Rengine.DEBUG = 1; System.out.println("Creating Rengine (with arguments)"); // 1) we pass the arguments from the command line // 2) we won't use the main loop at first, we'll start it later // (that's the "false" as second argument) // 3) no callback class will be used engine = REngine.engineForClass("org.rosuda.REngine.JRI.JRIEngine", new String[] { "--no-save" }, null, false); System.out.println("Rengine created..."); engine.parseAndEval("rVector=c(1,2,3,4,5)"); REXP result = engine.parseAndEval("meanVal=mean(rVector)"); // generic vectors are RVector to accomodate names assertThat(result.asDouble()).isEqualTo(3.0); } On the other hand, if you want to use Rserve, you need to start Rserve in a separate process, and then create a RConnection from your java process. For example…
type: Answer
score: 1

http://stackoverflow.com/a/26757757
type: Answer
has body: parameterMap, being local will be on the stack, although new Hashtable&lt;String,String&gt;() will create the Hashtable object on the heap, being pointed by your local variable parameterMap. So, each thread that runs as a light weight process, running in same process address space, sharing the global data, but separate stack, so separate local variables. To share, you may declare parameterMap within your class as instance variable (if shared instances across threads) or class static variable.
answers question: http://stackoverflow.com/q/26757594
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/42282558
score: 0
type: AnswerComment
has text: Why would he get `ConnectionRefused` error? not that that even exists. It is `ConnectException: connection refused` actually. He didn't mention any such thing.
type: Comment
comment on: http://stackoverflow.com/a/26860737

netbeans
tags question: http://stackoverflow.com/q/26787062
tags question: http://stackoverflow.com/q/26763848
tags question: http://stackoverflow.com/q/26793094
tags question: http://stackoverflow.com/q/26699125
tags question: http://stackoverflow.com/q/26718086
tags question: http://stackoverflow.com/q/26682052
tags question: http://stackoverflow.com/q/26803858
tags question: http://stackoverflow.com/q/26707233
tags question: http://stackoverflow.com/q/26762139
tags question: http://stackoverflow.com/q/26816284
tags question: http://stackoverflow.com/q/26817884
tags question: http://stackoverflow.com/q/26726544
tags question: http://stackoverflow.com/q/26674422
tags question: http://stackoverflow.com/q/26741188
tags question: http://stackoverflow.com/q/26806595
tags question: http://stackoverflow.com/q/26810859
tags question: http://stackoverflow.com/q/26706646
tags question: http://stackoverflow.com/q/26680829
tags question: http://stackoverflow.com/q/26680886
tags question: http://stackoverflow.com/q/26763145
tags question: http://stackoverflow.com/q/26712668
tags question: http://stackoverflow.com/q/26819798
type: Tag
tags question: http://stackoverflow.com/q/26738821
tags question: http://stackoverflow.com/q/26679385
tags question: http://stackoverflow.com/q/26777481
tags question: http://stackoverflow.com/q/26798609
tags question: http://stackoverflow.com/q/26726086
tags question: http://stackoverflow.com/q/26830910
tags question: http://stackoverflow.com/q/26774587
tags question: http://stackoverflow.com/q/26697283
tags question: http://stackoverflow.com/q/26747979
tags question: http://stackoverflow.com/q/26754201
tags question: http://stackoverflow.com/q/26699300
tags question: http://stackoverflow.com/q/26742568
tags question: http://stackoverflow.com/q/26675021
tags question: http://stackoverflow.com/q/26752058
tags question: http://stackoverflow.com/q/26721094
tags question: http://stackoverflow.com/q/26763708
tags question: http://stackoverflow.com/q/26675045
tags question: http://stackoverflow.com/q/26806095
tags question: http://stackoverflow.com/q/26753414
tags question: http://stackoverflow.com/q/26823044
tags question: http://stackoverflow.com/q/26693850
tags question: http://stackoverflow.com/q/26716042
tags question: http://stackoverflow.com/q/26748490
tags question: http://stackoverflow.com/q/26710310
tags question: http://stackoverflow.com/q/26806120
tag name: netbeans
tags question: http://stackoverflow.com/q/26826881
tags question: http://stackoverflow.com/q/26702199
tags question: http://stackoverflow.com/q/26712072
tags question: http://stackoverflow.com/q/26814443
tags question: http://stackoverflow.com/q/26701816
tags question: http://stackoverflow.com/q/26700265

http://stackoverflow.com/a/26767861
type: Answer
has comment: http://stackoverflow.com/comment/42116693
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26766997
accepted answer of: http://stackoverflow.com/q/26766997
has body: if(name == currentObserve.GetName()){ That line. You're comparing Strings, but not using .equals(). So it's comparing the memory locations of the two String objects, which is not equal, so it just keeps going... And never finds any, so returns null. (Not sure why it apparently works elsewhere...) In general, you'll want to put a check for null if the method you're calling has the capability of returning null. This one can potentially fail to find an Observatory, and can thus return null. So to prevent NPE in the future, checking that getObservatory() actually returned something will be Good Practice® going forward.

http://stackoverflow.com/comment/42177070
has text: please consider my edit one
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26801830

http://stackoverflow.com/comment/42047252
score: 0
type: AnswerComment
has text: Thanks, but it's not quite clear why can't I explictly invoke that constructor, say, as follows http://ideone.com/igXgCM ? May JLS provide a restrictions I lost?
type: Comment
comment on: http://stackoverflow.com/a/26729644

http://stackoverflow.com/a/26686868
answers question: http://stackoverflow.com/q/26686052
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26686052
has body: I went through this link http://developmentality.wordpress.com/2011/05/23/hibernate-mysql-mac-foreign-key-nightmares-a-painless-solution-to-a-painful-problem/ and executed this command show engine innodb status in mysql command line and found, the query generated like this insert into user_roles (created_date, created_user, updated_date, updated_user, role_id, user_id, id) values ('2014-11-01 11:57:03', 'test', '2014-11-01 11:57:03', 'test', 0, 0, 0); which is because the value of user_id and role_id is not getting incremented. Now I added this line @GeneratedValue(strategy = GenerationType.IDENTITY) to auto generate id in both user and role tables and the issue is now resolved. Thanks !

http://stackoverflow.com/comment/42012299
has text: Could you show us some code fragment, e.g. your entity definition?
score: 1
comment on: http://stackoverflow.com/q/26709314
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26838447
upvote count: 3
downvote count: 0
type: Answer
has body: If you have a closer look at the exception you will see this: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; This looks like a classpath issue. Possible reasons are: You have the JAX-RS API in you WAR and are deploying it to an Java EE server. You should remove the API from your WAR or change the scope to provided. You have multiple versions of the JAX-RS API on your classpath and are deploying to a plain servlet container like Tomcat or Jetty. I hope this helps.
answers question: http://stackoverflow.com/q/26778891
score: 3

http://stackoverflow.com/comment/41985249
comment on: http://stackoverflow.com/q/26694806
score: 1
type: Comment
has text: What happened is you had a working program that only output `A` and `A-`, then you added more code -- but that code had a syntax error and wouldn't compile, so you were running the old program. Be sure you watch for compiler errors before running your program!
type: QuestionComment

http://stackoverflow.com/comment/42161097
has text: @Scary Wombat But I added them both to the `cacerts`..and marked them there as trusted..Is that not enough? Is this not the way one should do to make a self-signed certificate be trusted?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26792813

http://stackoverflow.com/a/26781624
score: 3
has body: Becase the implementation say it: Returns a hash code for this Integer. Returns:a hash code value for this object, equal to the primitive int value represented by this Integer object. 707 708 public int hashCode() { 709 return value; 710 }
type: Answer
answers question: http://stackoverflow.com/q/26781550
downvote count: 1
upvote count: 4

http://stackoverflow.com/comment/41952947
comment on: http://stackoverflow.com/q/26676169
score: 0
has text: no, those are not the 'other words'. It is possible to deduct what you're asking, but the formulation is quite misleading for people who do not know the answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26772400
score: 0
type: Answer
has body: If you are trying to cast the getAttribute() values to the TestValues class . import it on the jsp you are using it and syntax should be , &lt;%! TestValues tvtemp = (TestValues) application.getAttribute("tv1"); %&gt; However srcriplets are discouraged over the decades and should be avoided . You can use the jstl and el . Read How to avoid Java code in JSP files?
answers question: http://stackoverflow.com/q/26771485

http://stackoverflow.com/q/26809421
tagged with: java
tagged with: rtf
type: Question
has body: I am working on an Android application that allows users to view their documents. However, I've run into the issue of viewing RTF files and/or converting them to HTML. It seems that resources are very limited when searching for help on this. Is there any way to view them with a WebView (similar to the UIWebView for iOS) or are there any libraries out there that actually work for converting from RTF to HTML?
score: 5
answer count: 1
has title: Android RTF to HTML
has answer: http://stackoverflow.com/a/77972785
favorite count: 0
upvote count: 5
tagged with: android
tagged with: http://stackoverflow.com/tag/html
tagged with: android-webview
has comment: http://stackoverflow.com/comment/42191955
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/35733327
answers question: http://stackoverflow.com/q/26683975
score: 0
type: Answer
has body: I stumbled upon this question when I was trying to accomplish a similar thing, here is how I achieved a target that starts running the server and client. (My answer expands on Sushil's and this SO answer) Here is the case: I have a server, and when I start up I want 3 clients to connect to the server right away, all in a separate process. The trick is to nest parallel and sequential in the build.xml targets individually. The sleep call can be changed to wait on the process too. <classpath refid="master-classpath"/> <arg line="${port}"/> <sleep milliseconds="500"/> This would start the server, and then the clients, alternatively, using <daemon> to start the server and then immediately launching the clients right after.

http://stackoverflow.com/a/26830765
type: Answer
has comment: http://stackoverflow.com/comment/42229240
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42229978
accepted answer of: http://stackoverflow.com/q/26830526
answers question: http://stackoverflow.com/q/26830526
has comment: http://stackoverflow.com/comment/42230417
has comment: http://stackoverflow.com/comment/42229899
has body: Why, despite the correct write behaviour, does counterThread2 "believe" Counter's value to still be zero? The threads interleaved in such a way to cause this behaviour. Because the print statements are outside of the synchronised block, it is possible for a thread to read the counter value then pause due to is scheduling while the other thread increments multiple times. When the waiting thread finally resumes and enters the inc counter method, the value of the counter will have moved on quite a bit and will no longer match what was printed in the BEFORE log line. As an example, I have modified your code to make it more evident that both threads are working on the same counter. First I have moved the print statements into the counter, then I added a unique thread label so that we can tell which thread was responsible for the increment and finally I only increment by one so that any jumps in the counter value will stand out more clearly. public class Main { public static void main (String[] args) { // Counter object to be shared between two threads: Counter counter = new Counter(); // Instantiation of Threads: Thread counterThread1 = new Thread(new CounterThread("A",counter), "counterThread1"); Thread counterThread2 = new Thread(new CounterThread("B",counter), "counterThread2"); counterThread1.start(); counterThread2.start(); } } class Counter { long count = 0; // Adding a value to count data member: public synchronized void add (String label, long value) { System.out.println(label+ " BEFORE add - " + Thread.currentThread().getName() + ": " + this.count); this.count += value; System.out.println(label+ " AFTER add - " + Thread.currentThread().getName() + ": " + this.count); } public synchronized long getValue() { return count; } } class CounterThread implements Runnable { private String label; protected Counter counter = null; public CounterThread(String label, Counter aCounter) { this.label = label; this.counter = aCounter; } public void run() { for (int i = 0; i &lt;…
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42229634

http://stackoverflow.com/comment/42118846
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26765887
has text: Thanks oLLo for your answer , I did manage to solve the issue yesterday , I'll post my code below , but I think yours is better thus mark it as correct answer.

http://stackoverflow.com/comment/42406797
comment on: http://stackoverflow.com/q/26719754
has text: "What am I missing here" dome code to pop up the window. What makes you think this should happen automatically?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26703620
accepted answer: http://stackoverflow.com/a/26703865
linked to: http://stackoverflow.com/q/3827393
has title: Java Switch statement confusion
has body: In my app (which is an Android game), I have a method which checks if the player is still alive, and if not, runs an animation and the game is over. There are currently, 3 different animations available depending on how the player loses. So, for example, they can fall off the screen, hit a bird, or get squash by something falling from the sky. Each one has a different animation. Basically, what I'm doing is this: When the player loses, I set the method by which it happened, so for example, if they were hit by a bird: hero.setKilledBy(hero.HITBIRD); Then I act of this by switching within my checkGameOver() method. However, I'm confused. I have to check it like so: (Note, in my cases, I have to put 0, 1, 2): switch(hero.killedBy()){ case 0: { fallOffScreenAnimation();break; } case 1: { hitBirdAnimation();break; } case 2: { squashedAnimation(); } } within my hero object's class, I have the following methods int killedBy; final int FELLOFFSCREEN = 0; final int HITBIRD = 1; final int SQUASHED = 2; int killedBy(){ return killedBy; } int setKilledBy(int value){ killedBy = value; } So, my question is, why can't I do something like this: switch(hero.killedBy()){ case hero.HITBIRD { fallOffScreenAnimation();break; } //............... and so on....... Within the switch statement, my hero object, isn't recognised? Why is this? If I just type it anyway, (case hero.HITBIRD), I get this error: case expressions must be constant expressions Obviously, for readability, I would much prefer to use the variable names I've set rather than the raw numerical values......
has comment: http://stackoverflow.com/comment/42000801
has comment: http://stackoverflow.com/comment/42000866
tagged with: final
type: Question
has comment: http://stackoverflow.com/comment/42000621
type: AnsweredQuestion
tagged with: java
tagged with: switch-statement
has answer: http://stackoverflow.com/a/26703865
answer count: 2
possible better answer: http://stackoverflow.com/a/26703858
linked to: http://stackoverflow.com/q/9254637
has answer: http://stackoverflow.com/a/26703858
tagged with: variables
has comment: http://stackoverflow.com/comment/42000962
score: 0

http://stackoverflow.com/q/26686442
downvote count: 1
type: Question
score: -1
has body: assuming i have the following html Location A text Title A.A date time Title A.B date time Title A.C date time Location B text Title B.A date time Title B.B date time Title B.C date time There are two locations: Location A and Location B. Each location have multiple title list where each list contains title, date and time. I am able to extract the locations but I don't know how to extract the titlelist and map to its respective location. This is how i extract the location: File input = new File("/home/user/htmlcontent.txt"); Document doc = Jsoup.parse(input, "UTF-8", "http://www.example.com"); Elements elements = doc.select("table#tableMain").select("location"); for (Element e: elements) { system.out.println(e.text()); }
tagged with: jsoup
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26687921
favorite count: 0
has title: Jsoup - extracting data
has answer: http://stackoverflow.com/a/26687921
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/37186866
upvote count: 3
type: Answer
has body: Yes, i experience thesame problem. I solved it by first: format the xml. Then i took a keen look through the lines, i found an extra closing tag (/>) which have been blocking the closing tag from seeing the open tag. So i removed the bug (/>) and the program deployed.
answers question: http://stackoverflow.com/q/26725306
score: 3
downvote count: 0

http://stackoverflow.com/comment/42064768
comment on: http://stackoverflow.com/q/26739276
has text: string has a startswith() method
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42124997
score: 0
comment on: http://stackoverflow.com/q/26759095
type: Comment
type: QuestionComment
has text: Yes it's populating as a new CategoryView

http://stackoverflow.com/comment/42094619
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26755867
type: AnswerComment
has text: I agree that this is the most elegant solution and the one that should be accepted.

http://stackoverflow.com/comment/42137761
has text: Use Alpha's answer once
score: 0
comment on: http://stackoverflow.com/q/26779273
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41981084
comment on: http://stackoverflow.com/a/26692721
has text: Agreed on factoring out that common statement from all the `case` blocks. Good catch.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/26803858
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26804745
tagged with: java
has comment: http://stackoverflow.com/comment/42182345
type: Question
tagged with: bitbucket
score: 0
has title: Netbeans 8.0.1 - Remote repository contains commits unmerged into the local branch
answer count: 1
linked to: http://stackoverflow.com/q/25027653
has answer: http://stackoverflow.com/a/26804745
has comment: http://stackoverflow.com/comment/42182478
tagged with: netbeans
tagged with: git
has body: I followed the below instructions to push a Java project in Netbeans 8.0.1 into a Bitbucket repository, but following error popped up: Project > Team > Git > Initialize Project > Right Click > Team > Commit Project > Team > Remote > Push > ... I tried to solve this issue following the procedure in this post, but no success.

http://stackoverflow.com/comment/41995178
type: AnswerComment
comment on: http://stackoverflow.com/a/26699488
score: 0
has text: Sure, I just forgot to do it)
type: Comment

http://stackoverflow.com/a/26738358
downvote count: 1
has body: ([A-Z]{1})(\d+)((?:(?!\1)[a-zA-Z])+) Try this.See demo. http://regex101.com/r/sU3fA2/59
type: Answer
has comment: http://stackoverflow.com/comment/42065695
answers question: http://stackoverflow.com/q/26738194
score: 0
upvote count: 1

http://stackoverflow.com/comment/42222098
comment on: http://stackoverflow.com/a/26826832
type: AnswerComment
has text: Unfortunately, it doesn't work too. What's happening is client program just waiting after executing of `System.out.println(r.readLine());` and after the server has been shut down the same exception is thrown.
score: 0
type: Comment

http://stackoverflow.com/q/26748842
tagged with: multidimensional-array
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15452429
has body: I want to link and sort in descending order a two dimensional array. I coded my program in a way so that you can print the array but it is not sorted. How can I make it sorted? This is a program to calculate the number of hours worked by 8 employees during the week (7 days), and print them out in descending order: public class WeeklyHours { public static void main(String[] args) { double[][] employeeWorkHours = { { 2, 4, 3, 4, 5, 8, 8 }, { 7, 3, 4, 3, 3, 4, 4 }, { 3, 3, 4, 3, 3, 2, 2 }, { 9, 3, 4, 7, 3, 4, 1 }, { 3, 5, 4, 3, 6, 3, 8 }, { 3, 4, 4, 6, 3, 4, 4 }, { 3, 7, 4, 8, 3, 8, 4 }, { 6, 3, 5, 9, 2, 7, 9 } }; for (int row = 0; row &lt; employeeWorkHours.length; row++) System.out.println("Employee " + row + " : " + sumRow(employeeWorkHours, row)); } public static double sumRow(double[][] m, int rowIndex) { double total = 0; for (int col = 0; col &lt; m[0].length; col++) { total += m[rowIndex][col]; } return total; } } This is what I got in the console: Employee 0 : 34.0 Employee 1 : 28.0 Employee 2 : 20.0 Employee 3 : 31.0 Employee 4 : 32.0 Employee 5 : 28.0 Employee 6 : 37.0 Employee 7 : 41.0 But I am supposed to get something like this: Employee 7: 41 Employee 6: 37 Employee 0: 34 Employee 4: 32 Employee 3: 31 Employee 1: 28 Employee 5: 28 Employee 2: 20
tagged with: java
has title: how to display in descending order a two dimensional array
has answer: http://stackoverflow.com/a/26748983
has comment: http://stackoverflow.com/comment/42082252
type: Question
has answer: http://stackoverflow.com/a/26748911
has comment: http://stackoverflow.com/comment/42082151
tagged with: sorting
has answer: http://stackoverflow.com/a/26749321
score: 0
answer count: 3

http://stackoverflow.com/q/26830204
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42273812
has body: In the ByteToMessage decoder (https://github.com/netty/netty/blob/master/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java), which ReplayingDecoder derives from, the cumulation ByteBuf (used to accumulate data until enough has been read from the network to begin decoding) seems to be implemented like a dynamic array. By this I mean that, if the current cumulation ByteBuf has the capacity to retain the incoming data, it is copied to the cumulation ByteBuf. If there is insufficient capacity, the cumulation ByteBuf is expanded and both the previous cumulation ByteBuf and the incoming data are written to the newly allocated instance. Is there a reason that a CompositeByteBuf with a bounded number of components is not used here instead? Using a PooledByteBufAllocator should help reduce the number of memory allocations, but it still seems to me that using a CompositeByteBuf in conjunction with a PooledByteBufAllocator would be the most efficient solution as it would attempt to both optimize memory allocations and copies. However, before I go down the rabbit hole of implementing my own pipeline stage for zero copy aggregation, I wanted to ask if there is a particular reason for the current implementation (e.g. Is the construction of a CompositeByteBuf being performed under the hood by one of the copy calls, or has someone already found that the current strategy is empirically better?) Thanks in advance
has title: Why isn't CompositeByteBuf used for ByteToMessageDecoder?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43229626
has comment: http://stackoverflow.com/comment/43109788
tagged with: zero-copy
tagged with: netty
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/41984484
comment on: http://stackoverflow.com/q/26694612
score: 3
type: Comment
type: QuestionComment
has text: You should maybe learn about OOP and encapsulation before starting out gui programming. [The Java Tutorials - OOP](http://docs.oracle.com/javase/tutorial/java/concepts/)

http://stackoverflow.com/comment/42005146
type: QuestionComment
comment on: http://stackoverflow.com/q/26695022
has text: There's too much noise in your code. Reduce the code sample (especially the markup) to the minimum sample code sufficient to reproduce the problem
score: 0
type: Comment

http://stackoverflow.com/q/26789365
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: dictionary
has answer: http://stackoverflow.com/a/26789454
has body: How do I write my own put, get, size, and remove methods of the Map interface in a class without actually implementing the Map interface? And how would the actual code look for each method?
has comment: http://stackoverflow.com/comment/42154956
tagged with: java
has title: writing map methods without interface-java
has answer: http://stackoverflow.com/a/26789395
has answer: http://stackoverflow.com/a/26789402
type: Question

http://stackoverflow.com/a/26794125
has body: order is a reserved word in SQL, so if you want to use it as a table name you need to protect it with forward quotes: boolean b = JDBC.putData("insert into `order` (lot_date, inst_id, qty, total, ptotal) values ('"+lot_date+"', '"+lot_id+"', '"+qty+"', '"+cost+"', '"+profit+"' )");
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26794073
answers question: http://stackoverflow.com/q/26794073
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/26748640
has title: Mapping error while persisting JPA object
tagged with: java
has answer: http://stackoverflow.com/a/26748902
score: 0
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/42082999
tagged with: jpa
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42082137
has comment: http://stackoverflow.com/comment/42085452
has body: I'm getting stuck with this error in a week. Could anyone explain why I'm getting this error and how to solve it? I have an Entiry class Version and I want to return the Id after persist an Version entity object. But I'm getting this error: Exception [EclipseLink-71] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException Exception Description: A NullPointerException was thrown while setting the value of the instance variable [id] to the value [38]. Internal Exception: java.lang.NullPointerException Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[id--&gt;Version.ID] Descriptor: RelationalDescriptor(varick.rap.demo.entities.VersionPK --&gt; [DatabaseTable(Version)]) This is my full code: factory = Persistence.createEntityManagerFactory(PERSISTENCE_NAME); entity = factory.createEntityManager(); entity.getTransaction().begin(); Version version = new Version(); version.setVersion(getNext(this.version)); version.setProjectID(projectID); entity.persist(version); entity.flush(); System.out.println("Version Id: " + version.getId()); entity.getTransaction().commit(); Version entity class(this class is using an @EmbeddedId): @Entity @Table(name="Version") public class Version implements Serializable { @EmbeddedId private VersionPK id; @Column(name="Version") private String version; @Column(name="ProjectID") private int projectID; public Version() { } public VersionPK getId() { return this.id; } //get and set methods here VersionPK class: @Embeddable public class VersionPK implements Serializable { //default serial version id, required for serializable classes. private static final long serialVersionUID = 1L; @Column(name="ID") @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; public VersionPK() { } //get and set method here
type: Question

http://stackoverflow.com/q/26703135
has comment: http://stackoverflow.com/comment/41999734
has comment: http://stackoverflow.com/comment/42000458
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42000282
tagged with: android-listview
tagged with: android
has title: list view item change color on click
answer count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/257514
type: Question
score: 1
tagged with: java
has body: I have i listview with 24 text views in it(each one of them present one hour of the day). What i am trying to do is to change background color of the item that i clicked. listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int i, long l) { View v; v = parent.getChildAt(i); v.setBackgroundColor(Color.GREEN); } }); The problem is that when i click on a specific item not only bg color of one item is changed but also some other items change their colors. i Know that getChildAt() does not always get the same fixed item. I want to know how that should be done so that only the item that is clicked change bg color. EDIT: Thats the whole fragment class public class GamesFragment extends Fragment { //TopRatedFragment tf = new TopRatedFragment(); List list = new ArrayList&lt;Date&gt;(); public ArrayAdapter&lt;String&gt; adapter; SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); View v; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_games, container, false); final ListView listView = (ListView) rootView.findViewById(R.id.listView); for(int i = 0;i&lt;24;i++){ String date = Integer.toString(i) +":00"; try{ Date num = sdf.parse(date); SimpleDateFormat time = new SimpleDateFormat("HH:mm"); list.add(time.format(num)); }catch(ParseException e){ e.printStackTrace(); } } adapter = new ArrayAdapter&lt;String&gt;(this.getActivity(), R.layout.layout1,R.id.textView,list); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int i, long l) { View v; v = parent.getChildAt(i); v.setBackgroundColor(Color.GREEN); } }); listView.setAdapter(adapter); return rootView; } }

http://stackoverflow.com/q/26678213
answer count: 1
tagged with: action
accepted answer: http://stackoverflow.com/a/26764389
tagged with: menuitem
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26764389
type: Question
has title: How enable or disable correctly an Action
has body: i have a little problem when i try to disable an Action of my Netbeans platform project. When the app starts, some Actions must be disabled, and i do that with this method: CallableSystemAction.get(BuildProjectAction.class).setEnabled(FLAG); It works, because the BuildProjectAction is disabled, but the corresponding items of the MenuBar and the Toolbar remains enabled until i click on one of it. Only later that i have clicked on it, the comportament start to work correctly. First question: Why? If i want disable an Action, it's obvious that i want disable also the relative Icon in the Menu and in the Toolbar, so it must be automatic when i call Action.setEnabled(false). It doesn't have sense that the Icons are not refreshed if i don't click on they. Same problem if i try to use .getToolbarPresenter().setEnabled(false); and .getMenuPresenter().setEnabled(false); For start the application with the icons disabled, I have tried to set the lazy attribute to FALSE and declare the image programmatically with the method setIcon(new ImageIcon(image)); that sets the same image for Menu and Toolbar. And it works; there is only another problem: Menu and Toolbar have icons of different size (16x16 and 24x24). It doesn't have sense that the if i set the icon with the @ActionRegistration(iconBase = "image.png") the correct icon is automatically selected, but if i use the method .setIcon(), it doesn't. I have read some articles about Action, CookieAction, Lookup, but the only thing that i want is disable the graphic elements in the same moment when i disable the Action. Second question: How i can do that? This is an example of my Action. @ActionID( category = "Run", id = "BuildProjectAction") @ActionRegistration( lazy = true, iconBase = "images/icons/compile.png", displayName = "#CTL_BuildProjectAction") @ActionReferences({ @ActionReference( path = "Menu/Run", position = 3), @ActionReference(path = "Toolbars/Run", position = 3), @ActionReference( path = "Shortcuts", name = "D-B") }…
tagged with: netbeans-platform
score: 0
tagged with: toolbar

http://stackoverflow.com/comment/42061149
score: 0
type: QuestionComment
type: Comment
has text: @NileshSolanki What does that have to do with what they said? Toast's are a bad way to debug stuff. Even worse for loops
comment on: http://stackoverflow.com/q/26737425

http://stackoverflow.com/q/26765206
type: Question
tagged with: c#
tagged with: binarywriter
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26765526
favorite count: 0
has body: I have C# program that makes a tcp connection with another c# program. In the c# program to send an message I did this : private TcpClient client; private void SendPulse() { byte[] send_Buffer; port = 11000; while (true) { lock (locked) { try { BlockID = 1003; using (MemoryStream ms = new MemoryStream()) { using (BinaryWriter w = new BinaryWriter(ms)) { NetworkStream stream = client.GetStream(); BlockID = 1003; LengthMessage = 84; // Header : w.Write(BeginMessage); w.Write(BlockID); w.Write(LengthMessage); w.Write(RadarID); w.Write(Time); w.Write(ModeSystem); w.Write(Icd_primary_var); w.Write(Icd_secondary_ver); // Data : w.Write(StatusSystem); send_Buffer = ms.ToArray(); stream.Write(send_Buffer, 0, send_Buffer.Length); Thread.Sleep(3000); // Send pulse every 3 seconds. } } } catch { } } } } The idea is to write in binarywriter and than convert the memory we wrote on to byte array and to send it. Now I have Java programming. I want to do it too, I have connection with C# but I dont know how to send it. I did DataOutputStream but it send every parameter alone, I want all in 1 array of bytes exactly like in the c# code. Thanks for helpers.
has title: BinaryWriter to MemoryStream in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42111517
tagged with: tcp
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/64801703
type: Comment
comment on: http://stackoverflow.com/a/26837072
score: 3
type: AnswerComment
has text: Note that, if you are using toolbar with theme ".NoActionBar", then getSupportActionBar().setHomeAsUpIndicator(upArrow); won't work. Use toolbar.setNavigationIcon(upArrow); then

http://stackoverflow.com/a/26798276
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26794520
accepted answer of: http://stackoverflow.com/q/26794520
type: Answer
has body: Removing the @ResponseBody helps because there are some predefined return value handlers which work on the return type of the MVC controller So when one return some Object the org.springframework.web.method.support.HandlerMethodReturnValueHandler interface comes into picture by identifying the appropriate return type handler and then delegate the handling to proper handler. Following return type are supported return type in Spring MVC 3.2.x and above. ModelAndView or Model or Map or View String or void method annotated with @ResponseBody HttpEntity or ResponseEntity or Callable or DeferredResult These all are defined in following method org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#getDefaultReturnValueHandlers() This is documented at http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-return-types

http://stackoverflow.com/comment/41972606
comment on: http://stackoverflow.com/q/26687588
type: Comment
type: QuestionComment
has text: Are you aware of the fact that each `.jar` in your `.war` can contain a `/META-INF`?
score: 1

http://stackoverflow.com/q/26679714
type: Question
has title: How to start a Timer which executes regularly but for a fixed period of time
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26680021
has body: I am developing a system which has to start a task (download a file) regularly every N seconds. This is not a problem I did it using Timerand Timertaskas follows: FileTimer rXMLFileTimer; private static Timer timer = new Timer("FileReader"); rXMLFileTimer = new ReadFileTimer(); int myDelay = 30; timer.scheduleAtFixedRate(rXMLFileTimer, 0, myDelay * 1000); and the timertask will run until rXMLFileTimer.cancel() is called. Up to now no problem. Now, It has been required that this timertask should run until the rXMLFileTimer.cancel() is called or a given amount of time. My first approach (which didn't work) was to implement a Futureas follows: public class Test { public static class MyJob implements Callable&lt;ReadFileTimer&gt; { @Override public ReadFileTimer call() throws Exception { Timer timer = new Timer("test"); ReadFileTimer t = new ReadFileTimer(); int delay = 10; // Delay in seconds timer.schedule(t, 0, delay * 1000); return t; } } public static void main(String[] args) { MyJob job = new MyJob(); System.out.println(new Date()); Future&lt;ReadFileTimer&gt; control = Executors.newSingleThreadExecutor().submit(job); ReadFileTimer timerTask = null; try { int maxAmountOfTime = 30; timerTask = control.get(maxAmountOfTime, TimeUnit.SECONDS); } catch (TimeoutException ex) { control.cancel(true); } catch (InterruptedException ex) { } catch (ExecutionException ex) {} } } This is not working because I cannot call timerTask.cancel() after the timeout has happen. Then my question is: How can I start a timerTaskfor a given amount of time? Thanks!
tagged with: timer
tagged with: future
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26680021
tagged with: timertask

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/26705578
tags question: http://stackoverflow.com/q/26758641
type: Tag
tags question: http://stackoverflow.com/q/26748162
tags question: http://stackoverflow.com/q/26690748

http://stackoverflow.com/comment/41955643
comment on: http://stackoverflow.com/a/26678035
type: Comment
has text: Ah, you're absolutely right. I just don't realise what is fetch type for. Thank you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41982135
type: Comment
comment on: http://stackoverflow.com/a/26679489
score: 0
has text: @mathlearner sorry for the confusion, I always had one loop-iteration too much in my head and didn't realize it until your last comment. Part of the reason for this are the relatively abstract variable names, so I'd like to give a piece of advice: prefer more descriptive names like `prevNode` or `previousNode` over `pNode` since that helps in understanding what they are meant for (especially if you re-read that code after a while - like several months).
type: AnswerComment

http://stackoverflow.com/q/26826465
favorite count: 0
has comment: http://stackoverflow.com/comment/42221152
has answer: http://stackoverflow.com/a/26826587
has comment: http://stackoverflow.com/comment/42221177
has comment: http://stackoverflow.com/comment/42221041
upvote count: 1
has comment: http://stackoverflow.com/comment/42221144
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26826526
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42221207
downvote count: 1
accepted answer: http://stackoverflow.com/a/26826526
type: Question
has title: Subsequently adding elements to an array
has body: I have a listOfStrings, and I want to create a new listOfStringsTwo (both lists are ArrayLists) where each element is concatenated on to the next one progressively. Here is an example: If the original listOfStrings had elements "hi", "hello" and "bye", the listOfStringsTwo would have the following as its elements: listOfStringsTwo.get(o) would give "hi" listOfStringsTwo.get(1) would give "hi" "hello" listOfStringsTwo.get(2) would give "hi" "hello" "bye" I feel as though I need to use a for loop but I am very unsure of how to proceed. I've looked at the Java docs and countless tutorials but I'm still stuck on this seemingly simple problem. This is my first post on stackoverflow so please, if my question is of the wrong type or if there are any problems with it, please do let me know! I am learning Java by myself and am stuck on a neat situation.
tagged with: arrays
has comment: http://stackoverflow.com/comment/42221200
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42221073
answer count: 3
possible better answer: http://stackoverflow.com/a/26826565
has answer: http://stackoverflow.com/a/26826565
has comment: http://stackoverflow.com/comment/42221127

http://stackoverflow.com/q/26733246
has comment: http://stackoverflow.com/comment/42053442
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26733860
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/26733355
tagged with: arraylist
has answer: http://stackoverflow.com/a/26734037
answer count: 3
has body: I'm currently trying to build a playlist function which takes a music library and produces a random playlist from it, of a specified minimum duration. The idea is that it takes a minimum rating from a user - but, if there aren't enough tracks of that rating to fill the playlist, it goes for tracks of minimumRating - 1. Thus, if you wanted 60 minutes of 5-star tracks, but you don't have enough, the program will try to fill the rest with 4-star ones. So I need a way of decrementing the minimumRating once it reaches the end of its for-loop, then setting it off again. Is there a method I can use which returns something (maybe a boolean) if the for-loop has reached its end? In case it's helpful, my current code can be found here: public ArrayList&lt;Track&gt; createPlaylist(int minRating, int minDuration) { minDuration = minDuration * 60; ArrayList&lt;Track&gt; shuffledList = trackList; ArrayList&lt;Track&gt; playlist = new ArrayList&lt;Track&gt;(); Collections.shuffle(shuffledList); int playlistDuration = 0; while (playlistDuration &lt; minDuration) { for (Track track : shuffledList) { if (track.getRating() &gt;= minRating) { playlist.add(track); playlistDuration += track.getLength(); } } } return playlist; }
has title: How to tell if you've reached the end of a for-loop on an arraylist?

http://stackoverflow.com/comment/56709953
comment on: http://stackoverflow.com/a/26830876
type: AnswerComment
score: 0
type: Comment
has text: In createTempScriptYou(), you need to close the file before returning it.

http://stackoverflow.com/comment/42243347
comment on: http://stackoverflow.com/a/26830230
type: Comment
has text: you can create many different `wrapper classes`, say `class WrapperA { B b; C c; }` then every Wrapper has its own custom serializer on B and C.
score: 1
type: AnswerComment

http://stackoverflow.com/q/26832366
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42231268
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26832455
accepted answer: http://stackoverflow.com/a/26832455
has body: I have a piece of code that moves a rectangle whenever i press a button. it it set up so that the x or y coordinate decreases or increases by 1 pixel each time the key is pressed. however, i am noticing that if i press the same key more than once in a row, the 1 pixel compounds itself somehow , stacks may be a better word, and increases exponentially. is there anything in the code that you can see why it would do this? public class drawingComponent extends JComponent implements KeyListener { Rectangle hello = new Rectangle(300, 100, 50, 50); public void paintComponent (Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setColor(new Color(255, 25, 0)); g2.setFont(new Font("monospace", Font.BOLD + Font.ITALIC, 30)); g2.drawString("nothing yet", 300, 320); g2.fill(hello); setFocusable(true); requestFocus(); addKeyListener(this); } @Override public void keyPressed (KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_W) { hello.y = hello.y - 1; hello.setLocation(hello.x, hello.y); repaint(); System.out.println(hello.y); } if (e.getKeyCode() == KeyEvent.VK_S) { hello.y = hello.y + 1; hello.setLocation(hello.x, hello.y); repaint(); } if (e.getKeyCode() == KeyEvent.VK_A) { hello.x = hello.x - 1; hello.setLocation(hello.x, hello.y); repaint(); } if (e.getKeyCode() == KeyEvent.VK_D) { hello.x = hello.x + 1; hello.setLocation(hello.x, hello.y); repaint(); } } @Override public void keyReleased (KeyEvent e) { } @Override public void keyTyped (KeyEvent e) { // TODO Auto-generated method stub } }
type: Question
has comment: http://stackoverflow.com/comment/42231326
answer count: 2
has answer: http://stackoverflow.com/a/26834993
score: -2
linked to: http://stackoverflow.com/q/26831196
has title: why is my variable increasing exponentially?
has comment: http://stackoverflow.com/comment/42235517
favorite count: 0
possible better answer: http://stackoverflow.com/a/26834993
has comment: http://stackoverflow.com/comment/42235689
has comment: http://stackoverflow.com/comment/42231327

http://stackoverflow.com/a/26770769
answers question: http://stackoverflow.com/q/26769687
upvote count: 1
score: 1
has body: The sender is undoubtedly getting a NotSerializableException when calling writeObject() with a BufferedImage, because BufferedImage doesn't implement Serializable. Therefore you can't get one from a readObject() call either. You'll have to turn the BufferedImage into bytes for sending, and back again when receiving. Have a look at javax.imageio for one way to do this.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42197469
score: 0
has text: public static void main(String args[]) { char opt = ' '; PartyPlanner partyPlaner = new PartyPlanner(); while(opt!='Q') { opt = menu(); switch(opt)
comment on: http://stackoverflow.com/a/26793124
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26699172
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41992224
downvote count: 0
has answer: http://stackoverflow.com/a/26699198
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/26699202
has answer: http://stackoverflow.com/a/26699208
has answer: http://stackoverflow.com/a/26699202
has title: How do insert commas into integers
has answer: http://stackoverflow.com/a/26699230
has body: If I have an integer that is 100,000 int integer = 100000; My question is though, what if i wanted to put a comma after the first three digits so it does not look confusing and looks like 100,000. Also if the user was to change the integer to a million for example how do i then make the code automatically put a comma after the second pair of the third digits so it looks like this 100,000,000.
answer count: 4
accepted answer: http://stackoverflow.com/a/26699198

http://stackoverflow.com/q/26754302
upvote count: 3
tagged with: java
answer count: 2
has title: RegisterReceiver inside IntentService , Tracking SmsManager
has body: I am trying to track after sms sending progress by using class that extends 'IntentService'. The message is sent and i see it on other device , the problem is that the 'BroadcastReceiver' wont run the onReceive method . While sendBroadcast to my mainActivity is working befor RegisterReceiver , inside it it wont work . My Service Class : public class SmsReciveService extends IntentService { public SmsReciveService() { super("SmsReciveService"); } public static final String NOTIFICATION = "com.example.Send"; public static ArrayList&lt;String&gt; phoneNumbers = new ArrayList&lt;String&gt;(); public static String messageToSent=""; public static final String hello = ""; public static int numberOfRecives; public static int numberOfRecivesCurrent; public static int delay; public static int sentCounter =0; public static int notSentCounter =0; Intent intent2 = new Intent(NOTIFICATION); @Override protected void onHandleIntent(Intent intent){ phoneNumbers = (ArrayList&lt;String&gt;) intent.getSerializableExtra("members"); messageToSent = intent.getStringExtra("messageToSent"); sendSMS(); } public void sendSMS() { String smsSent = "SEND"; final ArrayList&lt;PendingIntent&gt; sentIntents = new ArrayList&lt;PendingIntent&gt;(); final SmsManager sm = SmsManager.getDefault(); final ArrayList&lt;String&gt; parts =sm.divideMessage(messageToSent); final int numParts = parts.size(); for (int j = 0; j &lt; numParts; j++) { sentIntents.add(PendingIntent.getBroadcast(this, 0, new Intent(smsSent), 0)); } numberOfRecives=numParts; delay = numParts*2500; Intent intent2 = new Intent(NOTIFICATION); intent2.putExtra(hello, "sending,Number of parts :" + Integer.toString(numParts) ); sendBroadcast(intent2); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { numberOfRecivesCurrent+=1; Intent intent2 = new Intent(NOTIFICATION); intent2.putExtra(hello, "test"); sendBroadcast(intent2); if(numberOfRecivesCurrent==numberOfRecives){ switch (getResultC…
possible better answer: http://stackoverflow.com/a/26755076
has answer: http://stackoverflow.com/a/26791504
has answer: http://stackoverflow.com/a/26755076
type: AnsweredQuestion
score: 3
downvote count: 0
linked to: http://stackoverflow.com/q/4300291
favorite count: 0
accepted answer: http://stackoverflow.com/a/26791504
type: Question
tagged with: android

http://stackoverflow.com/q/26817096
tagged with: neo4j
tagged with: spring-data-neo4j
has title: Why Neo4jTemplate covers nodes number but not its content?
has comment: http://stackoverflow.com/comment/42211104
has body: This is my pom.xml: org.springframework.data spring-data-neo4j 3.2.0.RELEASE org.springframework.data spring-data-neo4j-rest 3.2.1.RELEASE and config.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd"> <constructor-arg index="0" value="http://localhost:7474/db/data" /> <neo4j:config storeDirectory="db/neo4j/data/graph.db" base-package="x.y.z.mediator.domain.model" graphDatabaseService="graphDatabaseService"/> </beans> And I want to autowire the neo4jtemplate form neo4j standalone server: @Repository public class EmployeeDAO_Neo4j implements EmployeeDAO { @Inject private Neo4jTemplate neo4jTemplate; @Override public List<Map<String, Object>> findAll(String query) { //Object is the node address Result<Map<String, Object>> result = neo4jTemplate.query("MATCH (emp:`EmpBase`) RETURN emp;", null); //Below line results with: {emp=http://localhost:7474/db/data/node/1} System.out.println("Results:"+ result.as(List.class).get(1).toString()); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = null; for(EmployeeBase u : result.to(EmployeeBase.class)) { map = new HashMap<String, Object>( ); map.put(u.getE_id().toString(), u.toString()); list.add(map); } System.out.println(result.to(EmployeeBase.class).as(List.class).get(1)); return list; } } The returned list is 4 element one but it says in every System.out.println from the above code that: {e_id=1, e_bossId=null, e_name='null'} so it is not populated, because the test data are: $ cat /tmp/empbase.csv e_id,e_bossid,e_nam…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26829182
tagged with: java
type: Question
score: 0
tagged with: http://stackoverflow.com/tag/csv
answer count: 1
has answer: http://stackoverflow.com/a/26829182

http://stackoverflow.com/comment/42104511
comment on: http://stackoverflow.com/q/26761436
has text: you can check primary key exist or not before insert and give a error
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26720741
answers question: http://stackoverflow.com/q/26720670
downvote count: 0
has body: Yes, when you "pass an object" in Java, you are really just passing a reference to the same object. Java uses pass by reference. You're talking about pass by value, which Java does NOT support for objects.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/26822346
has comment: http://stackoverflow.com/comment/42214257
has answer: http://stackoverflow.com/a/26822755
tagged with: a-star
type: UnansweredQuestion
has body: I have attempted to implement A* search as outlined in the pseudo here: http://web.mit.edu/eranki/www/tutorials/search/ Although the search terminates and finds a goal, my print route() method &gt; private void printRoute() { MyNode i = this.getGoalNode(); while (i != this.getStartNode()) { System.out.println(i.getId()); i = i.getParent(); } } gets stuck in a loop of printing: 8 7 8 7 8 7 8 7 8 7 I am parsing Open Street maps data to do my search, but I have validated my parse is working with successful BFS and DFS. This is a simplified model I made that is meant to represent a simple grid. I am searching from node 1 to node 12: 1 2 3 4 5 6 7 8 9 10 11 12 so 1 expands to 2 and 5 etc The closed set when the search completes looks like this: There must be a flaw in my logic when setting the parent, but I just cannot see it. Would really appreciate any help. thanks, MJB full A* code import java.util.ArrayList; import java.util.LinkedList; public class AStar extends Search { private LinkedList&lt;MyNode&gt; openList; // This is basically our frontier private ArrayList&lt;MyNode&gt; closedList;// This is the visited set. public AStar(MyNode startNode, MyNode goalNode, Parser p) { super(startNode, goalNode, p); openList = new LinkedList&lt;MyNode&gt;(); closedList = new ArrayList&lt;MyNode&gt;(); } public void Search() { openList.add(this.getStartNode()); while (!openList.isEmpty()) { MyNode q = openList.get(0); // find the node with the lowest heuristic value for (MyNode node : openList) { if (node.getF() &lt; q.getF()) q = node; } openList.remove(q); ArrayList&lt;MyNode&gt; successors = q.getSuccessors(); for (MyNode node : successors) { node.setParent(q); if (isGoal(node)) { System.out.println("search completed- goal found"); printRoute(); System.exit(0); } double g = node.getG() + Search.distFrom(q.getLat(), q.getLon(), node.getLat(), node.getLon()); double h = Search.distFrom(this.getGoalNode().getLat(), this .getGoalNode().getLon(), q.getLat(), q.getLon()); node.set…
has comment: http://stackoverflow.com/comment/42375010
tagged with: java
has comment: http://stackoverflow.com/comment/42214127
has comment: http://stackoverflow.com/comment/42214381
type: Question
has title: A Star search not printing the route
tagged with: search
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42214443

http://stackoverflow.com/q/26790116
has comment: http://stackoverflow.com/comment/42156805
upvote count: 5
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42157357
has answer: http://stackoverflow.com/a/36195202
downvote count: 0
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/42177536
possible better answer: http://stackoverflow.com/a/36195202
type: Question
tagged with: spring-boot
score: 5
has answer: http://stackoverflow.com/a/31036442
accepted answer: http://stackoverflow.com/a/31036442
has body: I have a Spring Component DummyStorageRepository and interface StorageRepository written in Groovy class DummyStorageRepository implements StorageRepository {... } Now in my Application.java which is also a spring boot starter config I have @Configuration @ComponentScan @EnableAutoConfiguration public class Application implements AsyncConfigurer { ... @Bean public StorageRepository storageRepository() { return new DummyStorageRepository(); } My Gradle.buid file is plain vanilla. buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE' classpath 'org.springframework:springloaded:1.2.1.RELEASE' } } apply plugin: 'groovy' apply plugin: 'spring-boot' apply plugin: 'project-report' apply plugin: 'eclipse' apply plugin: 'idea' targetCompatibility = 1.8 sourceCompatibility = 1.8 jar { baseName = 'service' version = '0.0.1' } repositories { mavenLocal() mavenCentral() } dependencies { compile 'org.codehaus.groovy:groovy-all:2.3.7:indy' compile 'org.springframework.boot:spring-boot-starter-actuator:1.1.8.RELEASE' compile('org.springframework.boot:spring-boot-starter-web:1.1.8.RELEASE') } and my file structure is src/main/groovy/com/app/repository/DummyStorageRepository.groovy, StorageRepository.groovy src/main/java/com/app/Application.java src/main/resources/... This is the error /app/Application.java:103: error: cannot find symbol public StorageRepository storageRepository() { ^ symbol: class StorageRepository location: class Application If I convert Application.java to Application.groovy and move it to the groovy tree everything is compiled as expected. The same applies if I convert DummyStorageRepository.groovy and StorageRepository.groovy to java and move it into the java tree. I am on gradle 2.1 if it of any matter. Why to I get "cannot find symbol" error wehen referencing groovy from java? Update: I added manually a source set to my gradle.build, just to see what paths are sca…
has comment: http://stackoverflow.com/comment/42167541
has comment: http://stackoverflow.com/comment/42165933
answer count: 2
tagged with: groovy
has comment: http://stackoverflow.com/comment/42156333
has comment: http://stackoverflow.com/comment/42176162
favorite count: 0
has title: Referencing Groovy from Java with Gradle and Spring Boot results in"cannot find symbol"

http://stackoverflow.com/q/26821906
score: 0
tagged with: javacv
answer count: 1
has body: Thresholding image in JavaCV I followed several steps to threshold an image which was taken using a camera. But half of the image becomes black. I tried several types of thresholding algorithms non of them work. the code i used for thresholding is given below, cvCvtColor(src, colorDst, CV_GRAY2BGR); cvThreshold(colorDst, threshold, 155, 255, CV_THRESH_BINARY); //cvThreshold(colorDst, threshold, 155, 255, CV_THRESH_OTSU); // code didnt work in javaCV Is there any algorithms which would threshold properly the whole image which was taken using a camera? Original Image https://i.sstatic.net/9c6HL.jpg Thresholded Image https://i.sstatic.net/qprdZ.jpg
has answer: http://stackoverflow.com/a/27462712
type: UnansweredQuestion
tagged with: image-processing
type: Question
has title: Thresholding an image taken using camera in javaCV
tagged with: java

http://stackoverflow.com/a/26712135
type: Answer
has comment: http://stackoverflow.com/comment/42015748
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/42015381
has comment: http://stackoverflow.com/comment/42015629
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26712062
has comment: http://stackoverflow.com/comment/42015582
answers question: http://stackoverflow.com/q/26712062
has body: This is what a CyclicBarrier is for. It allows you to define spots where threads will wait until all arrive, and then optionally run a Runnable to perform synchronization or other such thing.

http://stackoverflow.com/comment/42085236
comment on: http://stackoverflow.com/a/26749094
type: AnswerComment
score: 0
type: Comment
has text: where the cache data save? i use <diskStore path="c:/tmp"/> to save in it but after caching it's size is zero.

http://stackoverflow.com/q/26688480
has title: using for loops to compute a sequence
accepted answer: http://stackoverflow.com/a/26688864
has comment: http://stackoverflow.com/comment/41974650
has answer: http://stackoverflow.com/a/26688848
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26688674
tagged with: java
has answer: http://stackoverflow.com/a/26688864
has comment: http://stackoverflow.com/comment/41975168
type: Question
has body: I want to write a program that will read an integer and then print the sum of the following sequence 1/1! + 1/2! + 1/3!+..........1/number! . I should only use a for loop without using the math methods. Here is my code and it works well but my question is, how can i print the sequence and then print the answer. For example, if x = 3 it should print 1 / 1 + 1 / 2 + 1 / 6 = 1.666667 Scanner input = new Scanner(System.in); int x = input.nextInt(); double product = 1, sum = 0; for (int i = 1; i &lt;= x; i++) { product *= i; sum += 1.0 / product; } System.out.println("The sum is "+sum);
score: 0
possible better answer: http://stackoverflow.com/a/26688674
answer count: 3
has comment: http://stackoverflow.com/comment/41974045

http://stackoverflow.com/q/26742647
has title: Character animation using image array
tagged with: animation
has comment: http://stackoverflow.com/comment/42071370
type: AnsweredQuestion
has body: I have a problem animating my character's movement in my game. I'm using an image array of 16 elements. The first cycle goes down well but after that the character doesn't animates. It moves but doesn't change the image just showing the first element of that cycle. If I change direction one cycle goes down again well and stops the same way. Any ideas? Here is my code: public void paintHero(Graphics g) { // paint character offG.drawImage(heroCurrent, hero.getHeroX(), hero.getHeroY(), this); // show first image of the cycle where the character stands if (hero.getMoveX() == 0 &amp;&amp; hero.getMoveY() == 0) heroFrame = 0; else { heroFrame++; if (heroFrame == 16) heroFrame = 0; // I'm dividing heroFrame by 4 to slow down the animation if (hero.isMovingUp() == true) heroCurrent = heroSprites[4 + heroFrame / 4]; if (hero.isMovingDown() == true) heroCurrent = heroSprites[0 + heroFrame / 4]; if (hero.isMovingLeft() == true) heroCurrent = heroSprites[8 + heroFrame / 4]; if (hero.isMovingRight() == true) heroCurrent = heroSprites[12 + heroFrame / 4]; } }
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26755624
accepted answer: http://stackoverflow.com/a/26755624
possible better answer: http://stackoverflow.com/a/26742804
has answer: http://stackoverflow.com/a/26742804
score: 0
answer count: 2
tagged with: arrays

http://stackoverflow.com/comment/42121072
type: AnswerComment
comment on: http://stackoverflow.com/a/26770175
has text: @deerdeer so now you got the issue, you do not have the jar present in your classpath
type: Comment
score: 0

http://stackoverflow.com/comment/42111910
has text: [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
score: 0
comment on: http://stackoverflow.com/q/26765531
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26751274
type: Question
tagged with: java
has body: I am developing code to send multiple file names to server side and then making sure server recieves those contents and writes it to a file in its own folder. Its working well when I type first file name but when I type second file name the code kind of gets stuck. Here is my client code:- package fileTransfer; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; public class EchoClient { public static void main(String[] args) throws UnknownHostException { try { Socket clientSock=new Socket("localhost",8888); //to read from server BufferedReader br=new BufferedReader(new InputStreamReader(clientSock.getInputStream())); //to read //to write to server PrintWriter pw=new PrintWriter(clientSock.getOutputStream(), true); //for user input BufferedReader userIn=new BufferedReader(new InputStreamReader(System.in)); BufferedReader fileContent=null; String str=null; String fileContentLine=null; while(true){ if((str=br.readLine()).contains("file name")) //recieve echo from server System.out.println(str); str=userIn.readLine(); //read user input fileContent=new BufferedReader(new FileReader(str)); pw.println(str); while((fileContentLine=fileContent.readLine()) != null){ pw.println(fileContentLine); } while((str=br.readLine())!=null) System.out.println(str); pw.flush(); } }catch(IOException e){ e.printStackTrace(); } } } And here is my server code package fileTransfer; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class EchoServer { public static void main(String[] args){ try { ServerSocke…
score: 0
has title: Client/Server in java : Program gets stuck upon input of second file name
tagged with: client-server
has answer: http://stackoverflow.com/a/26751869
answer count: 1
type: UnansweredQuestion
tagged with: file

http://stackoverflow.com/a/26780193
downvote count: 0
has body: You could try the below regex and get the words you want from group index 1. (?:\[|(?&lt;!^)\G),? *(\w+)(?=[^\[\]]*\]) DEMO Java regex would be, (?:\\[|(?&lt;!^)\\G),? *(\\w+)(?=[^\\[\\]]*\\]) Example: String s = "oneWord [first, second, third] foo bar [foobar]"; Pattern regex = Pattern.compile("(?:\\[|(?&lt;!^)\\G),? *(\\w+)(?=[^\\[\\]]*\\])"); Matcher matcher = regex.matcher(s); while(matcher.find()){ System.out.println(matcher.group(1)); } Output: first second third foobar
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26780114
upvote count: 2

session
tags question: http://stackoverflow.com/q/26710017
tags question: http://stackoverflow.com/q/26765088
tags question: http://stackoverflow.com/q/26692480
tags question: http://stackoverflow.com/q/26715965
tags question: http://stackoverflow.com/q/26709389
tags question: http://stackoverflow.com/q/26693496
tags question: http://stackoverflow.com/q/26794699
tags question: http://stackoverflow.com/q/26700273
type: Tag
tags question: http://stackoverflow.com/q/26691399
tag name: session
tags question: http://stackoverflow.com/q/26816680

http://stackoverflow.com/q/26830686
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/52333845
has answer: http://stackoverflow.com/a/29652270
has answer: http://stackoverflow.com/a/26830923
has body: today I was trying to use the new android RecyclerView. I have created a new Project with a blank activity and added the following to its layout: &lt;android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; In gradle build dependencies I have added: compile 'com.android.support:support-v4:21.0.0' compile 'com.android.support:recyclerview-v7:21.+' compile 'com.android.support:cardview-v7:21.+' But the activity_main.xml rendering still shows me the following error: Rendering Problems The following classes could not be instantiated: - android.support.v7.widget.RecyclerView (Open Class, Show Exception) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.UnsupportedOperationException: Unsupported Service: accessibility at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:465 I don't seem to find a solution myself in the web since everyone says "implement the following dependencies in your gradle build: ..." which i have already added. Can anyone provide a solution? Regards Tak3r07 Edit: onCreate: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }
score: 8
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/29289673
tagged with: java
has answer: http://stackoverflow.com/a/33587883
tagged with: gradle
tagged with: android-recyclerview
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/42228298
has title: Android RecyclerView Error
has comment: http://stackoverflow.com/comment/42228331
has answer: http://stackoverflow.com/a/42816535
has answer: http://stackoverflow.com/a/70629668
downvote count: 0
has answer: http://stackoverflow.com/a/29684134
favorite count: 0
upvote count: 8

http://stackoverflow.com/a/26699655
has body: You should delete the customer based on their ID in the database rather than their code. A user ID should always be unique, where a code may not be. An example of your data might help further.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26699606
downvote count: 0

http://stackoverflow.com/comment/42141920
type: QuestionComment
type: Comment
score: 0
has text: You say that you are seeing: `text.append("writing data....\n");` (which is a strange text but ala). But are you not seeing `text.append("yes m ready...\n");` ? What is the last code that gets executed? Are you catching `text.append("Unable to send data...\n");` ? Better change that to `text.append("Exception: " + e.getMessage());`.
comment on: http://stackoverflow.com/q/26778859

http://stackoverflow.com/a/26746096
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42077590
downvote count: 0
answers question: http://stackoverflow.com/q/26746027
has body: Try This: String[]arr=x.trim().split("n"); double a=Double.parseDouble(arr[0]); double b=Double.parseDouble(arr[1]);
type: Answer

http://stackoverflow.com/a/26673731
score: 0
has body: A Servlet listens to http requests and executes Java code, if the requests url matches the servlet mapping. This is useful when working with HTTP (server side/web application) but not in a desktop application (event driven). We only want you to adjust the view (not your class) when you create a desktop application, as it is requested by the MVC pattern. They want you to reuse your OccurencesCounter class in both environments. Thats always possible, if that class does not include any kind of technique, related to the environment, for example a Servlet. Make sure you have one model that works for both assignments. Actually, you class is not a "model", from MVCs point of view. Its more of a service, that can be called (delegation) by a controller, returning the result (model) and displaying it on any kind of view. So just create a class with a main method and run your OccurencesCounter class from there.
type: Answer
answers question: http://stackoverflow.com/q/26673072
has comment: http://stackoverflow.com/comment/41953224

http://stackoverflow.com/comment/41963605
comment on: http://stackoverflow.com/a/26676063
type: AnswerComment
score: 2
type: Comment
has text: `Collector.of` has a slightly different signature than `collect`. The third argument to collect is a `BiConsumer`, but Collector.of requires `BiOperator`. Replace `CountyPopulation::combine` with `(a,b)->{a.combine(b); return a;}`. Or, alternatively, change the `CountyPopulation.combine` method to return the resulting `CountyPopulation`.

http://stackoverflow.com/comment/42040192
has text: Deltharis stated that you might need a regular expression and that will be my guess too. That said, if you do not feel comfortable with regular expression and wish to do more "brute force" you may want to consider replacing `if (line.contains("240-667-"))` with `if (line.startsWith("240-667-"))`, if each line starts with a phone number.
comment on: http://stackoverflow.com/q/26725408
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42058264
comment on: http://stackoverflow.com/q/26735519
has text: how can if first call the calculate(); when this has to use the values it gets from numbers(); ..??
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26786284
has body: I wrote a code to save my ArrayList to a file, but I need to read this file again, reuse the same array later, but the file is being writen in a weird way, is there any way I can configure the way that the output file will be writen? Sorry if the question is stupid, this is my first program. Code to save the ArrayList: try { FileOutputStream fileOut = new FileOutputStream( "src//ServerInfo.txt"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(dataServer); out.close(); fileOut.close(); } catch (IOException i) { i.printStackTrace(); } Code to read the file: try { File file = new File("src//ServerInfo.txt"); FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); try { String s; while ((s = br.readLine()) != null) { dataServer.add(s); } } finally { br.close(); } } catch (IOException ex) { ex.printStackTrace(); } Either changing the read or write code is okay, I just need a way to read the file I write. Output file llok like this: ¬í sr java.util.ArrayListxÒ™Ça I sizexp w t admint admint booklet@booklet.comt Administratorx How it's supposed to look like: (it's also how I wrote it the first time, before the program did it) admin admin booklet@booklet.com Administrator
has comment: http://stackoverflow.com/comment/42149229
tagged with: filereader
has answer: http://stackoverflow.com/a/26786604
score: 1
tagged with: java
tagged with: filewriter
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42149619
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42149433
answer count: 3
has title: reading file created from arraylist
has comment: http://stackoverflow.com/comment/42149332
has answer: http://stackoverflow.com/a/26787065
favorite count: 0
has answer: http://stackoverflow.com/a/26786671
linked to: http://stackoverflow.com/q/16111496
type: UnansweredQuestion

http://stackoverflow.com/q/26749044
has comment: http://stackoverflow.com/comment/42082718
has comment: http://stackoverflow.com/comment/42091740
type: UnansweredQuestion
answer count: 0
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
has title: Making OpenGL Camera Look At A Point
has body: I'm working on a game in Java using LWJGL and I'm trying to make it rotate to look at a point in 3D space. I have tried every "lookAt" method I can find on the internet, But I just can't get it to work (The camera just doesn't look in the right direction). Could you help me figure out how to do this? EDIT: Figured it out, Just needed to invert the matrix. Here is the final code if you were having the same issue: public static Matrix4f lookAt(Vector3f eye, Vector3f center, Vector3f up) { Vector3f forward = new Vector3f(0, 0, 0); Vector3f.sub(center, eye, forward); forward.normalise(); Vector3f side = new Vector3f(0, 0, 0); Vector3f.cross(forward, up, side); side.normalise(); Vector3f.cross(side, forward, up); Matrix4f matrix = new Matrix4f(); matrix.m00 = side.x; matrix.m01 = side.y; matrix.m02 = side.z; matrix.m10 = up.x; matrix.m11 = up.y; matrix.m12 = up.z; matrix.m20 = -forward.x; matrix.m21 = -forward.y; matrix.m22 = -forward.z; matrix.invert(); return matrix; }
has comment: http://stackoverflow.com/comment/42088174
has comment: http://stackoverflow.com/comment/42087331
has comment: http://stackoverflow.com/comment/42087024
score: 0
has comment: http://stackoverflow.com/comment/42087375
has comment: http://stackoverflow.com/comment/42087170
has comment: http://stackoverflow.com/comment/42082579
tagged with: glulookat

http://stackoverflow.com/a/26745877
has comment: http://stackoverflow.com/comment/42077917
has comment: http://stackoverflow.com/comment/42077523
has comment: http://stackoverflow.com/comment/42077553
type: AcceptedAnswer
downvote count: 0
has body: I was able to run the project: File->Import...->Existing Projects into Workspace Project has invalid settings - source folders are wrong. To fix that, right click on the project->Properties->Java Build Path->Source-> add src, remove src/main and src/test To run, right click on Main class->Run As->Java Application To export to jar, right click on project->Export...->Runnable JAR file To provide keystore name, change Main class: KeystoreSource source = new KeystoreSource(); source.setKeystoreName("path_to_file_relative_to_jar_or_eclipse_project");
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26745387
has comment: http://stackoverflow.com/comment/42077855
has comment: http://stackoverflow.com/comment/42077843
answers question: http://stackoverflow.com/q/26745387
has comment: http://stackoverflow.com/comment/42078101

http://stackoverflow.com/comment/42203697
type: Comment
type: QuestionComment
score: 1
has text: What do you return? Could you return a list of one and a list of all?
comment on: http://stackoverflow.com/q/26816496

http://stackoverflow.com/q/26754311
has answer: http://stackoverflow.com/a/26754716
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/42092002
has body: I have a Eclipse workspace with a declared workset configured to have several projects. Some are to generate JAR files and others are web applications that use those JAR files. In my architecture I have a JAR that will consist of domain core services and another one that depends on the first one that will consist of higher level services. Finally I will have some web applications that use those both JARs. The first JAR project is build with Gradle, based on the following script apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'application' repositories { mavenLocal() mavenCentral(); } jar { baseName = 'br.ufpr.unidades.dominio' version = '0.1.0' } dependencies { compile 'org.hibernate:hibernate-core:4.3.7.Final' } task wrapper(type: Wrapper) { gradleVersion = '1.11' } As anyone can see, it´s a very simple build.gradle file and the build works fine with it. The expected JAR file is generated in the expected destination folder. Now, here comes the build script for the second JAR: apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'application' repositories { mavenLocal() mavenCentral() } jar { baseName = 'br.ufpr.unidades.dominio.hibernate' version = '0.1.0' } dependencies { runtime fileTree(dir: '../dominio/build/libs', include: '*.jar') compile 'org.hibernate:hibernate-core:4.3.7.Final' } task wrapper(type: Wrapper) { gradleVersion = '1.11' } The second file is very similar to the first one, except it has a dependency on generated JAR: runtime fileTree(dir: '../dominio/build/libs', include: '*.jar') Eclipse doesn´t show any problems, but when I try to build the second JAR project I get many Class not found error messages, like the one below: [sts] ----------------------------------------------------- [sts] Starting Gradle build for the following tasks: [sts] build [sts] ----------------------------------------------------- :compileJava D:\Users\alex\Documents\Eclipse\workspace\unidades\dominio.hibernate\src\main\java\dominio\hibernate\HibernateCarg…
tagged with: jar
upvote count: 1
answer count: 1
has title: How to use Gradle to build a JAR that depends on another JAR
tagged with: build.gradle
favorite count: 0
accepted answer: http://stackoverflow.com/a/26754716
has comment: http://stackoverflow.com/comment/42091602
type: AnsweredQuestion

http://stackoverflow.com/comment/42244520
has text: I don't believe so: as written, `ClosedChannelException` occurs when a write occurs while channel is closed. BUT if the channel is closed somewhere else than the application handler (wire disconnection, remote client closing), then a event `channelClosed()` is sent to the application handler. Again, if in the middle (so the channel is closed but the `channelClosed` event is not received yet) the application handler tries to write, it will possibly get this exception `ClosedChannelException`. That's happening, as I experienced this... my 2 cents...
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26826686
type: AnswerComment

http://stackoverflow.com/q/26708633
linked to: http://stackoverflow.com/q/15588033
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42009488
has comment: http://stackoverflow.com/comment/42009394
has comment: http://stackoverflow.com/comment/42009473
has comment: http://stackoverflow.com/comment/42009417
has comment: http://stackoverflow.com/comment/42009393
has comment: http://stackoverflow.com/comment/42009445
favorite count: 0
upvote count: 0
has title: rearranging of linked list elements
has comment: http://stackoverflow.com/comment/42009424
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42009446
has answer: http://stackoverflow.com/a/26708780
downvote count: 1
has comment: http://stackoverflow.com/comment/42009339
tagged with: linked-list
has body: I am in new to data structures , exploring it splcially the linked list and in linked i am trying to achieve the following.. 1)Given a linked list, reverse alternate nodes and append at the end Input List: 1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;6 Output List: 1-&gt;3-&gt;5-&gt;6-&gt;4-&gt;2 2)Given a linked list, reverse alternate nodes and append them to end of list. Extra allowed space is O(1) Input List: 12-&gt;14-&gt;16-&gt;18-&gt;20 Output List: 12-&gt;16-&gt;20-&gt;18-&gt;14 please advise the logic and how can I implement this in java.Thanks in advance
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42009401
has comment: http://stackoverflow.com/comment/42009578
answer count: 2
has answer: http://stackoverflow.com/a/26709283

http://stackoverflow.com/comment/42039737
has text: Yes I have. Its actually the sync adapter for this app [link](https://github.com/mar-v-in/XMPP-for-Android/blob/master/AndroidManifest.xml)
type: Comment
comment on: http://stackoverflow.com/a/26724973
score: 0
type: AnswerComment

http://stackoverflow.com/q/26766265
score: -1
has comment: http://stackoverflow.com/comment/42113560
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26766333
tagged with: arrays
has comment: http://stackoverflow.com/comment/42113368
has answer: http://stackoverflow.com/a/26766446
tagged with: custom-exceptions
has comment: http://stackoverflow.com/comment/42113672
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26766415
tagged with: java
has comment: http://stackoverflow.com/comment/42113631
has comment: http://stackoverflow.com/comment/77736613
downvote count: 1
type: Question
has title: if statement inside a try catch statement not detecting try/catch part
has comment: http://stackoverflow.com/comment/42113853
has body: So i've got an assignment for class and i'm completly stuck. I've lurked around here all semester and have found what i've needed but this time i'm lost. I need help with a try catch statement inside of a loop. The assignment wants us to have people input their names and choose a schedule time 1, 2, 3, 4, 5, 6. with exceptions if it is outside of that range or if the time is already taken. heres what i've got so far. when ran, it'll let me put the first name in and a time, but gives me an error for line 40, which is the "if(timeSlot[i] &lt;1 || &gt;6){ " line. Any help would be appreciated,Thanks import java.util.Scanner; public class Scheduler { Scanner input = new Scanner(System.in); public static void main(String[] args) throws TimeInUseException, InvalidTimeException { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); String name[] = new String[6]; int timeSlot[] = new int[6]; //as long as there is less than 6 it will keep running int d = 0; while (d &lt; 6) { //try block to see if the time slot has been taken try { for (int i = 0; i &lt; name.length; i++) { //ask for the name System.out.println("Please type your name: "); name[i] = input.nextLine(); //ask for the time System.out.println("Please select a time: 1, 2, " + "3, 4, 5, 6"); timeSlot[i] = input.nextInt(); // if the time is less than 1 or greater than 6 // it will throw an invalid time exception if (timeSlot[i] &lt; 1 || timeSlot[i] &gt; 6) { throw (new InvalidTimeException()); } // if the time slot is not equal to null(not empty) // it will throw a time in use exception if (timeSlot[i] != null) { throw (new TimeInUseException()); } } } // catch for invalid time catch (InvalidTimeException ite) { ite.getMessage(); } //catch for time in use catch (TimeInUseException tiue) { tiue.getMessage(); } d++; } for (int i = 0; i &lt; 6; i++) { System.out.println(name[i] + " has an appointment at: " + timeSlot[i]); } } } the exceptions per request public class InvalidTimeException extends E…
tagged with: if-statement

http://stackoverflow.com/comment/41994429
score: 0
has text: *"Is there any way to check if an AudioClip is in loop/already playing or not?"* No, there is not. Switching to Clip is the right decision here.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26696163

http://stackoverflow.com/q/26712133
has comment: http://stackoverflow.com/comment/42038188
has comment: http://stackoverflow.com/comment/42037996
linked to: http://stackoverflow.com/q/7566565
has comment: http://stackoverflow.com/comment/42048860
answer count: 1
has body: Is there a way to record or describe a Java refactoring in a way that it can be automatically applied to a depending code base? My company works with two separate Java code bases, a platform and an add-on depending on the platform. (In fact, multiple add-ons for different customers.) The platform and the add-on are developed by different teams working on different release cycles: The add-on is updated some time after the platform is released. A refactoring applied to the platform is not automatically applied to the add-on, because the platform team does not even look at the add-on code. The add-on team uses the previously released platform code in read-only mode, and currently has to re-apply the platform refactorings manually (e.g. renaming classes and methods). I wonder if and how the add-on team could apply the platform refactorings to the add-on automatically, instead of having to jump from compile error to compile error after a platform update. Currently, Eclipse is used as IDE by both teams, but usage is shifting towards IntelliJ Idea.
favorite count: 0
has answer: http://stackoverflow.com/a/27113791
has comment: http://stackoverflow.com/comment/42048660
score: 2
downvote count: 0
has title: Automatic refactoring of depending code after the fact
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10878091
has comment: http://stackoverflow.com/comment/42048644
tagged with: java
type: Question
upvote count: 2
tagged with: automated-refactoring

http://stackoverflow.com/a/26707410
answers question: http://stackoverflow.com/q/26707314
upvote count: 4
downvote count: 0
score: 4
type: Answer
has body: One problem in your code is the case where NoOfItems > 5 but totalSale &lt; 500. For this case, the commission will incorrectly be set to 0 because the first if statement eats it. Please try to be more specific with your question. "this doesn't work and I don't know why" is not easy to help with.
has comment: http://stackoverflow.com/comment/42007454

http://stackoverflow.com/comment/42147845
comment on: http://stackoverflow.com/a/26774222
type: AnswerComment
score: 0
type: Comment
has text: Here's an image of what I want the code to output: http://i1146.photobucket.com/albums/o525/walroid/Javapicture_zps12201eb6.png

http://stackoverflow.com/comment/42159061
score: 81
has text: Don't use some string cleverly (stupidly) chosen to be unlikely. Use characters from the Unicode Private Use Area, U+E000..U+F8FF. Remove any such characters first, since they shouldn't legitimately be in the input (they only have application-specific meaning within some application), then use them as placeholders when replacing.
type: AnswerComment
comment on: http://stackoverflow.com/a/26791459
type: Comment

http://stackoverflow.com/comment/42215109
comment on: http://stackoverflow.com/a/26822479
has text: I'll update with a more complete example for calcChoice
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42192458
score: 4
type: Comment
type: QuestionComment
has text: Have you written any Java code before?
comment on: http://stackoverflow.com/q/26809906

http://stackoverflow.com/comment/42220586
type: Comment
has text: If you really want to ensure an array doesn't get changed, consider using Guava's ImmutableList instead.
score: 0
comment on: http://stackoverflow.com/q/26826187
type: QuestionComment

http://stackoverflow.com/a/26764762
score: 2
has body: Whenever you are parsing, you need to make sure that the Integer you want to create from the string is smaller than Integer.MAX. Integer.MAX is equal to 2147483647, and so any value bigger than this will cause an exception.
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26764702

file
tags question: http://stackoverflow.com/q/26801268
type: Tag
tags question: http://stackoverflow.com/q/26828028
tags question: http://stackoverflow.com/q/26674037
tags question: http://stackoverflow.com/q/26781232
tags question: http://stackoverflow.com/q/26677322
tags question: http://stackoverflow.com/q/26761583
tags question: http://stackoverflow.com/q/26826437
tags question: http://stackoverflow.com/q/26683949
tag name: file
tags question: http://stackoverflow.com/q/26699611
tags question: http://stackoverflow.com/q/26794630
tags question: http://stackoverflow.com/q/26674192
tags question: http://stackoverflow.com/q/26806907
tags question: http://stackoverflow.com/q/26805308
tags question: http://stackoverflow.com/q/26768211
tags question: http://stackoverflow.com/q/26798290
tags question: http://stackoverflow.com/q/26707471
tags question: http://stackoverflow.com/q/26825383
tags question: http://stackoverflow.com/q/26785315
tags question: http://stackoverflow.com/q/26820222
tags question: http://stackoverflow.com/q/26718233
tags question: http://stackoverflow.com/q/26721734
tags question: http://stackoverflow.com/q/26796454
tags question: http://stackoverflow.com/q/26797804
tags question: http://stackoverflow.com/q/26706162
tags question: http://stackoverflow.com/q/26720936
tags question: http://stackoverflow.com/q/26682973
tags question: http://stackoverflow.com/q/26712568
tags question: http://stackoverflow.com/q/26679209
tags question: http://stackoverflow.com/q/26710660
tags question: http://stackoverflow.com/q/26722387
tags question: http://stackoverflow.com/q/26723341
tags question: http://stackoverflow.com/q/26714445
tags question: http://stackoverflow.com/q/26777338
tags question: http://stackoverflow.com/q/26694816
tags question: http://stackoverflow.com/q/26797837
tags question: http://stackoverflow.com/q/26712763
tags question: http://stackoverflow.com/q/26688108
tags question: http://stackoverflow.com/q/26789808
tags question: http://stackoverflow.com/q/26751274
tags question: http://stackoverflow.com/q/26793337
tags question: http://stackoverflow.com/q/26734180
tags question: http://stackoverflow.com/q/26723322
tags question: http://stackoverflow.com/q/26826394
tags question: http://stackoverflow.com/q/26759638
tags question: http://stackoverflow.com/q/26797194
tags question: http://stackoverflow.com/q/26831483
tags question: http://stackoverflow.com/q/26830182
tags question: http://stackoverflow.com/q/26694322

http://stackoverflow.com/a/26826811
upvote count: 1
has body: In this case account is a local variable for main, if you want to use the method getAmount you have two options: -Declare the array as static and put it out of the main method (the array would be a global variable) -Pass the array as a parameter in getAmount. public static void main(String[] args) { Account[] account = new Account[10]; for ( int i=0; i&lt;account.length; i++) { account[i]=new Account(); } account[0].owner = "Thomas"; account[0].amount = 24325; System.out.println(getAmount(0), account); //&lt;- dont work, but works with account[0].amount } public static double getAmount(int x, Account[] account) { double s = account[x].amount; //&lt;&lt;------- CANNOT FIND SYMBOL return s; }
answers question: http://stackoverflow.com/q/26826697
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/55515276
comment on: http://stackoverflow.com/a/26811669
type: Comment
has text: @JoséPereda What does `get(0)` means? I know that you're searching for the group children, but I don't understand the "0". It's supposed to be the index, but the only thing that has indexes (according to SceneBuilder at least) it's a GridPane. And even int hat case, it has 2 indexes (rows and columns).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42138710
type: QuestionComment
comment on: http://stackoverflow.com/q/26774847
score: 0
has text: @ParagJ If the user wants to see their dates in a certain format, what's the point of splitting the date and time then? If you want the user to see dates and times separately, why not provide 2 inputs, one for the date format and one for the time format?
type: Comment

http://stackoverflow.com/q/26690101
has title: Unable to start activity NullPointerException
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26690134
tagged with: android
possible better answer: http://stackoverflow.com/a/26690162
has answer: http://stackoverflow.com/a/26690162
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26690134
type: Question
has body: There are a couple of other questions regarding this on stack but none of them seem to apply to my situation. I hope i am providing the necessary information. The activity does not get to the oncreate method but dies at startActivity() public void showPlaylist(View view){ Intent i = new Intent(this,Playlist.class); startActivity(i); } Manifest: <?xml version="1.0" encoding="utf-8"?> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Logcat: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296) at android.app.ActivityThread.access$700(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5293) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:109) at com.overmindserver.www.swipernoswiping.Playlist.<init>(Playlist.java:30) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.app.Instrumentation.newActivity(Instrumentation.java:1071) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2163) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296) at android.app.ActivityThread.access$700(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper…

http://stackoverflow.com/q/26821189
has answer: http://stackoverflow.com/a/26821233
type: UnansweredQuestion
type: Question
has title: State object overwrites previous child when producing a new one
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26821822
tagged with: state
score: 0
has body: I am using backtracking in a framework to work a graph-coloring problem with bound-pruning. Each possible state of the graph (i.e. each combination of colors one could put on the graph) is represented by a State object. The framework asks each State to produce all of it's children, chooses the one with the best bounds, and repeats to find the best solution, pruning by bounds along the way. The trouble I'm running into is this: When I call nextChild() on a State, it changes the previous child produced by that state to be identical to the one just produced. Here is what I believe to be the relevant part of my code: public State nextChild() { // System.out.println("currentColor: "+ colors.get(currentColor) + " firstUncolored " + this.firstUncolored); // previous line for debugging GraphColoringState child = childSetup(); child.gcolors[firstUncolored] = colors.get(currentColor++); if(this.currentColor == colors.size()){ this.currentColor = 0; this.hasMoreChildren = false; } return child; } private GraphColoringState childSetup() { GraphColoringState theClone = new GraphColoringState(graph, colors); theClone.gcolors = this.gcolors; theClone.firstUncolored = this.firstUncolored +1; theClone.currentColor = 0; return theClone; } When I produce and print children like this: State s = new GraphColoringState(graph, colors); System.out.println(s); State s1 = s.nextChild(); System.out.println(s1); State s2 = s.nextChild(); System.out.println(s2); State s3 = s.nextChild(); System.out.println(s3); I get this output: , , , , , , Red, , , , , , Green, , , , , , Blue, , , , , , but when I produce and print this way: System.out.println(s); State s1 = s.nextChild(); State s2 = s.nextChild(); State s3 = s.nextChild(); System.out.println(s1); System.out.println(s2); System.out.println(s3); I get this unfortunate output: , , , , , , Blue, , , , , , Blue, , , , , , Blue, , , , , , I say this output is unfortunate, because in order for the backtracking framework to work, I need to store all…
tagged with: backtracking

http://stackoverflow.com/comment/41958596
score: 0
type: Comment
type: QuestionComment
has text: Im getting: System.out.print f("Sphere Surface: %3f16" + calc1.sphereSurface(r)); ^ required: double,double found: double reason: actual and formal argument lists differ in length 2 errors
comment on: http://stackoverflow.com/q/26679786

http://stackoverflow.com/comment/42120647
comment on: http://stackoverflow.com/a/26768243
type: Comment
score: 0
type: AnswerComment
has text: If you believe this is a Netty bug can you please file an issue at https://github.com/netty/netty? Thanks!

http://stackoverflow.com/q/26718200
favorite count: 0
has body: Trying to add a comment to all MySQL Select Queries in my web application at runtime. For example, the original queries in the code looks like: select a,b,c from ...... select x,y from... All of these need to be modified at runtime to: select a,b,c /*Comment*/ from ... select x,y /*Comment*/ from ... The application runs on Hibernate 4.2.1. Only solution I can think of is extending the org.hibernate.dialect.MySQLDialect and add the /*Comment*/ in the new CustomMySQLDialect. A little confused on which method to modify to accomplish this. Would appreciate any pointer in the right direction. Can transformSelectString(java.lang.String) method in org.hibernate.dialect.Dialect be overridden to accomplish this? EDIT 1: transformSelectString in a Custom MySQL Dialect is not working for runtime SQL modification
has answer: http://stackoverflow.com/a/26718533
has title: Add a column to all MySQL Select Queries in a single shot
has comment: http://stackoverflow.com/comment/42030547
upvote count: 1
has answer: http://stackoverflow.com/a/26957434
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42030634
tagged with: dialect
score: 1
accepted answer: http://stackoverflow.com/a/26957434
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42048902
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42047751
downvote count: 0
has comment: http://stackoverflow.com/comment/42026710
has comment: http://stackoverflow.com/comment/42026874
possible better answer: http://stackoverflow.com/a/26718533

http://stackoverflow.com/comment/42143006
score: 0
comment on: http://stackoverflow.com/q/26782939
type: QuestionComment
type: Comment
has text: possible duplicate of [KeyListener, keyPressed versus keyTyped](http://stackoverflow.com/questions/7071757/keylistener-keypressed-versus-keytyped)

http://stackoverflow.com/comment/42063541
type: QuestionComment
comment on: http://stackoverflow.com/q/26738812
score: 0
has text: just use writer.close()
type: Comment

http://stackoverflow.com/a/26728084
score: 0
accepted answer of: http://stackoverflow.com/q/26727633
has body: Many standard GWT widgets, including panels, have different browser-specific implementations and implement many different interfaces. For example, this is the list of interfaces implemented by a GWT Panel: HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, java.lang.Iterable LayoutPanel implements even more: HasAttachHandlers, HasHandlers, EventListener, AnimatedLayout, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, java.lang.Iterable Your panel does not implement any of them. Maybe they are not necessary for your use cases, but it's very easy to miss something when you build more complex user interfaces. I always prefer to use a widget developed and tested in real life applications by thousands of developers even though I can easily build something similar on my own.
type: Answer
answers question: http://stackoverflow.com/q/26727633
type: AcceptedAnswer

http://stackoverflow.com/q/26790993
favorite count: 0
type: UnansweredQuestion
downvote count: 2
linked to: http://stackoverflow.com/q/780541
has answer: http://stackoverflow.com/a/26791152
has comment: http://stackoverflow.com/comment/42158050
tagged with: java
type: Question
tagged with: hashmap
upvote count: 0
score: -2
has title: null pointer json data
has body: i have a listview with the special id @android:id/list the json data has just an array with objects in it. public class MainActivity extends ListActivity { String KEY_DESCRIPT = "DESCRIPTION:"; String KEY_NAME = "NAME:"; String line = null; JSONArray datalist=null; JSONObject getobj=null; BufferedReader br; StringBuilder sb; String Web=null; JSONArray jresult=null; URL url; HttpURLConnection cn; String TAG="MYACTIVITY"; String name = null; String [] sortedlist; ProgressBar loading; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loading= (ProgressBar) findViewById(R.id.progressBar1); Web = "http://api.mtgdb.info/search/Dragon"; new jsonGet().execute(Web); } protected class jsonGet extends AsyncTask&lt;String , Void, JSONArray&gt;{ @Override protected JSONArray doInBackground(String... params) { try { url= new URL(params[0]); cn=(HttpURLConnection) url.openConnection(); br= new BufferedReader(new InputStreamReader(cn.getInputStream())); sb= new StringBuilder(); while((line = br.readLine())!=null){ sb.append(line+"\n"); } br.close(); datalist= new JSONArray(sb.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return datalist; } @Override protected void onPostExecute(JSONArray result) { super.onPostExecute(result); jresult=result; passList(); } } public void passList() { loading.setVisibility(View.INVISIBLE); if (jresult==null){ Log.e(TAG, "ERROR"); }else{ ArrayList&lt;HashMap&lt;String, String&gt;&gt; newlist =new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); for (int i =0;i&lt;jresult.length();i++){ try{ getobj= jresult.getJSONObject(i); name=getobj.getString("name"); String description =getobj.getString("description"); HashMap&lt;String, String&gt; secondlist= new HashMap&lt;String, String&gt;(); secondlist.put(KEY_NAME, name); secondlist.put(KEY_DESCRIPT, d…
tagged with: android
answer count: 1

http://stackoverflow.com/comment/42194339
type: AnswerComment
comment on: http://stackoverflow.com/a/26810800
type: Comment
has text: You are very welcome, you can mark it as correct answer to make it useful for other people who may have same kind of question.
score: 0

http://stackoverflow.com/comment/42003418
has text: I can't escape the table name as it throws an error saying it is an invalid character. The semi-colon and aliases also didn't seem to fix the issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26704955
type: Comment

http://stackoverflow.com/q/26775984
type: Question
has body: I'm experimenting with the JUnit Enclosed runner in order to try and improve the organisation of some of my tests. At the moment I'm trying to work out how to share some setup between the inner classes. Attempt the first: @RunWith(Enclosed.class) public class EnclosedTest { @Before public void printSomething() { System.out.println("Helllooo Meggan"); } public static class FirstTest { @Test public void assertThatSomethingIsTrue() { assertThat(true, is(true)); } } public static class SecondTest { @Test public void assertThatSomethingIsFalse() { assertThat(false, is(false)); } } } Unfortunately, no-one says hello to Meggan. If I update an inner class to extend the outer one, then I get the following: java.lang.Exception: class 'org.scratch.EnclosedTest$FirstTest' (possibly indirectly) contains itself as a SuiteClass at org.junit.runners.model.InitializationError.&lt;init&gt;(InitializationError.java:32) Is there a particular Enclosed idiom to use when trying to share setup between inner test classes? I was hoping it would be as simple as the C# example I found.
upvote count: 13
answer count: 1
tagged with: junit
favorite count: 0
type: UnansweredQuestion
score: 13
has title: JUnit Enclosed runner and shared setup
has answer: http://stackoverflow.com/a/29113260
downvote count: 0
tagged with: java

http://stackoverflow.com/a/26687579
upvote count: 3
has body: Steps 7 and 8 are not quite right - you need to use the index of the FFT bin with the largest magnitude in order to determine the frequency: // 7 - Get maximum magnitude double max_magnitude = -1; int max_magnitude_index = -1; for (int i = 0; i &lt; bufferSize / 2; i++) { if (magnitude[i] &gt; max_magnitude) { max_magnitude = magnitude[i]; max_magnitude_index = i; } } // 8 - Calculate frequency int freq = (int)(max_magnitude_imdex * sampleRate / bufferSize); And as noted by @hotpaw2, your sample rate is way too low at 8 kHz - it would need to be at least 44.1 kHz, preferably 48 kHz.
has comment: http://stackoverflow.com/comment/42012369
has comment: http://stackoverflow.com/comment/42012409
type: Answer
score: 3
answers question: http://stackoverflow.com/q/26678407
downvote count: 0
has comment: http://stackoverflow.com/comment/65505817
has comment: http://stackoverflow.com/comment/65507289

http://stackoverflow.com/comment/42103192
has text: same URL is for both, in 1st case it is working and in 2nd case it is not as payload is different and it is not able to map to proper REST service method.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26758862
type: Comment

http://stackoverflow.com/q/26796869
linked to: http://stackoverflow.com/q/1866886
has comment: http://stackoverflow.com/comment/42168043
accepted answer: http://stackoverflow.com/a/26797070
has comment: http://stackoverflow.com/comment/42168699
score: 0
has body: <?xml version="1.0" encoding="UTF-8"?> XXXXXXX <EmployeeRef rRef="EMPCSR"/> How do I get the root element value. For this example I want to get the DescriptiveName,ID,JobID and ProjectID. I managed to read other values but stuck in root emlement. Please advice. EDITED DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); //System.out.println("*************************"); String expression = "/JDF"; NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
has title: Java - XML read root element value
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26797070
tagged with: java
type: Question

http://stackoverflow.com/comment/42125354
type: Comment
comment on: http://stackoverflow.com/q/26772929
type: QuestionComment
score: 2
has text: Why you do not try it?

http://stackoverflow.com/q/26797316
has body: I am using aws-java-sdk api for collecting the all ec2 instances. I able to collect the all instances but not able to get the OS name for Linux instances. And getting the OS name with platform property for Windows instances. Can any one help me about this.
score: 0
answer count: 1
tagged with: amazon-ec2
has title: How to get the OS name for Amazon ec2 Linux instances
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42168652
tagged with: java
has answer: http://stackoverflow.com/a/26798817
type: Question

http://stackoverflow.com/q/26805421
favorite count: 0
has title: Android Studio Annotation AbstractProcessor Not Found
tagged with: android
score: 6
accepted answer: http://stackoverflow.com/a/26810302
upvote count: 6
tagged with: android-studio
type: AnsweredQuestion
tagged with: java
tagged with: annotations
type: Question
has comment: http://stackoverflow.com/comment/42191367
has body: I'm trying to add an annotation processor to my Android project, but I get an error saying that AbstractProcessor can't be found. I've created a separate java project in the meantime, but I'd rather keep everything in one Android project. What's the best way to include AbstractProcessor in my project? I'm using AndroidStudio and Gradle. UPDATE: I repackaged javax.annotation, javax.lang.model, and javax.tools to sit under my project's namespace (as per these instructions). I include a resources/META-INF/services/javax.annotation.processing.Processor that contains the full classname of my AbstractProcessor subclass, and everything compiles fine. However, the processor never gets run. EDIT: To clarify in short, I have an Android library project that provides an annotation for a method. I want to provide a processor that causes a compile time error if the annotation is used incorrectly. If I try to put the processor in the Android library project, Gradle won't build it because javax.* classes aren't found. The only way I could get it to work is to create a java module in the library project, and put the processor there. However, that means I have to have 2 dependencies in any projects that I want to use this annotation; one to get the annotation, and one to get the processor.
downvote count: 0
has answer: http://stackoverflow.com/a/26810302
has comment: http://stackoverflow.com/comment/42191288
answer count: 1

http://stackoverflow.com/comment/41985628
comment on: http://stackoverflow.com/q/26695256
type: Comment
type: QuestionComment
has text: `ProcessEntityWrapper` is not a `Process`. I'm not really sure why you don't understand this except that you need to go back to the basics.
score: 1

http://stackoverflow.com/comment/42200812
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26814673
has text: have you initialize resultList???

http://stackoverflow.com/q/26735636
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26735708
has comment: http://stackoverflow.com/comment/42057698
has title: returning just created id of insert query
linked to: http://stackoverflow.com/q/1915166
tagged with: java
has answer: http://stackoverflow.com/a/26735874
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/17438288
linked to: http://stackoverflow.com/q/17438288
score: 0
tagged with: jdbc
has body: Is there a way to receive just acquired id by my insert query? I am using java.sql package and I heard that there is a way without querying these keys again. Or isn't?
tagged with: insert

http://stackoverflow.com/comment/42049572
has text: Please add these details as a proper edit to your question. Define "it can not execute". Do you get an error?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26730051

http://stackoverflow.com/comment/42189397
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26796110
score: 0
has text: Thanks eee. I also found the answer at https://stackoverflow.com/questions/13592302/easymock-mock-methods-within-tested-class. With a few tweaks, it's doing what I needed.

http://stackoverflow.com/a/26816340
type: Answer
accepted answer of: http://stackoverflow.com/q/26816313
has body: Atomic means that the update operations done on that type are ensured to be done atomically (in one step, in one goal). Atomic types are valuable to use in a concurrent context (as "better volatiles")
answers question: http://stackoverflow.com/q/26816313
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/42071569
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26740415
has text: I assumed having 5000 objects would be resource intensive. I making this program for laptops/PCs.

http://stackoverflow.com/comment/42195674
comment on: http://stackoverflow.com/q/26804164
score: 0
has text: Sorry i didnt get you. is this a solution or what?. Thank you for your interest.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26929823
answers question: http://stackoverflow.com/q/26778308
score: 0
has body: Finally figured it out, turns out I was setting the onClick event to the whole table instead of the row...
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26778308
type: Answer

http://stackoverflow.com/q/26757660
has comment: http://stackoverflow.com/comment/42128534
type: AnsweredQuestion
tagged with: java
has body: I have problem with my Programs . Help me please. java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). Class.forName("com.mysql.jdbc.Driver"); String path = "jdbc:mysql://localhost:3306/sampledb"; String Username = "root"; String Password = ""; Connection con = DriverManager.getConnection(path, Username, Password); Statement s = con.createStatement(); String rGanTz = "UPDATE info SET Firstname = '"+txt_Firstname.getText()+"', Lastname = '"+txt_Lastname.getText()+"', Contact = '"+txt_Contact.getText()+"', WHERE '"+txt_Edpno.getText()+"'=EDPNO"; s.executeQuery(rGanTz); JOptionPane.showMessageDialog(null,"Data has been successfully Updated","Update file", JOptionPane.INFORMATION_MESSAGE,null);
tagged with: mysql
has title: java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). 23
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26774814
tagged with: database
has comment: http://stackoverflow.com/comment/42098037
accepted answer: http://stackoverflow.com/a/26774814
tagged with: sql-update
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42097572

http://stackoverflow.com/a/26822479
has comment: http://stackoverflow.com/comment/42214894
has comment: http://stackoverflow.com/comment/42214401
has comment: http://stackoverflow.com/comment/42215109
type: Answer
answers question: http://stackoverflow.com/q/26822258
has comment: http://stackoverflow.com/comment/42215531
has body: Consider using a switch statement. Edit: I added a CalOperation interface and concrete types to encapsulate the math operation and simplify the code. private CalcOperation calcChoice () { while (true) { String input = readInput.nextLine(); switch (input) { case "1": //intentional fall through case "A": return new AddOperation(); case "2": //intentional fall through case "S": return new SubtractOperation(); case "3": //intentional fall through case "M": return new MultiplyOperation(); case "4": //intentional fall through case "D": return new DivideOperation(); default: System.out.println("You have entered an invalid choice. Try again."); break; } } } public interface CalcOperation { public double calculate(double d1, double d2); } public class AddOperation implements CalcOperation { @Override public double calculate (double d1, double d2) { return d1 + d2; } } //create implementations for SubtractOperation, MultiplyOperation, and DivideOperation
score: 0

http://stackoverflow.com/a/26817109
has comment: http://stackoverflow.com/comment/42205178
has comment: http://stackoverflow.com/comment/42204674
downvote count: 0
has body: Here is a program that uses a semaphore to play ping pong. It is very similar to what you need for your goal. This program has one thread that will print PING, and the other prints PONG. It uses a semaphore to ensure that PING is printed first, then PONG, then PING and so on. Notice how this program uses two semaphores, and that it starts both semaphores at zero. This means that when the threads call acquire() on it, they will block. You have been using the value of one, which means that neither thread would block and that both would rush ahead. Now that all threads have blocked, we need to get one of them to start. We send a 'release()' signal to the semaphore that the thread that we want to start up on. That will increment the semaphore by one, and the thread blocked in acquire() will wake up and decrement it again before proceeding with its all important job of printing PING or PONG. Remember the following about semaphores: A semaphore contains an integer value (called a permit count) acquire() will block until the integer value is greater than zero; when greater than zero the count will be decremented by one before exiting release() never blocks. It only ever increments the integer value by one, and as a side effect wakes up any method that were blocked in a call to acquire(). Thus for a game of ping pong to work: (ascii art below scrolls to the right) s1=0 -- release() --> s1=1 s1=0 s2=0 s2=0 s2=1 thread1=blocked thread1 runs -- calls s2.release() --> thread1 blocked thread2=blocked thread2=blocked thread2 runs Notice how the values of s1 and s2 oscilate between 0 and 1, but we do not allow them both to have the value of 1 at the same time. If they were ever to both equal 1, then both thread1 and thread2 would be able to run at the same time. Which would be known as a race condition, as the order of their execution would be unpredictable. public class PingPong { public static void main( String[] args ) throws InterruptedException { final Semaphore s1 = new Sema…
has comment: http://stackoverflow.com/comment/42204940
has comment: http://stackoverflow.com/comment/42204659
has comment: http://stackoverflow.com/comment/42204879
type: Answer
has comment: http://stackoverflow.com/comment/42205165
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26816706
has comment: http://stackoverflow.com/comment/42205049
has comment: http://stackoverflow.com/comment/42204709
has comment: http://stackoverflow.com/comment/42204723
has comment: http://stackoverflow.com/comment/42204992

http://stackoverflow.com/comment/42117119
score: 0
comment on: http://stackoverflow.com/q/26768122
has text: Sorry I types a wrong title...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26819872
answer count: 0
has comment: http://stackoverflow.com/comment/42209395
type: UnansweredQuestion
has title: How do I trick multiple inheritance in Android
tagged with: java
has comment: http://stackoverflow.com/comment/42209567
has body: I have faced a problem when Activity needs to extend both ActionBarActivity and ListActivity simultaneously. Are there any ways to trick this? I know that java doesn't support multiple inheritance. The problem as follows: I've created auto-generated NavigationDrawer application and the MainActivity should extend ActionBarActivity to get this navigation panel work properly. And on the other hand I need a ListView (this library) to be used in MainActivity as a content. And the problem is that ListView library requires ListActivity to be extended. So I have 2 required extends.. Are there any non-painful ways to solve such situations?
type: Question
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/42209424
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42209545
has comment: http://stackoverflow.com/comment/42209358
has comment: http://stackoverflow.com/comment/42209484

http://stackoverflow.com/comment/42110503
score: 0
comment on: http://stackoverflow.com/q/26764562
type: Comment
type: QuestionComment
has text: i know and i am forbiden to work with them thats why my comment

http://stackoverflow.com/a/26719028
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26718921
has comment: http://stackoverflow.com/comment/42028141
answers question: http://stackoverflow.com/q/26718921
has body: As is, your path is relative to the calling class. Use /someImage.png instead.
type: AcceptedAnswer

http://stackoverflow.com/comment/135616892
type: AnswerComment
score: 0
type: Comment
has text: Will not work for other locales. "edit".toUpperCase() is "EDİT" in Turkish (Note the dot on the capital i) So "editThis".toUpperCase().startsWith("EDIT") returns false with a turkish locale.
comment on: http://stackoverflow.com/a/26794320

http://stackoverflow.com/comment/42135328
type: QuestionComment
has text: What does "can change at runtime" mean? Modifying the schema for applications at runtime is generally a terrible idea...
score: 0
comment on: http://stackoverflow.com/q/26776904
type: Comment

http://stackoverflow.com/comment/50112012
has text: it does for me, once for root context, and another one for servlet context, haven't tried for 3 or more overlappings though
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/30979926
type: Comment

http://stackoverflow.com/comment/42208614
has text: This is exactly what I've come up since I posted the question. Yes, this is not bullet-proof at all. After thinking for some time, I fugured that it would be much simpler and efficient to just randomly shift vertices within ±ε, and then checking what you've got and then randomly shifting again those edges that still appear to be collinear. And then throw an exception if this sequence of actions doesn't get rid of all the collinear edges in `N` iterations. I guess, chances to get an exception would be astronimically low. Or am I wrong?
type: Comment
comment on: http://stackoverflow.com/a/26818090
score: 0
type: AnswerComment

http://stackoverflow.com/a/26775341
has comment: http://stackoverflow.com/comment/42133236
has comment: http://stackoverflow.com/comment/42133686
answers question: http://stackoverflow.com/q/26774923
has comment: http://stackoverflow.com/comment/42132866
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/42132793
has comment: http://stackoverflow.com/comment/42133469
has body: This is a bit ugly, which probably signals that we're not meant to do it, but it appears to work: // Get some internal contexts ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); // Get the current pattern in the appender. OutputStreamAppender&lt;ILoggingEvent&gt; consoleapp = (OutputStreamAppender&lt;ILoggingEvent&gt;) logger.getAppender("console"); // Now check the pattern PatternLayoutEncoder encoder = (PatternLayoutEncoder) consoleapp.getEncoder(); String pattern = encoder.getPattern(); checkPatternAndWarnIfMissingVar(pattern,"id"); Note that this assumes an appender named "console". The list of appenders depend on your configuration and can be retrieved using: Iterator&lt;Appender&lt;ILoggingEvent&gt;&gt; it = logger.iteratorForAppenders(); while (it.hasNext()) { Appender&lt;ILoggingEvent&gt; app = it.next(); System.out.println( app.getName() ); }
score: 5
downvote count: 0

http://stackoverflow.com/q/26749536
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26750283
score: 1
has title: How to send multiple string variable using MultipartEntity from Android
tagged with: java
has answer: http://stackoverflow.com/a/26750154
type: Question
has answer: http://stackoverflow.com/a/26750156
downvote count: 0
favorite count: 0
answer count: 3
has body: I am trying to send images and values of Latitude and Longitude using MultipartEntity.Values of Latitude and Longitude are stored in a separate variable named plat and plong. I am able to sends images to the server but not both Latitude and Longitude. At the Server end only the Latitude ends up inserted into database. Bellow is the code that I am using to send the file and strings to the server. Can anyone suggest where I am doing wrong? private class UploadTask extends AsyncTask&lt;Bitmap, Void, Void&gt; { protected Void doInBackground(Bitmap... bitmaps) { if (bitmaps[0] == null) return null; setProgress(0); Bitmap bitmap = bitmaps[0]; ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); // convert // Bitmap // to // ByteArrayOutputStream InputStream in = new ByteArrayInputStream(stream.toByteArray()); // convert // ByteArrayOutputStream // to // ByteArrayInputStream DefaultHttpClient httpclient = new DefaultHttpClient(); try { HttpPost httppost = new HttpPost( "http://www.example.com/index.php"); // server MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("myFile", System.currentTimeMillis() + ".jpg", in); httppost.setEntity(reqEntity); reqEntity.addPart("long",String.valueOf(plong)); reqEntity.addPart("lat",String.valueOf(plat)); Log.e(TAG, "request " + httppost.getRequestLine()); HttpResponse response = null; try { response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { if (response != null) Log.i(TAG, "response " + response.getStatusLine().toString()); } finally { } } finally { } if (in != null) { try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (stream != null) { try { stream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStac…
tagged with: android
tagged with: multipartentity

http://stackoverflow.com/q/26816050
tagged with: testcase
type: Question
score: 0
has title: junit test assert, writing test
tagged with: junit
answer count: 1
has answer: http://stackoverflow.com/a/26816083
type: UnansweredQuestion
has body: I am writing test cases for my data array class. For this part, it is okay when the index is between 0 to 30000. public short value(int index) throws Exception { // what block-th buffer int block = (index * REC_SIZE) / BLOCK_SIZE; int offset = (index * REC_SIZE) % BLOCK_SIZE; byte[] curr = bufferPool.getBuffer(block).readBuffer(); short returnValue = ByteBuffer.wrap(curr) .getShort(offset + INDEX_VALUE); assert ((returnValue &gt; 0) &amp;&amp; (returnValue &lt;= 30000)) : "Invalid" + " &lt; Value &gt;: not between 1 to 30000"; return returnValue; } But I also need to test the assert line, which is assert ((returnValue &gt; 0) &amp;&amp; (returnValue &lt;= 30000)) : "Invalid" + " &lt; Value &gt;: not between 1 to 30000"; How can I write junit test that I can check when the index is NOT between 0 to 30000?
tagged with: java

http://stackoverflow.com/q/26805564
type: AnsweredQuestion
has title: Difference between NotesDocument objects from database and in-memory?
has comment: http://stackoverflow.com/comment/42296633
tagged with: java
tagged with: lotus-domino
has body: I have noticed in one of my Java agents that when storing a lot of Document objects in a Hashmap I get OutofMemoryException. What I'm trying to achieve is this: I want to populate my Domino database with information from an Oracle database. The logic is to get all from Oracle and then get all documents from Domino database. All new from Oracle is to be saved and all not in Oracle but in database shall be removed from Domino. A sort of replication of you will… I start with looping all documents in the Domino database and store them in a HashMap with UNID as key and Document object as value: dominoHash.put(doc.getUniversalId(), doc); Then I loop the resultset and creates in-memory Document objects: Document doc = db.createDocument(); doc.replaceItemValue("MyField", rset.getString("MYCOLUMN"); oracleHash.put(rset.getString("UNID"), doc); In my TEST environment I have +20000 Domino documents and the same in Oracle. In this case they are identical. The OutOfMemoryException occurs always when trying to store in oracleHash even if I have excluded all Domino document logic from the code to "save memory"… I thought the objects I'm storing in the different Hashmaps are the same but some how they are not. I can successfully store my Domino Document objects in a Hashmap but not my Oracle document objects. To make it more strange the document stored from Domino has more fields than the Oracle view has columns. Why could be the cause of this? In this specific case I use org.openntf.domino API and haven't tried native API (yet).
accepted answer: http://stackoverflow.com/a/26815327
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42196938
downvote count: 0
has answer: http://stackoverflow.com/a/26841366
has answer: http://stackoverflow.com/a/26815327
favorite count: 0
has comment: http://stackoverflow.com/comment/42189099
has comment: http://stackoverflow.com/comment/42185911
has comment: http://stackoverflow.com/comment/42195633
upvote count: 2
possible better answer: http://stackoverflow.com/a/26841366
has comment: http://stackoverflow.com/comment/42244705
score: 2

http://stackoverflow.com/q/26790697
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26794694
favorite count: 0
has comment: http://stackoverflow.com/comment/42157479
has comment: http://stackoverflow.com/comment/42157736
score: 1
tagged with: xpath
tagged with: selenium
upvote count: 1
has answer: http://stackoverflow.com/a/26794694
tagged with: selenium-webdriver
has title: Unable to select header/menu dropdown items using xpath/css traversing
type: AnsweredQuestion
tagged with: java
has body: I have attached the sample UI image of Application under test. I am using webdriver with java to get the list of header values & also get the drop down values. MY QUESTIONS - 1) using xpath, i am not able to get the size & also the text values of ONLY header (Test1, Test2, test3, help) 2) Secondly Test1 has drop down values, similarly Test2 & Test3. i should be able to get the size of test1 (should be 4), and then get the text values (Get Class 1 etc..) based on XPATH location. CODE Grid.driver().get("https://testpt1qa.com"); // Get Size of the Navigation Header WebElement parent = Grid.driver().findElement(By.xpath("//nav[@id='main-menu']")); List<WebElement> child = parent.findElements(By.tagName("li")); /** * THIS IS listing all the links under Test1,Test2,Test3 & Help */ System.out.println(child.size()); for (WebElement webElement : child) { String sizeval = webElement.getSize().toString(); System.out.println("********** " + sizeval); .... .... sample HTML Code Test1 Get Class 1 Get Class 2 Get Class 3 Get Class 4 ..... ..... Based on the above code, it prints the size of all dropdown values and header values, instead of specific ones.
type: Question

http://stackoverflow.com/q/26712072
type: Question
has title: Disabling a button in Netbeans GUI until correct password is put into the password field
has body: I'm very new at coding, and I want a swing button in the netbeans GUI to stay disabled until the correct password is entered to a password field. I have already created the password field, and given it a correct password. If you can keep it simple it would be appreciated, as I'm very new to programming in general.
answer count: 3
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/26715600
favorite count: 0
has answer: http://stackoverflow.com/a/33157662
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26712116
tagged with: swing
tagged with: passwords
tagged with: netbeans
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42006103
score: 2
comment on: http://stackoverflow.com/q/26706646
type: QuestionComment
type: Comment
has text: Don't use a KeyListener. Instead you should be using Key Bindings and Actions. Check out this simplified [example](http://stackoverflow.com/questions/21434873/setting-up-keylisteners-using-the-mvc-in-java/21436635#21436635).

http://stackoverflow.com/q/26757945
has answer: http://stackoverflow.com/a/26762785
has title: shuffle memory pool to be free : SPARK with Java
score: 1
tagged with: java
upvote count: 1
type: Question
has body: i want to join two list (NoHeaderIndexed and NoFirstIndexed) by the key likue this : final Broadcast&lt;JavaPairRDD&lt;Long, Tuple2&lt;String, String&gt;&gt;&gt; c = ctx.broadcast(noHeaderIndexed); JavaPairRDD&lt;Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;, Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;&gt; rs = noFirstIndexed.mapToPair(new PairFunction&lt;Tuple2&lt;Long, Tuple2&lt;String, String&gt;&gt;, Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;, Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;&gt;() { @Override public Tuple2&lt;Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;, Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;&gt; call(Tuple2&lt;Long, Tuple2&lt;String, String&gt;&gt; longTuple2Tuple2) throws Exception { String s1 = ""; if (c.value().lookup(longTuple2Tuple2._1).get(0)._1 != null) s1 = c.value().lookup(longTuple2Tuple2._1).get(0)._1; String s2 = ""; if (c.value().lookup(longTuple2Tuple2._1).get(0)._2 != null) s2 = c.value().lookup(longTuple2Tuple2._1).get(0)._2; return new Tuple2&lt;Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;, Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;&gt;(new Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;(new Tuple2&lt;String, String&gt;(longTuple2Tuple2._2._1,longTuple2Tuple2._2._2),longTuple2Tuple2._1),new Tuple2&lt;Tuple2&lt;String, String&gt;, Long&gt;(new Tuple2&lt;String, String&gt;(s1,s2),longTuple2Tuple2._1 ) ); } }); //writeResult(rs, "rs.txt"); rs.coalesce(1,true).saveAsTextFile(path+ "rs"); But when i try to execute it, it display this : INFO ShuffleMemoryManager: Thread 61 waiting for at least 1/2N of shuffle memory pool to be free And it doesn't terminate the execution. Could you please explain to me the problem and how can i fix it. Thank you in advance.
tagged with: apache-spark
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26824299
type: Answer
has body: There is a very big difference between constructors and methods. When you instantiate an object like it's done in the program Puppy myPuppy = new Puppy( "tommy" ); with the use of new keyword the JVM calls the constructor to make the object. So constructors make objects that doesn't exist but methods are associated with objects that exist. You can read more at this link http://www.javaworld.com/article/2076204/core-java/understanding-constructors.html
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26824253
upvote count: 3

http://stackoverflow.com/comment/42082166
has text: @ajb I didn't post the code for debugging. My question is still the same that I have posted. If i want to replace a value with any value other than one, the arraylist.set() method breaks. i was wondering if anyone code describe the arraylist.set behavior. My code works perfectly and gives the intended result apart from that.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26748668

jboss
tags question: http://stackoverflow.com/q/26708178
tags question: http://stackoverflow.com/q/26809772
tags question: http://stackoverflow.com/q/26752429
tags question: http://stackoverflow.com/q/26770991
tags question: http://stackoverflow.com/q/26720277
tags question: http://stackoverflow.com/q/26775619
tags question: http://stackoverflow.com/q/26702300
tags question: http://stackoverflow.com/q/26817891
tags question: http://stackoverflow.com/q/26757993
tag name: jboss
tags question: http://stackoverflow.com/q/26750342
tags question: http://stackoverflow.com/q/26690027
tags question: http://stackoverflow.com/q/26741633
tags question: http://stackoverflow.com/q/26803622
type: Tag
tags question: http://stackoverflow.com/q/26761813
tags question: http://stackoverflow.com/q/26675905
tags question: http://stackoverflow.com/q/26826516
tags question: http://stackoverflow.com/q/26801708
tags question: http://stackoverflow.com/q/26675368
tags question: http://stackoverflow.com/q/26783215
tags question: http://stackoverflow.com/q/26699797
tags question: http://stackoverflow.com/q/26818561
tags question: http://stackoverflow.com/q/26769963
tags question: http://stackoverflow.com/q/26720466

nosuchmethoderror
tags question: http://stackoverflow.com/q/26802592
type: Tag
tags question: http://stackoverflow.com/q/26814549
tag name: nosuchmethoderror

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/26772158
tags question: http://stackoverflow.com/q/26799760
tags question: http://stackoverflow.com/q/26731065
tags question: http://stackoverflow.com/q/26765212
tags question: http://stackoverflow.com/q/26690130
tags question: http://stackoverflow.com/q/26776200
tags question: http://stackoverflow.com/q/26725806
tags question: http://stackoverflow.com/q/26822561
tags question: http://stackoverflow.com/q/26793136
tags question: http://stackoverflow.com/q/26827343
tags question: http://stackoverflow.com/q/26758867
tags question: http://stackoverflow.com/q/26675778
tags question: http://stackoverflow.com/q/26805073
tags question: http://stackoverflow.com/q/26803026
tags question: http://stackoverflow.com/q/26726942
tags question: http://stackoverflow.com/q/26684009
tags question: http://stackoverflow.com/q/26818492
tags question: http://stackoverflow.com/q/26678546
tags question: http://stackoverflow.com/q/26782802
tags question: http://stackoverflow.com/q/26702747
tags question: http://stackoverflow.com/q/26766256
tags question: http://stackoverflow.com/q/26680656
tags question: http://stackoverflow.com/q/26703618
tags question: http://stackoverflow.com/q/26697102
tags question: http://stackoverflow.com/q/26711679
tags question: http://stackoverflow.com/q/26828332
tags question: http://stackoverflow.com/q/26684665
tags question: http://stackoverflow.com/q/26698434
tags question: http://stackoverflow.com/q/26753386
tags question: http://stackoverflow.com/q/26823214
tags question: http://stackoverflow.com/q/26784730
tags question: http://stackoverflow.com/q/26682547
tags question: http://stackoverflow.com/q/26710053
tags question: http://stackoverflow.com/q/26776311
type: Tag
tags question: http://stackoverflow.com/q/26830817
tags question: http://stackoverflow.com/q/26690527
tags question: http://stackoverflow.com/q/26776955
tags question: http://stackoverflow.com/q/26719669
tags question: http://stackoverflow.com/q/26743820
tags question: http://stackoverflow.com/q/26688131
tags question: http://stackoverflow.com/q/26768052
tags question: http://stackoverflow.com/q/26760299
tags question: http://stackoverflow.com/q/26744885
tags question: http://stackoverflow.com/q/26792641
tags question: http://stackoverflow.com/q/26683225
tags question: http://stackoverflow.com/q/26804330
tags question: http://stackoverflow.com/q/26783291
tags question: http://stackoverflow.com/q/26799798
tags question: http://stackoverflow.com/q/26826754
tags question: http://stackoverflow.com/q/26826442
tags question: http://stackoverflow.com/q/26682230
tags question: http://stackoverflow.com/q/26794595
tags question: http://stackoverflow.com/q/26762909
tags question: http://stackoverflow.com/q/26792489
tags question: http://stackoverflow.com/q/26791752
tags question: http://stackoverflow.com/q/26802589
tags question: http://stackoverflow.com/q/26767158
tags question: http://stackoverflow.com/q/26726621
tags question: http://stackoverflow.com/q/26696880
tags question: http://stackoverflow.com/q/26814673
tags question: http://stackoverflow.com/q/26793672
tags question: http://stackoverflow.com/q/26689104
tags question: http://stackoverflow.com/q/26697582
tags question: http://stackoverflow.com/q/26824467
tags question: http://stackoverflow.com/q/26756458
tags question: http://stackoverflow.com/q/26718649
tags question: http://stackoverflow.com/q/26807332
tags question: http://stackoverflow.com/q/26700500
tags question: http://stackoverflow.com/q/26741073
tag name: json
tags question: http://stackoverflow.com/q/26714110
tags question: http://stackoverflow.com/q/26783408
tags question: http://stackoverflow.com/q/26715215
tags question: http://stackoverflow.com/q/26700517
tags question: http://stackoverflow.com/q/26675967
tags question: http://stackoverflow.com/q/26781680
tags question: http://stackoverflow.com/q/26785551
tags question: http://stackoverflow.com/q/26690129
tags question: http://stackoverflow.com/q/26765531

http://stackoverflow.com/q/26703778
tagged with: android
tagged with: windows
answer count: 1
has body: I know this question has been beaten to death but I still cannot get the SDK Manager to run on my Windows 7 Home. I downloaded the eclipse + adt bundle. The SDK Manager.exe is in the sdk folder where I try to run it from. I even tried copying it to the tools folder and tried running from there but no luck. The error I get is: Failed to execute tools\android.bat: The system cannot find the file specified. The file clearly exists. I tried running it as "Administrator" as well. Next I tried running the android.bat file itself which says: Windows cannot find 'E:\path\to\batfile'. Make sure you typed the name correctly, and then try again. I then ran it as "Administrator" which at least detects and tries to execute it. I added in a few pause statements to android.bat itself to prevent it from closing. Here is what I see: '"E:\ADT\sdk\tools\lib\\find_java.exe" -s' is not recognized as an internal or external command, operable program or batch file. ERROR: No suitable Java found. In order to properly use the Android Developer Tools, you need a suitable version of Java JDK installed on your system. We recommend that you install the JDK version of JavaSE, available here: http://www.oracle.com/technetwork/java/javase/downloads If you already have Java installed, you can define the JAVA_HOME environment variable in Control Panel / System / Avanced System Settings to point to the JDK folder. Not sure why it says that because when I run where java in cmd I get this: C:\Users\(MyUser)&gt;where java C:\Program Files\Java\jdk1.8.0_05\bin\java.exe C:\ProgramData\Oracle\Java\javapath\java.exe C:\Windows\System32\java.exe And when I open cmd and manually run '"E:\ADT\sdk\tools\lib\\find_java.exe" -s' it works fine. I then tried setting the java_exe in android.bat to set java_exe=C:\Program Files\Java\jdk1.8.0_05\bin\java.exe After commenting out the find_java I ran it again and this is what I get: '"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar lib\archquery.jar' is not recogni…
has title: Android.bat can't run java
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42000947
has answer: http://stackoverflow.com/a/26704933
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42002688

http://stackoverflow.com/q/26808557
has title: Java code always returns error message (valid never equals true)
tagged with: if-statement
has answer: http://stackoverflow.com/a/26808842
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26808572
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42189893
has answer: http://stackoverflow.com/a/26808574
type: Question
has body: My boolean valid variable always seems to return false, which triggers the else error message. Any ideas why? I am trying to convert from bar code to zip code, and I have to check for data validation (make sure that only : and | are used for the barcode, and make sure that it is only 32 characters long. Then, I have to ignore the first and last | and only count the first 5 bar codes (lines 1-25 in the actual string/barcode.)) Then I convert whatever barcode I have in 1-25 into a zipcode/digits. public class JordanReynoldsHW7 { public static void main(String[] args) { String barCode = "|||:::||:::||:::||:::||:::||:::|"; boolean valid; valid = true; if (barCode.length() != 32) valid = false; for (int i = 0; i &lt; barCode.length(); i++) if (barCode.charAt(i) != ':' || barCode.charAt(i) != '|') valid = false; if (valid == true) { String zipCode = ""; for (int i = 1; i &lt;= 25; i = i + 5) zipCode += getNumber(barCode.substring(i, i + 5)); System.out.println(zipCode); } else System.out.print("error message"); } public static int getNumber(String s) { switch (s) { case "||:::": return 0; case ":::||": return 2; case "::|:|": return 3; case ":|::|": return 4; case ":|:|:": return 5; case ":||::": return 6; case "|:::|": return 7; case "|::|:": return 8; default: return 9; } } }

http://stackoverflow.com/comment/42206704
has text: That gives me an `java.lang.NumberFormatException`. Still unsure how to proceed, though.
comment on: http://stackoverflow.com/a/26815346
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26713148
has comment: http://stackoverflow.com/comment/42020256
type: Question
linked to: http://stackoverflow.com/q/5362036
has comment: http://stackoverflow.com/comment/61076402
tagged with: intellij-idea
score: 4
has comment: http://stackoverflow.com/comment/42017110
has comment: http://stackoverflow.com/comment/42032139
has title: How to optionally open last intellij project (or not) on startup?
has comment: http://stackoverflow.com/comment/42018380
answer count: 1
favorite count: 0
has body: I have just read this question: Stop intellij opening projects on startup Ideally, I would like to have 2 intellij icons on my desktop - one which opens the last project and one which doesn't. In other words, I would like the flexibility of both functions. Perhaps intellij has some command-line argument that specify which "mode" I desire on startup? I'd rather not have to fire up an editor and edit the xml each time I start up IntelliJ.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27663837
upvote count: 4
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42020186

http://stackoverflow.com/q/26734765
favorite count: 0
type: UnansweredQuestion
tagged with: java
tagged with: selenium
has body: I want to check if a certain element (more about block) is always at the top right of a page and above dynamic elements that can be available. How do I do that in Java and Selenium? What methods are best to use? the elements is as follows: private WebElement MoreAbout() { return SharedDriver.getSelenium().findElement(By.ById.id("more_about")); }
upvote count: 1
downvote count: 1
type: Question
tagged with: automation
has comment: http://stackoverflow.com/comment/42067888
has title: How to check the position of an element on a webpage
has answer: http://stackoverflow.com/a/26760123
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26738921

http://stackoverflow.com/comment/42065779
type: AnswerComment
type: Comment
has text: @HirakChhatbar yes i get a string
comment on: http://stackoverflow.com/a/26739427
score: 0

http://stackoverflow.com/a/26826832
has comment: http://stackoverflow.com/comment/42222098
type: Answer
answers question: http://stackoverflow.com/q/26826670
has comment: http://stackoverflow.com/comment/42237531
has body: after whole server's code has been executed Simple. Your server is done executing so it shut down and the client got a connection reset by peer. Try putting your server code in an infinite loop so it does not shut down too fast before you appreciate the magic of sockets. Like this, while(true){ // Your code here try{ Thread.sleep(10); // Don't forget this! } catch(InterruptedException ie){ ie.printStackTrace(); } } Code explanation: Putting your code in an infinite loop keeps your server program alive. Remember that Java code executes more or less linearly*. The Thread.sleep is necessary because otherwise your server will hog resources; think of it as your CPU's "breathing time". Now, to terminate your server, send it a shutdown signal (like kill or Ctrl+C). *Once you take into account the things the JVM does behind your back, it is not really linear. It is important to note this fact when doing Sockets because Sockets might eventually lead to Threads, and the things the JVM does is important when you handle concurrency. But for the purposes of a simple client-server program, I think this little handwaving is permissible.
score: 1
has comment: http://stackoverflow.com/comment/42222421
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26716975
accepted answer of: http://stackoverflow.com/q/26716740
downvote count: 0
answers question: http://stackoverflow.com/q/26716740
has body: Original answer was: If you just need to access each HashSet in the array by index, luni[0].add("string"), then you simply have to define luni as an array of Sets: But in fact, you'll need to use an ArrayList of Sets (or use an array of raw Set, but that's not as good), and you'll still be able to use it with an index: Note that this is only good if you don't have any actual use for the "A", "B", "C" and you just wanted to access the hashsets by index. List&lt;Set&lt;String&gt;&gt; luni = new ArrayList&lt;Set&lt;String&gt;&gt;(); luni.add( new HashSet&lt;String&gt;(500) ); luni.add( new HashSet&lt;String&gt;(500) ); luni.add( new HashSet&lt;String&gt;(500) ); luni.get(0).add("String");
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42024483
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42024133
upvote count: 1

http://stackoverflow.com/comment/42158838
has text: But why not add the `JTextArea`'s themsevles to a `JScrollPane`, and then add that to sub panels....?
comment on: http://stackoverflow.com/q/26788540
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26705451
accepted answer of: http://stackoverflow.com/q/26705396
has comment: http://stackoverflow.com/comment/42003938
answers question: http://stackoverflow.com/q/26705396
score: 6
type: Answer
downvote count: 0
type: AcceptedAnswer
upvote count: 6
has body: This is a bad idea. It is generally considered an anti-pattern for a constructor to call a method which changes behaviour based on a sub-class. If you really need this functionality, I suggest using a factory method on each class and preventing direct access to the constructors. The problem is you are calling an overridable method for an instance which is not fully initialised. Class A { private A() { //Do something } public static A newA() { A a = new A(); a.afterCreate(); return a; } } Class B extends A { private B() { super(); } public static B newB() { B b = new B(); b.afterCreate(); return b; } } Class C extends B { private C() { super(); //Do something } public static C newC() { C c = new C(); c.afterCreate(); return c; } }

http://stackoverflow.com/a/26883088
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/79611893
score: 7
answers question: http://stackoverflow.com/q/26779014
upvote count: 7
accepted answer of: http://stackoverflow.com/q/26779014
has body: ADDED LATER: Here is a link to my educational project with implementation below. I'll be glad if it helps someone. ORIGINAL ANSWER: Well... I found the solution myself. First of all, I have created my own widget - "client side" component (according to this article). Client side part: public class GWTMyCanvasWidget extends Composite { public static final String CLASSNAME = "mycomponent"; private static final int FRAMERATE = 30; public GWTMyCanvasWidget() { canvas = Canvas.createIfSupported(); initWidget(canvas); setStyleName(CLASSNAME); } Connector: @Connect(MyCanvas.class) public class MyCanvasConnector extends AbstractComponentConnector { @Override public Widget getWidget() { return (GWTMyCanvasWidget) super.getWidget(); } @Override protected Widget createWidget() { return GWT.create(GWTMyCanvasWidget.class); } } Server side part: public class MyCanvas extends AbstractComponent { @Override public MyCanvasState getState() { return (MyCanvasState) super.getState(); } } Then I just add MyCanvas component on my View: private void createCanvas() { MyCanvas canvas = new MyCanvas(); addComponent(canvas); canvas.setSizeFull(); } And now I can draw anything on Canvas (on client side in GWTMyCanvasWidget) with great performance =). Example: public class GWTMyCanvasWidget extends Composite { public static final String CLASSNAME = "mycomponent"; private static final int FRAMERATE = 30; private Canvas canvas; private Platform platform; private int textX; public GWTMyCanvasWidget() { canvas = Canvas.createIfSupported(); canvas.addMouseMoveHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (platform != null) { platform.setCenterX(event.getX()); } } }); initWidget(canvas); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent resizeEvent) { resizeCanvas(resizeEvent.getWidth(), resizeEvent.getHeight()); } }); initGameTimer(); resizeCanvas(Window.getClientWidth(), Window.getClientHeight()); setStyleName(CL…
has comment: http://stackoverflow.com/comment/80863403
type: AcceptedAnswer

http://stackoverflow.com/q/26824827
has comment: http://stackoverflow.com/comment/42218516
has body: I'm having difficulty with a current program. When I try and check whether the node (an object) is null I get a NullPointerException which I though you were allowed to do. I'm getting the exception in this if statement else if(direction == 0) { cursor = cursor.getParent(); if(cursor.getRight() != null) direction = 1; else direction = 0; } I get the exception on the third line 'if(cursor.getRight() != null)' which I've tried multiple ways to write it and still get the same exception. ('if(null != cursor.getRight)' and 'if(!(null == cursor.getRight())' The getRight() method returns the instance of the next node (object) and is initialized to null when that object is initialized.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26824873
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/26824846
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26824873
has title: Getting a NullPointerException when I make a == comparison with null
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26824867
type: Question
has answer: http://stackoverflow.com/a/26824869
has comment: http://stackoverflow.com/comment/42218510
has comment: http://stackoverflow.com/comment/42229071
tagged with: java
possible better answer: http://stackoverflow.com/a/26824846
score: 0

http://stackoverflow.com/comment/42083157
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26749425
has text: @Abdul Ahmad I just don't know where I went wrong.

http://stackoverflow.com/comment/42138550
type: Comment
type: QuestionComment
has text: What is the status then ? R u succeed in ur task ?
comment on: http://stackoverflow.com/q/26756496
score: 0

http://stackoverflow.com/q/26723448
favorite count: 0
accepted answer: http://stackoverflow.com/a/26723537
has comment: http://stackoverflow.com/comment/42036602
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26723624
tagged with: java
has answer: http://stackoverflow.com/a/26723537
has body: I am trying to sort one array to two other arrays that have to be exact length. Why am I getting the error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at Tal.main(Tal.java:39) when running this? I know there is better way to solve this task but I am not allowed to. I have to do it this way. public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("How many random numbers from 0 to 999? "); int amount = in.nextInt(); int lowerCounter = 0; int higherCounter = 0; int[] numbers = new int[amount]; System.out.print("Here is the random numbers: "); for (int i = 0; i &lt; numbers.length; i++) { numbers[i] = (int) Math.floor(Math.random()*1000); System.out.print(numbers[i] + " "); if (numbers[i] &lt;= 499) { lowerCounter++; } else { higherCounter++; } } System.out.println(""); int[] numbersLow = new int[lowerCounter]; int[] numbersHigh = new int[higherCounter]; for(int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &lt;= 499) { numbersLow[i] = numbers[i]; } else { numbersHigh[i] = numbers[i]; } } System.out.print("These "+ lowerCounter +" numbers are from 0 to 499: "); for(int i = 0; i &lt; numbersLow.length; i++) { System.out.print(numbersLow[i] + " "); } System.out.println(""); System.out.print("These "+ higherCounter +" numbers are from 500 to 999: "); for(int i = 0; i &lt; numbersHigh.length; i++) { System.out.print(numbersHigh[i] + " "); } }
has title: ArrayIndexOutOfBoundsException when assigning new arrays
type: Question
has comment: http://stackoverflow.com/comment/42036641
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42036619
has answer: http://stackoverflow.com/a/26723624
upvote count: 1
tagged with: arrays
downvote count: 1
has comment: http://stackoverflow.com/comment/42036561

http://stackoverflow.com/q/26831867
type: Question
has comment: http://stackoverflow.com/comment/42230559
upvote count: 0
has body: For this project I'm attempting I need to check if a hand of 5 cards, given as an array of 5 integers, is a straight. Right now I'm not sure how to check this as the array is not ordered and we are not allowed to use the Arrays.sort() method to sort it. The only way I can think of right now is to manually sort them using loops but I think this would be inefficient. Any input would be appreciated.
answer count: 1
has comment: http://stackoverflow.com/comment/42230599
favorite count: 0
has title: Card Program in Java
has answer: http://stackoverflow.com/a/26834253
type: UnansweredQuestion
score: -3
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42230321

http://stackoverflow.com/a/26727003
type: Answer
score: 4
upvote count: 4
has body: You can try the following: int number = 1234; int length = Integer.toString(number).length(); int[] a = new int[length]; int index = length - 1; for (int i = 0; i &lt; length; i++){ a[i] = number % 10; number = number / 10; index--; } Convert the number to String to get the size and use that value to declare the length of the array and then just loop through it, extracting the last number using modulus and then dividing to get rid of the last digit in the integer.
answers question: http://stackoverflow.com/q/26726921
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26726921
has comment: http://stackoverflow.com/comment/42042909

http://stackoverflow.com/comment/41977345
type: Comment
comment on: http://stackoverflow.com/a/26686345
has text: Unfortunately sudo nor such are available, no idea what yocto has for options :/
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42169172
type: Comment
type: QuestionComment
has text: So there is no gain with public attributes? I'm thinking that if I'm in a method that has 200 attributes and performs a loop 5000 times. In this loop I do a get method to access a variable. That means 200 variables has to be pushed and popped 5000 times every time I call the method. That's quite a few instructions wasted. Or have I misunderstood something?
comment on: http://stackoverflow.com/q/26797354
score: 0

http://stackoverflow.com/comment/42007605
type: Comment
has text: Could I ask you for an example of what you mean by "call an element of the ttsUtteranceComplete()". Thanks.
comment on: http://stackoverflow.com/a/26706408
score: 0
type: AnswerComment

http://stackoverflow.com/q/26776417
tagged with: http://stackoverflow.com/tag/csv
has body: I have a small problem concerning using a .csv file with the Resttemplate from java spring. It looks somehow like: URL url = URL url = new URL("http://data.wien.gv.at/daten/geo?service=WFS&amp;version=1.0.0&amp;request=GetFeature&amp;typeName=ogdwien:GEONAMENSVERZOGD&amp;outputFormat=CSV"); RestTemplate restTemplate = new RestTemplate(); Late on I want to use the getForObject() Method by the restTemplate, but I down't know how to proceed since I can't find matching paramteres anywehere on the internet. Thank you for your help!
answer count: 1
has title: How can I work with a .csv file using Java Spring Resttample?
favorite count: 0
upvote count: 3
tagged with: resttemplate
tagged with: spring
has answer: http://stackoverflow.com/a/26777008
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26777008

http://stackoverflow.com/comment/41954339
has text: The purpose of this is not to side step it for testing, this is to allow for my co-workers to attempt to diagnose against a live (albeit local) environment. Kind of like a workshop.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26677465

http://stackoverflow.com/a/26690562
score: 1
has body: Since you have an existing arrayadapter,you can merely modify the existing dataset. first set the implicit notifydatasetchanged to false adapter.setNotifyOnChange(false); then remove the existing elements in your array and add the new elements adapter.clear() adapter.addAll(newMethods); You are setting the implicit notification to false because you dont want the view to update both times (when you clear and add elements to the list). You dont have to worry about context here.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26690166
answers question: http://stackoverflow.com/q/26690166
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42175476
comment on: http://stackoverflow.com/q/26800860
score: 1
has text: @HirakChhatbar that might depend on your update channel. To get the very latest use the canary channel. That is bleeding edge so be sure what you do...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26746622
answers question: http://stackoverflow.com/q/26743656
score: 3
has comment: http://stackoverflow.com/comment/86074743
downvote count: 0
has body: Turns out that the reason this was failing was because my code could not reach the datanode due to it being inside of a Docker container and it's IP address being the internal Docker container's IP address. If I'm inside of the container and run the code, then I'm able to put the file successfully.
has comment: http://stackoverflow.com/comment/86085663
type: Answer
has comment: http://stackoverflow.com/comment/86118720
upvote count: 3

http://stackoverflow.com/q/26804489
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42182145
has title: Not sure about Array size
favorite count: 0
has body: How may I define an array in Java. when I am not sure of the Arrays size. I am doing it to avoid Null Pointers int[] arr1 = new int[21]; int[] arr1 = {11,22,33}; These are of fixed length, i need to declare an Array where the items to be stored in it will be decided at run time?
has answer: http://stackoverflow.com/a/26804517
has comment: http://stackoverflow.com/comment/42182149
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26804510
downvote count: 0
score: 1
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/1647260
has answer: http://stackoverflow.com/a/26804528
accepted answer: http://stackoverflow.com/a/26804528
linked to: http://stackoverflow.com/q/1647260
has answer: http://stackoverflow.com/a/26804510

http://stackoverflow.com/comment/42200573
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26814651
has text: I made an update to the code to show how PHP spits it back. Is it maybe a PHP problem.

http://stackoverflow.com/a/26721757
answers question: http://stackoverflow.com/q/26721627
type: Answer
has body: ok just to answer my own question i ended up using EntityUtils.toString(response.getEntity()) and changing the respone type to json, tho I still cant understand why didn't the document.parse() work well since with the above line and still requesting for xml it returned the correct string
score: 0
accepted answer of: http://stackoverflow.com/q/26721627
type: AcceptedAnswer

http://stackoverflow.com/a/26767113
has body: Finally I find the solution in this question. Just need to add -Wl,--add-stdcall-alias to my .bat file when I create dll. swig -c++ -java -package preprocessor Point.i g++ -c -std=c++11 Point.cpp Point_wrap.cxx -I E:\ProgramFiles\jdk\include -I E:\ProgramFiles\jdk\include\win32 g++ -shared Point_wrap.o Point.o -Wl,--add-stdcall-alias -o point.dll rkapl, thank you for respond!
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26742319
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26742319

http://stackoverflow.com/comment/42210055
type: QuestionComment
comment on: http://stackoverflow.com/q/26820118
has text: OK well, to be abrupt and sorry for that, SO is not a free coding service; now, less abrupt, learning how to program will mean you'll get burnt before you get it right, so try and do it by your own means; if you cannot, then ask a question. Also, remember not to fall prey to the [XY problem syndrome](http://xyproblem.info)
score: 0
type: Comment

http://stackoverflow.com/a/26706655
type: Answer
has comment: http://stackoverflow.com/comment/42006277
answers question: http://stackoverflow.com/q/26706612
has body: Look into using Thread.sleep(1000); to pause execution for one second. http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html
has comment: http://stackoverflow.com/comment/42006636
score: 0

http://stackoverflow.com/a/26684081
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26684009
upvote count: 1
has body: There's an alternative to do that with Lists, which are really easy to manipulate. You can add your Strings to a List and then create a JSON from it: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("ONE"); list.add("TWO"); list.add("THREE"); Gson gson = new Gson(); String array = gson.toJson(list);
downvote count: 0

http://stackoverflow.com/a/26792903
has body: Use an HttpsURLConnection and SSLSocketFactory to perform the SSL handshake.
has comment: http://stackoverflow.com/comment/42161184
type: Answer
has comment: http://stackoverflow.com/comment/42161177
score: -5
has comment: http://stackoverflow.com/comment/42161106
answers question: http://stackoverflow.com/q/26792813
upvote count: 0
has comment: http://stackoverflow.com/comment/42161230
downvote count: 5

http://stackoverflow.com/q/26789605
downvote count: 2
has comment: http://stackoverflow.com/comment/42162363
has comment: http://stackoverflow.com/comment/42155444
has answer: http://stackoverflow.com/a/26789760
tagged with: java
has comment: http://stackoverflow.com/comment/42155496
has title: Assigning name and account to BankAccount project
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42155420
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26790365
has body: I'm almost in the home stretch for this project, and have hit an insurmountable speed bump. I have my main and a method below which looks something like this: import java.util.Scanner; public class Proj3 { public static void main (String []args) { BankAccount cust1 = new Proj3().createAccount(); BankAccount cust2 = new Proj3().createAccount(); BankAccount cust3 = new Proj3().createAccount(); } public BankAccount createAccount() { Scanner kb = new Scanner (System.in); //input for Strings Scanner kb2 = new Scanner (System.in); //input for numbers String strName; //Holds account name String strAccount; //Holds account number String strResponse; //Holds users response to account creation double dDeposit; //Holds intial deposit into checking BankAccount b1; { System.out.print ("\nWhat is the name of the account? "); strName = kb.nextLine(); b1.setName(strName); while (strName.length()==0) { System.out.print ("\nPlease input valid name."); System.out.print ("\nWhat is the name of the account?"); strName = kb.nextLine(); } System.out.print ("Would you like to create this account? (Y or N)"); strResponse = kb.nextLine(); strResponse = strResponse.toUpperCase(); if (strResponse.equals("Y")) { BankAccount b1 = new BankAccount(strName, strAccount, dDeposit); } else { b1 = null; } and I have a BankAccount class which looks something like this: import java.util.Scanner; public class BankAccount { private String name; //Holds name of customer private String account; //Holds account number of private double checkingAccount; //Holds balance for checking private double savingsInterestRate; //Holds annual interest rate on savings private double savingsAccount; //Holds balance for savings private int savingsDays; //Holds days for calc. savings interest private double totalEarnedInterest; //Holds total interest earned public BankAccount (String name, String account, double amount) { setName(name); setAccount(account); setChecking(amount); } public void setName (String name) { this.name…
has comment: http://stackoverflow.com/comment/42156289
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26743457
has body: public boolean removeAccount (String accountNumber) { int index = 0; boolean found = false; while (index &lt; accounts.size() &amp;&amp; !found) { if ( accounts.get(index).getAccountNumber().equals(accountNumber)) { found = true; accounts.remove(accountNumber); } else index++; } if (found == true) { return true; } else return false; } When I enter a correct account number it returns true, however it doesn't remove the account from the ArrayList, any help would be appreciated :)
has answer: http://stackoverflow.com/a/26743514
tagged with: java
type: Question
has title: Removing Objects (Account) from an ArrayList
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42072585
answer count: 2
has answer: http://stackoverflow.com/a/26743499
has comment: http://stackoverflow.com/comment/42072642
type: UnansweredQuestion

http://stackoverflow.com/q/26826719
has body: I'm trying to create a basic login screen but when I run it, the text box is huge and increases when I maximize the window. How do I get it to stay with a fixed size? public class LoginScreen { LoginScreen() { JFrame frame = new JFrame(); Box b = Box.createVerticalBox(); JLabel title = new JLabel("Welcome to login screen"); b.add(title); title.setAlignmentX(JFrame.CENTER_ALIGNMENT); title.setFont(title.getFont().deriveFont(20.0f)); title.setBorder(new EmptyBorder(20,10,20,10)); Box c = Box.createHorizontalBox(); JLabel login = new JLabel("Login Id"); login.setAlignmentX(JFrame.CENTER_ALIGNMENT); JTextField loginf = new JTextField(""); loginf.setAlignmentX(JFrame.CENTER_ALIGNMENT); c.add(login); c.add(loginf); b.add(c); frame.add(b); frame.setSize(450,350); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new LoginScreen(); } }); } }
has title: BoxLayout and JTextField not working the way I need it to
tagged with: java
has answer: http://stackoverflow.com/a/26826856
tagged with: jtextfield
tagged with: boxlayout
type: Question
has comment: http://stackoverflow.com/comment/42221611
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42221555
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/comment/42063086
type: Comment
has text: Okay I'm requesting the api and getting the json response.. However converting it to a object is confusing me because the json is so verbose. https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AIB.IR%22%2C%22BIR.IR%22)%0A%09%09&format=json&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback= This is the api. Is there anyway to add a paramter to the url to just return the "result" array, as thats all I need?
comment on: http://stackoverflow.com/a/26701599
type: AnswerComment
score: 0

http://stackoverflow.com/q/26698516
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26766620
tagged with: java
tagged with: lwjgl
type: Question
has body: I'm creating a LWJGL Strategy Game, and I'm implementing multiplayer into it. Right now the game is just generating a world with some different tile types. I thought I should start implementing networking now, to make the server generate the world,and all clients joining download that world and load it (even though the game is barely a playable yet) to make it easier to implement more advanced stuff later on. Now to the problem! I'm watching these tutorials on networking implementation, made by DesignsbyZephyr, but I'm getting this error: java.net.BindException: Address already in use: Cannot bind at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method) at java.net.DualStackPlainDatagramSocketImpl.bind0(Unknown Source) at java.net.AbstractPlainDatagramSocketImpl.bind(Unknown Source) at java.net.DatagramSocket.bind(Unknown Source) at java.net.DatagramSocket.&lt;init&gt;(Unknown Source) at java.net.DatagramSocket.&lt;init&gt;(Unknown Source) at java.net.DatagramSocket.&lt;init&gt;(Unknown Source) at com.tdd12.eotu.net.GameServer.&lt;init&gt;(GameServer.java:22) at com.tdd12.eotu.Game.&lt;init&gt;(Game.java:39) at com.tdd12.eotu.Game.main(Game.java:121) Exception in thread "Thread-3" java.lang.NullPointerException at com.tdd12.eotu.net.GameServer.run(GameServer.java:37) When I start the game two times with the same port. That sounds pretty weird, doesn't it? I don't know why, maybe because I'm not very experienced with network programming (as you've maybe already understood). Here is the code I'm using: (The code is placed in classes and packages, so they are correctly formatted. I just didn't write that here) GameServer.java: // The socket private DatagramSocket socket; // The main game private Game game; // The constructor public GameServer(Game game) { // Assign variables this.game = game; try { this.socket = new DatagramSocket(9527); } catch (SocketException e) { e.printStackTrace(); } } // Run the thread public void run() { while(true) { // The data …
tagged with: network-programming
answer count: 1
has title: Java networking - java.net.BindException
accepted answer: http://stackoverflow.com/a/26766620
score: 0
has comment: http://stackoverflow.com/comment/41992152
has comment: http://stackoverflow.com/comment/41991358
has comment: http://stackoverflow.com/comment/41991279
has comment: http://stackoverflow.com/comment/41991310

http://stackoverflow.com/comment/42068969
comment on: http://stackoverflow.com/q/26741568
score: 0
has text: Have you though about the garbage collector has to run so many times ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41977474
type: QuestionComment
comment on: http://stackoverflow.com/q/26690419
has text: Do you pass arguments when calling your main method?
score: 0
type: Comment

http://stackoverflow.com/a/26913804
type: Answer
score: 1
upvote count: 1
has body: I believe that just recently we discussed in person that this problem is actually solved by using Google Service accounts as documented over here: https://developers.google.com/accounts/docs/OAuth2ServiceAccount The credentials are the built like this: String emailAddress = "123456789000-abc123def456@developer.gserviceaccount.com"; JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(emailAddress) .setServiceAccountPrivateKeyFromP12File(new File("MyProject.p12")) .setServiceAccountScopes(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN)) .build();
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26758185
accepted answer of: http://stackoverflow.com/q/26758185

http://stackoverflow.com/comment/42008914
score: 1
type: Comment
type: QuestionComment
has text: `String data="["INESIS","13-ARTENGO-P1046","19"]"` is not a valid statement in Java. It is a syntax error!
comment on: http://stackoverflow.com/q/26708346

http://stackoverflow.com/comment/42225052
type: Comment
type: QuestionComment
has text: If you like to write some examples that will be really good. I want to learn openGL the right way so please do :)
comment on: http://stackoverflow.com/q/26767516
score: 0

http://stackoverflow.com/comment/42065109
type: Comment
type: QuestionComment
score: 6
has text: Why are you using the `hashCode()` as the key? That's just *asking* for trouble. And what makes you think your current code is *copying* a list at all? It's just fetching a reference. (You don't need the `put` at the end...) Time to learn more about hash codes and references, IMO.
comment on: http://stackoverflow.com/q/26739579

http://stackoverflow.com/comment/41951862
comment on: http://stackoverflow.com/a/26676140
score: 0
type: AnswerComment
type: Comment
has text: That's how I did it. Design flow is like that because I load records from 2 files into 2 different arrays. It must be like that. Since I did what you have written, even though it was before you have written ... I mark it as an answer. Thank you.

http://stackoverflow.com/comment/41971206
comment on: http://stackoverflow.com/q/26686735
has text: Simply go to MySQL and perform following query. set global max_allowed_packet=100000;
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26719981
has body: I have read a number of discussions on web and stack which claim singletons to be evil. Like: root-cause-of-singletons and Why is Singleton considered an anti-pattern? I read comments like "singletons make code complex, pain to reuse and test". I work with code that has Spring Services which are stateless singletons and I can't see how those points hold here. Do such services also qualify as bad practices and why? Or all the debate is on statefull singletons only?
answer count: 3
has comment: http://stackoverflow.com/comment/42071527
tagged with: singleton
has answer: http://stackoverflow.com/a/26720632
favorite count: 0
tagged with: spring
tagged with: design-patterns
has answer: http://stackoverflow.com/a/26720135
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26720632
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/26720135
has comment: http://stackoverflow.com/comment/42030191
linked to: http://stackoverflow.com/q/12755539
type: Question
has title: Are Java Spring services evil as they are singleton?
has answer: http://stackoverflow.com/a/26720145
downvote count: 0

http://stackoverflow.com/q/26700265
type: AnsweredQuestion
has title: Random.choice Equivalent in Java for an Array
tagged with: java
has answer: http://stackoverflow.com/a/26700360
has answer: http://stackoverflow.com/a/26700322
accepted answer: http://stackoverflow.com/a/26700322
type: Question
has body: Here is an example of my random.choice implementation in Python. available_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Queen', 'King', 'Jack', 'Ace'] random_computer_card = random.choice(available_cards) print random_computer_card Just wondering what the Java equivalent would be for this piece of code. Obviously I haven't included the import statement in the sample. Thanks in advance :)
tagged with: python-3.4
score: 5
upvote count: 6
has answer: http://stackoverflow.com/a/26700325
answer count: 3
downvote count: 1
possible better answer: http://stackoverflow.com/a/26700325
favorite count: 0
tagged with: netbeans

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/26809558

http://stackoverflow.com/q/26714126
has comment: http://stackoverflow.com/comment/42019104
has answer: http://stackoverflow.com/a/26714301
tagged with: variables
tagged with: string
score: 0
has title: Use one string in multiple "classes"
tagged with: android
linked to: http://stackoverflow.com/q/4646577
has answer: http://stackoverflow.com/a/26714356
has comment: http://stackoverflow.com/comment/42018680
accepted answer: http://stackoverflow.com/a/26714356
type: AnsweredQuestion
tagged with: java
has body: I'm not great with android so I'm just going to ask you this: I want to transfer some "data" (GPS Coordinates) from my location listener to a string, that will be used in an onClick function. Such as: case R.id.sendButton: ParsePush push = new ParsePush(); String message = "Hey, My coordinates are - LONG:" + loc.getLongitude();; push.setChannel("test1"); push.setMessage(message); push.sendInBackground(); break; Yes, I DO have a location listener: class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { mlocation.setText(""); Toast.makeText( getBaseContext(), "Location changed: Lat: " + loc.getLatitude() + " Lng: " + loc.getLongitude(), Toast.LENGTH_SHORT).show(); String longitude = "Longitude: " + loc.getLongitude(); Log.v("Long", longitude); String latitude = "Latitude: " + loc.getLatitude(); Log.v("Lat", latitude); ETC.... So basically, I want to be able to set my longitude to a certain variable(string) and use that string in my onClick button. How can I do this? Any links whatsoever would be great. Thanks!
tagged with: global-variables
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26714301

http://stackoverflow.com/comment/42082054
type: AnswerComment
type: Comment
has text: Oh i thought some mathematical logic would convert this Dlist to 2darray directly. Thats fine.
comment on: http://stackoverflow.com/a/26731379
score: 0

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26782436
tags question: http://stackoverflow.com/q/26708130
tags question: http://stackoverflow.com/q/26799483

http://stackoverflow.com/comment/42107905
type: Comment
comment on: http://stackoverflow.com/a/26761453
has text: The thing that uniquely identifies a movie is its ID. Keep using that as a key, and add fields for additional data to Movie class.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42095265
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26756505
has text: @VictorS: Then your options are the second and third ones in my answer: do two things with the bytes as you download them (more efficient but perhaps more difficult to code), or read in the file once you save it (easier but adds more disk I/O).

http://stackoverflow.com/comment/42051593
has text: @MarkoTopolnik So, now you realize difference between implementation and inheritance?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26731794
score: 0

http://stackoverflow.com/comment/42113094
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26766013
score: 0
has text: Have you upgraded to java 8? If so - https://www.eclipse.org/downloads/java8/

http://stackoverflow.com/comment/42161685
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26793117
has text: How about writing a `while` loop around the "read" and "check" part? Here is an example for reading the whole file with a `BufferedReader`: http://www.mkyong.com/java/how-to-read-file-from-java-bufferedreader-example/.
type: QuestionComment

http://stackoverflow.com/q/26821319
has title: javafx listview and treeview controls are not repainted correctly
has comment: http://stackoverflow.com/comment/42213492
tagged with: repaint
tagged with: treeview
upvote count: 7
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26822360
type: Question
has body: i am trying to put elements on a listview and treeview with javafx, but both controls wont refresh theyre content. i am using an obvservable list to control the items and every time i delete one item, the listview or treeview removes it from the datasource. but the view is not updating. i am still seeing all the items. the only difference is, the removed item can not be selected any more. for example link 2 shows the collaped item list. image 1 shows the items before they are collaped. the items are collapsed but the old entry is still visible. does anybody know a solution for this problem. thank you all for helping me link 1: treeview is not collapsed link 2: treeview is collapsed but not updating old view this is the custom cell factory i use to display a listview: public ListCell&lt;T&gt; call(final ListView&lt;T&gt; param) { ListCell&lt;T&gt; cell = new ListCell&lt;T&gt;(){ @Override protected void updateItem(final T persistentObject, final boolean empty) { super.updateItem(persistentObject, empty); if(persistentObject instanceof POProcessStep){ POProcessStep poProcessStep = (POProcessStep) persistentObject; if (persistentObject != null) { super.setText(poProcessStep.getId() + " - " + poProcessStep.getTitle()); } }else if(persistentObject instanceof POProcess){ POProcess poProcess = (POProcess) persistentObject; if (persistentObject != null) { super.setText(poProcess.getId() + " - " + poProcess.getTitle()); } }else if(persistentObject instanceof POCategory){ POCategory poCategory = (POCategory) persistentObject; if(persistentObject != null){ super.setText(poCategory.getId() + " - " + poCategory.getTitle()); } }else if(persistentObject instanceof String){ if(persistentObject != null){ super.setText(String.valueOf(persistentObject)); } } super.setGraphic(null); } }; return cell; }
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26822360
favorite count: 0

http://stackoverflow.com/comment/42019690
score: 0
has text: The base test is also annotated with `@RunWith(SpringJUnit4ClassRunner.class)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26714607

http://stackoverflow.com/q/26823802
accepted answer: http://stackoverflow.com/a/26823942
has comment: http://stackoverflow.com/comment/42216741
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42216711
tagged with: java
has body: I'm just starting with coding here, so bear with me, please. I tried doing this simple task (at least it looked simple), which states: "Read two integers, then write out all of them that are dividable by either 2, 3, or 5. My code has no problems dealing with small numbers, however it gets complicated when I get into millions. The program just times out, or takes a ridiculous amount of time to calculate. Help appreciated! import java.util.Scanner; class Veckratniki { public static void main(String[] args) { long v = 0; Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); while (a &lt;= b) { if ((a % 2 == 0) || (a % 3 == 0) || (a % 5 == 0)) { v++; a++; } else { a++; } } System.out.println(v); } }
type: Question
tagged with: long-integer
has title: Code does not work for large numbers
has answer: http://stackoverflow.com/a/26823942
score: 0
answer count: 1

http://stackoverflow.com/a/26795655
has body: In the end all I had to do was: Disable hostname verification: // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); Make sure that the default cacerts file is used, as while researching I tried to disable ssl certificate verification and used code which can be found in a great number of threads on SO (implementing own X509TrustManager), i.e. in Java: Overriding function to disable SSL certificate check. This code replaced default SSLSocketFactory, which I needed. So I had to delete all this stuff and use code disabling hostname verification only. I left HttpURLConnection. No need to replace it with HttpsURLConnection. Definitely it would be much better if I managed to avoid disabling hostname verification as well, but I couldn't. Probably something wrong with the certificates..
type: Answer
score: 7
accepted answer of: http://stackoverflow.com/q/26792813
upvote count: 8
answers question: http://stackoverflow.com/q/26792813
has comment: http://stackoverflow.com/comment/74718298
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/a/26740258
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42067646
has comment: http://stackoverflow.com/comment/42069618
has comment: http://stackoverflow.com/comment/42068650
has comment: http://stackoverflow.com/comment/42067064
has comment: http://stackoverflow.com/comment/42067254
has comment: http://stackoverflow.com/comment/42067691
has comment: http://stackoverflow.com/comment/42068517
type: Answer
has body: Because it can't. Since there are only 2^32 different ints and there may be more than 2^32 live objects in any VM instance, it is technically impossible to guarantee a unique hash code for each object. Even if the default hash code may be based on the internal address of the object, it is not identical to the internal address.
has comment: http://stackoverflow.com/comment/42068221
has comment: http://stackoverflow.com/comment/42069226
upvote count: 2
has comment: http://stackoverflow.com/comment/42079843
has comment: http://stackoverflow.com/comment/42067573
has comment: http://stackoverflow.com/comment/42067925
has comment: http://stackoverflow.com/comment/42070742
accepted answer of: http://stackoverflow.com/q/26740091
has comment: http://stackoverflow.com/comment/42067604
has comment: http://stackoverflow.com/comment/42066421
answers question: http://stackoverflow.com/q/26740091
has comment: http://stackoverflow.com/comment/42066606
has comment: http://stackoverflow.com/comment/42067441
score: 2

http://stackoverflow.com/comment/42096047
score: 0
type: Comment
has text: @user1961779 how can I delete the .equals(doei)) without corrupting the above script?
comment on: http://stackoverflow.com/a/26755338
type: AnswerComment

http://stackoverflow.com/comment/42220708
score: 0
type: Comment
has text: *but I assume that this object is a BaseFont object using IDENTITY_H as encoding.* - you are an optimist. ;)
comment on: http://stackoverflow.com/a/26819292
type: AnswerComment

http://stackoverflow.com/comment/42069589
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26741526
has text: I just run it and it runs fine

http://stackoverflow.com/comment/99636429
comment on: http://stackoverflow.com/a/28901202
type: AnswerComment
type: Comment
has text: From Apache Commons: https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/reflect/FieldUtils.html
score: 1

http://stackoverflow.com/comment/41989536
type: Comment
comment on: http://stackoverflow.com/a/26697497
type: AnswerComment
has text: OK, I've removed my downvote. Perhaps you could explain what this new method does, and why you think it's the correct answer?
score: 0

http://stackoverflow.com/q/26679786
has comment: http://stackoverflow.com/comment/41958529
has comment: http://stackoverflow.com/comment/41958778
has answer: http://stackoverflow.com/a/26680135
has comment: http://stackoverflow.com/comment/41958754
type: AnsweredQuestion
tagged with: call
accepted answer: http://stackoverflow.com/a/26680135
tagged with: java
has comment: http://stackoverflow.com/comment/41958596
tagged with: methods
downvote count: 1
type: Question
has body: Pretty sure that I'm missing something fairly obvious here, but I've only been at it a few days. Any help would be much appreciated. I managed to get my class with methods I would like to use to compile, by my main method I was planning link all my results to is getting an error. It says my actual arguments and formal are different. I assume I didn't connect them to the other class or something, but I'm kind of lost. Thanks again! public class SphereAndCone { public static void main(String[] args) { Calc calc1 = new Calc(); Scanner input = new Scanner(System.in); System.out.print("What is the radius?"); // set sphere/cone radius double r = input.nextDouble(); System.out.print("What is the height?"); // set sphere/cone height double h = input.nextDouble(); // print results while calling on methods System.out.printf("Sphere Volume: %3f16" + calc1.sphereVolume()); System.out.println(); System.out.printf("Sphere Surface: %3f16" + calc1.sphereSurface()); System.out.println(); System.out.printf("Cone Volume: %3f16" + calc1.coneVolume()); System.out.println(); System.out.printf("Cone Surface: %3f16" + calc1.coneSurface()); System.out.println(); } }
has comment: http://stackoverflow.com/comment/41959015
has comment: http://stackoverflow.com/comment/41958910
score: -1
has comment: http://stackoverflow.com/comment/41958775
upvote count: 0
answer count: 1
has title: New to Java -> Method Issues
favorite count: 0
linked to: http://stackoverflow.com/q/18730978

http://stackoverflow.com/comment/42082921
comment on: http://stackoverflow.com/q/26747828
has text: i think i found your problem but you please post all the error? just for certainty..Sir?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42084301
score: 1
comment on: http://stackoverflow.com/q/26750042
type: Comment
type: QuestionComment
has text: @fge: apparently `nextInt` does internally. That's the beauty of stack traces.

http://stackoverflow.com/comment/42029010
type: Comment
type: QuestionComment
has text: Interesting, I will give it a try, thanks :)
comment on: http://stackoverflow.com/q/26675483
score: 0

http://stackoverflow.com/q/26696327
type: UnansweredQuestion
tagged with: netty
has title: How to handle network disruption and overcoming it without losing data?
tagged with: tcp
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26707378
tagged with: network-programming
linked to: http://stackoverflow.com/q/26500522
has comment: http://stackoverflow.com/comment/41989880
score: 0
answer count: 2
tagged with: real-time
has body: I am experimenting with Netty which is an asynchronous event-driven network application framework. In my application, suppose a server and a client are sending messages each other in a chatting application. Suddenly a client was disconnected from its network because of WiFi being unavailable. The server being unaware of it, continues sending messages to the client. But the client is unable to receive those. How to handle this ? The messages sent from server are important.
has answer: http://stackoverflow.com/a/26702585

http://stackoverflow.com/a/26783087
score: 1
has body: The solution which I found was creating my ObjectMapper and then registering that with jersey within main method (I am using SpringBoot with jersey as the complete solution). If I created ObjectMapper in other class and tried to register it in main, neither the constructor of that class was being called nor the overridden getContext() method. So I created the ObjectMapper within the main method and registered the provider with jersey. Snippet: ObjectMapper mapper = new ObjectMapper(); mapper.enable(MapperFeature.USE_ANNOTATIONS); // create JsonProvider to provide custom ObjectMapper JacksonJsonProvider provider = new JacksonJsonProvider(); provider.setMapper(mapper); and register(provider); Maven dependencies, as annotations and JacksonJsonProvider are available in different artifacts: com.fasterxml.jackson.module jackson-module-jaxb-annotations com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider Hope it helps.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26767158
has comment: http://stackoverflow.com/comment/42145007
type: Answer
answers question: http://stackoverflow.com/q/26767158
downvote count: 0

http://stackoverflow.com/q/26830305
has body: I am new to android app development.i want to create a list view that has only one button per cell of list view.For the adapter of this list view i need to give 'ArrayList' as parameter so that I can add and update list view whenever I need.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26830520
tagged with: android
has comment: http://stackoverflow.com/comment/42227875
score: -1
tagged with: java
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26830520
has title: Array list adapter with button objects
tagged with: listview
tagged with: arraylist
type: AnsweredQuestion
upvote count: 0

validation
tags question: http://stackoverflow.com/q/26715973
tags question: http://stackoverflow.com/q/26817588
tags question: http://stackoverflow.com/q/26714060
tags question: http://stackoverflow.com/q/26713409
tags question: http://stackoverflow.com/q/26805079
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/26793075
tags question: http://stackoverflow.com/q/26733261
tags question: http://stackoverflow.com/q/26797673
tags question: http://stackoverflow.com/q/26747386
tags question: http://stackoverflow.com/q/26677289
tags question: http://stackoverflow.com/q/26688131
tags question: http://stackoverflow.com/q/26772748
tags question: http://stackoverflow.com/q/26703137
tags question: http://stackoverflow.com/q/26786262
tags question: http://stackoverflow.com/q/26764607
tags question: http://stackoverflow.com/q/26677599
tags question: http://stackoverflow.com/q/26707797

http://stackoverflow.com/a/27043192
has comment: http://stackoverflow.com/comment/44354953
answers question: http://stackoverflow.com/q/26774513
downvote count: 0
has body: Your problem does not present itself if you replace if (i % 5 == 0) { document.add(table); } by int x = 5; // or any other value higher than your PdfPTable number of columns if (i % 10 == x) { document.add(table); } The apparent reason for this problem is that iText doesn't want to include a table with only a header and one partial row. This is currently a workaround, but we're looking to find the core issue and to fix it.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/26808572
score: 3
downvote count: 0
has body: Change if(barCode.charAt(i) !=':' || barCode.charAt(i) != '|') valid=false; to if(barCode.charAt(i) !=':' &amp;&amp; barCode.charAt(i) != '|') valid=false; The current condition you have would always return true (since every character is either not ':' or not '|'), and therefore valid would always be false.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26808557

http://stackoverflow.com/comment/41985479
has text: Your source is wrong. The database is almost certainly not written in Java, and therefore can't throw Java exceptions at all. See my edit.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26685071
type: Comment

http://stackoverflow.com/q/26825792
tagged with: export-to-csv
has body: I have loaded a dataset to Dynamo DB successfully. I then want to read the data from the dynamo DB and load into a .csv file. Use this file by weka to develop the clusters. Unfortunately, only few data is read from the dynamo DB are loaded into the .csv file. The below is the snippet where the data is read from Dynamo DB. I have 2201 records in my Dynamo DB but it abruptly stops writing into the file at 1986 th record and in the 3 column. I have tried all possible solutions I cloud find online but was not able to solve it. Kindly someone please help me in this. //scanning the data from dynamobb ScanRequest scanRequest = new ScanRequest().withTableName(tablename[2]); ScanResult result = client.scan(scanRequest); for (Map&lt;String, AttributeValue&gt; item : result.getItems()){ printItem(item,writer); } //appending the data into an empty CSV file private static void printItem(Map&lt;String, AttributeValue&gt; attributeList,FileWriter writer) { int i=1; System.out.println("Inside printItem"); try{ int k=1; for (Map.Entry&lt;String, AttributeValue&gt; item : attributeList.entrySet()) { AttributeValue value = item.getValue(); String valueName= value.getS(); writer.append(valueName); if(k&lt;=4){ writer.append(','); } ++i; ++k; } writer.append('\n'); ++count; } catch (IOException e) { e.printStackTrace(); } }
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42220157
favorite count: 0
has answer: http://stackoverflow.com/a/26831353
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has title: Data abruptly stops writing into a csv file from Dynamo DB
upvote count: 0
tagged with: java
tagged with: filewriter
tagged with: amazon-dynamodb
type: Question
has comment: http://stackoverflow.com/comment/42220499
score: -1
has comment: http://stackoverflow.com/comment/42219985

http://stackoverflow.com/q/26714618
score: 2
has answer: http://stackoverflow.com/a/26732269
downvote count: 0
tagged with: java
has body: I am building a simple application to manage teams. My problem is that I can not get the constraints/rules right to cover my rules. My result is unique player combination in ONE round but not for ALL rounds. How can I get my rules right so I get unique player combo's for ALL rounds and how do I loop over rounds in the rules instead of doing a ruleset for each round which are basically the same except ($round.getId()+1, $round.getId+2 etc) The rules: uniqueMatchingX should be repeated for all rounds instead of coding them out.. I have the following domain objects: Player ranking Match (@PlanningEntity) id 2x a player (@PlanningVariable) Round Round id Tournament (@PlanningSolution) list of matches list of players list of rounds In the solution I populate the facts (6 players with variable rankings, 2 round, and 6 matches 3 for each round) In the matched I do NOT populate the players, as this will be done by optaplanner. I have defined the following rules: Hard constraints you can not play against yourself you can not play against the same opponent (in any round) soft constraints You must play against a players close to your ranking I have implemented these rules as follows: // ############################################################################ // Hard constraints // ############################################################################ rule "uniqueMatching1" when $m : Match($player1 : player1, $player2 : player2, $round1 : round) Match(player1 == $player1, eval(round.getId() == $round1.getId())) or Match(player1 == $player2, eval(round.getId() == $round1.getId())) then scoreHolder.addHardConstraintMatch(kcontext, -1); end rule "uniqueMatching2" when $m : Match($player1 : player1, $player2 : player2, $round1 : round) Match(player2 == $player1, eval(round.getId() == $round1.getId())) or Match(player2 == $player2, eval(round.getId() == $round1.getId())) then scoreHolder.addHardConstraintMatch(kcontext, -1); end rule "uniqueMatching1Round2" when $m : Match…
type: Question
tagged with: drools
upvote count: 2
has title: Drools optaplanner rule not working
answer count: 1
favorite count: 0
tagged with: optaplanner
type: UnansweredQuestion
tagged with: rule-engine
tagged with: rule

http://stackoverflow.com/a/26765802
downvote count: 0
score: 1
has body: Set the weight c.weightx = 1; and to fix the button after your objects start on grid.x 2 and end at 3. So the width for one that fills the whole page should be three c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 2; c.gridheight=1; //--------------------------- c.gridwidth = 3; or change the starting x point for your textfields to one
upvote count: 1
answers question: http://stackoverflow.com/q/26764851
type: Answer

http://stackoverflow.com/comment/42003997
type: QuestionComment
comment on: http://stackoverflow.com/q/26705396
has text: @JBNizet Fixed. The property `x` is protected, but you have reason too. As I commented the answer from Peter, I will thinking again the design. Thanks!
score: 0
type: Comment

unit-testing
tags question: http://stackoverflow.com/q/26800131
tags question: http://stackoverflow.com/q/26753514
tags question: http://stackoverflow.com/q/26722555
tags question: http://stackoverflow.com/q/26795361
tags question: http://stackoverflow.com/q/26732406
tags question: http://stackoverflow.com/q/26741710
tags question: http://stackoverflow.com/q/26723749
tags question: http://stackoverflow.com/q/26778285
tags question: http://stackoverflow.com/q/26806360
tags question: http://stackoverflow.com/q/26776090
tags question: http://stackoverflow.com/q/26817588
tags question: http://stackoverflow.com/q/26780035
type: Tag
tags question: http://stackoverflow.com/q/26721377
tags question: http://stackoverflow.com/q/26741283
tag name: unit-testing
tags question: http://stackoverflow.com/q/26711267
tags question: http://stackoverflow.com/q/26742081
tags question: http://stackoverflow.com/q/26784439
tags question: http://stackoverflow.com/q/26678518
tags question: http://stackoverflow.com/q/26804341
tags question: http://stackoverflow.com/q/26820785

http://stackoverflow.com/a/26708806
downvote count: 0
has comment: http://stackoverflow.com/comment/42013022
has comment: http://stackoverflow.com/comment/42010506
has comment: http://stackoverflow.com/comment/42015028
score: 1
upvote count: 1
has body: ** There is no difference. You can do the same things with both approaches. ** With annotations you have mapping directly together in java. ** Xml mapping files give a better overview over the table and its mapping. If you have repeated changes in your code go through with HBM.Xml file otherwise Go with Annotations.
has comment: http://stackoverflow.com/comment/42010919
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26708338
type: Answer
answers question: http://stackoverflow.com/q/26708338

http://stackoverflow.com/comment/42010185
has text: The code you've written *does* only initializer `Superclass`. Please show a short but *complete* program demonstrating the problem.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26709026

http://stackoverflow.com/comment/41958252
type: QuestionComment
comment on: http://stackoverflow.com/q/26679641
type: Comment
has text: the worker don't works properly. as you see in the screenshot, none of rectangles turned into gray...
score: 0

http://stackoverflow.com/comment/42081802
score: 0
type: Comment
type: QuestionComment
has text: Can you do a diff between the parameters of the servers that work and the ones that do not? Are the two managed servers new or have they always been there?
comment on: http://stackoverflow.com/q/26683225

http://stackoverflow.com/comment/42013022
type: Comment
has text: I just heard using xml is an old hibernate technique and we use annotations these days. So obviously there is some advantage for it na?
comment on: http://stackoverflow.com/a/26708806
type: AnswerComment
score: 0

http://stackoverflow.com/q/26777368
has comment: http://stackoverflow.com/comment/42133369
type: UnansweredQuestion
tagged with: android-volley
has comment: http://stackoverflow.com/comment/42132889
tagged with: android
has body: I feel like this is a very basic concept missunderstanding. In my Android app I make HTTP requests using Volley lib. At first I made the requests through a JsonObjectRequest in the Activity code and worked right, but now I separated the request code in a class apart so I can call it from any Activity. The new class has a method that returns the requested JSONObject but any "json action" I do over the returned object ends in an error. Here is the new class code, JSONRequests: public class JSONRequests { private JSONObject mResponse; private String mURL = "https://myurl.com/"; public JSONObject getJSONObject(final String credentials, final String path) { final JsonObjectRequest mRequest = new JsonObjectRequest(mURL.concat(path), null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { mResponse = response; try { Log.d("RESPONSE", mResponse.getString("id")); // It works here } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } } ) { @Override public Map&lt;String, String&gt; getHeaders() throws AuthFailureError { HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;(); headers.put("Authorization", "Basic " + credentials); return headers; } }; MyApplication.getInstance().getRequestQueue().add(mRequest); return mResponse; } } And here is how I call getJSONObject from MyActivity: JSONRequests mRequest = new JSONRequests(); JSONObject mInfo = mRequest.getJSONObject(mEncodedCredentials, mPath); try { Log.d("RESPONSE", mInfo.getString("id")); // This doesn't work } catch (JSONException e) { e.printStackTrace(); } When in the Activity file, I used "response" as a JSONObject and it worked, but now separated it won't. I don't know if is a error with JSONObject or just that I'm not getting the returned object in the correct way. Thanks in advance.
favorite count: 0
answer count: 0
type: Question
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42133271
has title: Returned object from another class method
tagged with: oop
tagged with: java

http://stackoverflow.com/a/26736021
has body: You have to initialize the array first: board = new TOKEN[nr][nc];
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26735902
downvote count: 0

http://stackoverflow.com/comment/42083281
comment on: http://stackoverflow.com/a/26749497
has text: For this particular assignment I had to set the layout to null...so what do you recommend that I change my code to
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41968010
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26684809
has text: You can do it with a single function and then probably need to either hardcode 4, or keep it as a second parameter. Normally I'd write the recursion counting backwards - with a single function you'd need to increase the counter. Either way the recursive function is around 4 lines of code.
score: 0

http://stackoverflow.com/comment/42172923
score: 0
comment on: http://stackoverflow.com/q/26799403
has text: And why exactly you are using selenium to do this ? It is a browser testing tool.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26818471
has comment: http://stackoverflow.com/comment/42206946
tagged with: java
has comment: http://stackoverflow.com/comment/42207078
accepted answer: http://stackoverflow.com/a/26818531
has comment: http://stackoverflow.com/comment/42207184
has body: first off, I'm positive this is a really easy answer, and I apologize. I'm trying to figure out if I can chain a returned value through methods in the same class, using overloaded methods. In the code below, the computeBill(double bookPrice, int quantity) portion is what I'm currently stuck on. What I want it to do, is be passed the price of the book, and the quantity. (main has an input section that passes outputs to these methods; that part works fine). It will then pass those to moneyConversion(), which does math, converts to BigDecimal, and returns the result as variable bookPriceDisp. I want computeBill() to return that same value back to main for display. I'm getting cannot find symbol in class Billing. Do I need to make a new object in each method? public class Billing { public static BigDecimal computeBill(double bookPrice) { BigDecimal bookPriceTaxed = new BigDecimal(bookPriceInput*1.08); return bookPriceTaxed; } public static BigDecimal computeBill(double bookPrice, int quantity) { moneyConversion(bookPrice, quantity); return bookPriceDisp; } public static void computeBill(double bookPrice, int quantity, double coupon) { System.out.println("Please enter the percentage of your coupon: "); double couponInput = keyboard.nextDouble(); System.out.println("You entered " + couponInput + "%"); moneyConversion(bookPrice, quantity); BigDecimal couponSavings = new BigDecimal(bookPrice * quantity * couponInput); System.out.println("Your books will cost $" + ((bookPriceDisp - couponSavings)*1.08)); System.out.println("Your coupon saved you $" + couponSavings); } public static BigDecimal moneyConversion(double bookPrice, int quantity) { //Using BigDecimal to get correct dollars/cents. BigDecimal bookPriceDisp = new BigDecimal(bookPrice * quantity); bookPriceDisp = bookPriceDisp.setScale(2, BigDecimal.ROUND_HALF_UP); return bookPriceDisp; } Thank you, -Stephan
has title: Chaining returns through methods in Java
type: Question
has comment: http://stackoverflow.com/comment/42207019
has answer: http://stackoverflow.com/a/26818537
has answer: http://stackoverflow.com/a/26818531
score: 0
answer count: 3
tagged with: chaining
has answer: http://stackoverflow.com/a/26818692
possible better answer: http://stackoverflow.com/a/26818537
type: AnsweredQuestion

http://stackoverflow.com/a/26685647
has comment: http://stackoverflow.com/comment/41971127
type: Answer
has body: Looking from your log cat, the error seems because the theme you used is not from the compat. Check your manifest, and make sure you use the compat theme. Example (for ALL acitivities in your apps) : &lt;application //other code android:theme="@style/Theme.AppCompat.Light" &gt; Or if you only use the action bar on particular activity : &lt;Activity //other code android:theme="@style/Theme.AppCompat.Light" &gt; TIPS : Always pay attention to the log cat, especially the caused by. I know the problem from there.
answers question: http://stackoverflow.com/q/26685069
accepted answer of: http://stackoverflow.com/q/26685069
has comment: http://stackoverflow.com/comment/41969462
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26719305
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26719382
upvote count: 1
tagged with: jlayer
type: Question
has comment: http://stackoverflow.com/comment/42028655
accepted answer: http://stackoverflow.com/a/26719382
answer count: 1
downvote count: 0
has title: I follow the tutorial in oracle about JLayer but it doesn't work with this code
favorite count: 0
has comment: http://stackoverflow.com/comment/42028692
has body: import java.awt.*; import javax.swing.*; import javax.swing.plaf.LayerUI; public class MyJLayer extends JFrame { public static void main(String[] args) { MyJLayer jlayer = new MyJLayer(); jlayer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); JButton button = new JButton("Debug Only."); panel.add(button); UI ui = new UI(); JLayer&lt;JPanel&gt; jLayer = new JLayer&lt;JPanel&gt;(panel, ui); jlayer.add(jLayer); jlayer.setSize(100, 100); jlayer.setVisible(true); } } class UI extends LayerUI&lt;JPanel&gt;{ public void paint(Graphics g, JPanel c){ super.paint(g, c); Graphics2D g2d = (Graphics2D)g.create(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .8f)); g2d.setColor(Color.BLUE); g2d.fillRect(0, 0, c.getWidth(), c.getHeight()); g2d.dispose(); } } the panel doesn't display BLUE color at all, but I don't know why. Could anyone help me out? I just couldn't find out. http://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/26824381
answer count: 1
has comment: http://stackoverflow.com/comment/42217796
has comment: http://stackoverflow.com/comment/42217780
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12231453
tagged with: java
has comment: http://stackoverflow.com/comment/42217944
type: Question
has body: I have a problem to understand array 2D looping concept. This is my code : int[][] matA = new int[2][3]; matA[0][0] = 2; matA[0][2] = 3; matA[1][1] = -4; for (int i = 0; i &lt; matA.length; i++){ for (int j = 0; j &lt; matA[0].length; j++){ System.out.print("\t" + matA[i][j]); } System.out.println(""); } I know that matA[0].length used for displaying what is second array or [3] contain, I just don't understand how [0] on metA[0].length can displaying the second array
has answer: http://stackoverflow.com/a/26824421
has title: Array 2D looping
score: 0

http://stackoverflow.com/q/26678072
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/41955876
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41956494
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41956800
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41962495
has comment: http://stackoverflow.com/comment/41955302
has answer: http://stackoverflow.com/a/26678106
has comment: http://stackoverflow.com/comment/41955253
type: Question
answer count: 2
downvote count: 0
has body: I have an application which massively creates threads. As result I get an OutOfMemoryError. My idea is to wait until there is enough free space to create the next Thread. But therefore I need to know how many memory I need to create a thread and if this amount of memory is available. Is there a way to get the amount of memory a thread needs? And how can I determine if this amount of memory is available? What I've already tried: for (int i = 0; i &lt; links.size(); i++) { while(Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory() &lt; MEMORY_THRESHOLD) { synchronized (lock) { lock.wait(10); } } Thread t = new Thread(new Task(links.get(i))); t.setDaemon(true); t.start(); } But even when I use 100MB as threshold I get an OutOfMemoryError.
has comment: http://stackoverflow.com/comment/41961968
has comment: http://stackoverflow.com/comment/41955570
has title: Java needed memory for new thread
possible better answer: http://stackoverflow.com/a/26679036
has answer: http://stackoverflow.com/a/26679036
accepted answer: http://stackoverflow.com/a/26678106
has comment: http://stackoverflow.com/comment/41956654
has comment: http://stackoverflow.com/comment/41955137
favorite count: 0
has comment: http://stackoverflow.com/comment/41956185
linked to: http://stackoverflow.com/q/8522789
has comment: http://stackoverflow.com/comment/41955983
upvote count: 2

http://stackoverflow.com/comment/41985451
type: AnswerComment
has text: But, as I said, in this case, there is a simpler solution available ;)
comment on: http://stackoverflow.com/a/26687390
type: Comment
score: 0

http://stackoverflow.com/comment/42096884
has text: NO I'm speaking about **Daylight saving time**
comment on: http://stackoverflow.com/q/26757440
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42143792
type: Comment
has text: No Krish, does not seem to work. I have edited my code as above
comment on: http://stackoverflow.com/a/26778338
type: AnswerComment
score: 0

internationalization
tags question: http://stackoverflow.com/q/26808053
type: Tag
tags question: http://stackoverflow.com/q/26802657
tags question: http://stackoverflow.com/q/26752667
tags question: http://stackoverflow.com/q/26830229
tag name: internationalization
tags question: http://stackoverflow.com/q/26782600
tags question: http://stackoverflow.com/q/26743183

http://stackoverflow.com/q/26711096
tagged with: simple-spring-memcached
upvote count: 2
type: UnansweredQuestion
tagged with: java
has body: I want to use simple-spring-memcached to cache data. so using this https://code.google.com/p/simple-spring-memcached/wiki/Getting_Started for my purpose. i add in my dispatcher-servlet.xml <aop:aspectj-autoproxy /> <import resource="simplesm-context.xml" /> <constructor-arg name="cache" index="0" ref="defaultCache"/> <constructor-arg name="expiration" index="1" value="0"/> <constructor-arg name="allowClear" index="2" value="false"/> i also add simple-spring-memcached-3.5.0.jar and spymemcache.jar,spymemcache-provider.jar to lib folder. but when i run my project occur this exception: Cannot find class **[net.nelz.simplesm.config.MemcachedClientFactory]** for bean with name 'memcachedClientFactory' defined in ServletContext resource [/WEB-INF/simplesm-context.xml]; nested exception is java.lang.ClassNotFoundException: net.nelz.simplesm.config.MemcachedClientFactory
has answer: http://stackoverflow.com/a/26729434
tagged with: memcached
type: Question
tagged with: caching
has title: What is this error in spring mvc integrated via memcache
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26713537
tagged with: spring-mvc
score: 2

http://stackoverflow.com/comment/42014119
type: QuestionComment
comment on: http://stackoverflow.com/q/26711358
has text: When you say `import java.awt.event.*;` there is no need for the next two imports , try reading about Packages in Java.
score: 0
type: Comment

http://stackoverflow.com/q/26754008
tagged with: java
has body: I want to create a different log file each time when I run the java application. I have the following configuration. I expected it would create a log file named rf-yyyyMMdd-HHmmss.log which the yyyyMMdd-HHmmss is the time I start the java application. However it doesn't work. Any help would be appreciated! <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="[%p] %m%n" /> <OnStartupTriggeringPolicy /> <appender-ref ref="RF" /> <appender-ref ref="Console" />
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/73378418
downvote count: 0
score: 4
answer count: 4
has answer: http://stackoverflow.com/a/26769865
favorite count: 0
has answer: http://stackoverflow.com/a/32247322
type: UnansweredQuestion
has title: How to make log4j2 create a different log file each time I restart jvm
has answer: http://stackoverflow.com/a/48596998
tagged with: log4j2

http://stackoverflow.com/q/26682426
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26684192
has comment: http://stackoverflow.com/comment/41965197
type: Question
answer count: 2
has body: I am trying to simulate an sending msg progress . The main idea is to colour the members who message sent to them, promote the status bar etc.. (gui changes ) all this with delay for each loop iteration. The main problem is that everything is going inside the onClick listener and runing thread inside it wont help ): cause gui is changing only after delay is completed. Any one may advice me how to do this simulation ? send.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { for(int i=0; i&lt;phoneNumbers.size(); i++){ try { Thread.sleep(1000); } catch (InterruptedException e) { } members.get(i).setBackgroundColor(Color.GREEN); members.get(i).invalidate(); mProgressDialog.setProgress(i+1); sentCount.setText(getString(R.string.msgSentCount) + (i+1)); if(i==12){ scroolView.animate().translationYBy(-50);} } } }); Thanks you very much !
has title: java android , delay inside onclick button includes gui changes
has comment: http://stackoverflow.com/comment/41966413
possible better answer: http://stackoverflow.com/a/26682561
upvote count: 1
has answer: http://stackoverflow.com/a/26682561
favorite count: 0
has comment: http://stackoverflow.com/comment/41963466
tagged with: android
accepted answer: http://stackoverflow.com/a/26684192
has comment: http://stackoverflow.com/comment/41963672

http://stackoverflow.com/q/26689800
tagged with: ascii-art
tagged with: animation
has body: I'd like to make a little animation in a console app and to do this, I've created a ASCII art: ,.:b-'::' ,`::-/,._ _.\\,,-/` /| | ,' .`| ,_: ,. ` -_,'[ ._-|/,'Y ` ` / -/,-.:`. ,'/[(o _.. _,".`':| ___ ::/|.`][,'/,,/,'`. `:-\-. `','\`,-' [:_,.....'__ ^..,|-.'- ,,\ :. ,'-\-.` _ `[.- --' '-..`'-[''\ .L-",`. ,L< ':],, ,` ,- '- , .''Y"-'.-'` _'_,::''/-]._,' _ .. .._ `.`]'. -,-:,^. _'/,[``.-'/'- _ :].-''`'''''--.[ -. .|/:L:| \ '[' ]>] ' /' _,' `- . ``\'` ,u[<L' /,`. [-' / ,` ,. `. `.`,,``..| | P.P.`[o'), ,''`__-. ,' /'\, .\'( ; .:] /`/ ` .'/XXX `,' . -. ,' ,' `. \.> :,` | \.u[/\'|X X/\' 'v ^, ,' ,' \ \ `^/:.-, | .:-<.. [||/ XXX '/ `\ `\ ,' /' .\ || \]::`.' | |::>,-b| || ^. '---' ,' Y| || [./.'/\ | /_,[| || || | ,. / || || |> --|| Y=]L__`=[| || | ,- ' || | ::_,==: | |i .| |'. \ /' ,..._ `' || || /L. , |_]L,.'-] | [\ ,- ,' ,' '. || 'P..L, / | v...-L\ \\ `/. ,' ,' `. -_ / /|'Y\-.`::' \ -:,'\.., \`\ _,' /' ^, /, .[-` ,' )_ ' '.\ `[`, /' `.'\,'' /`..:- | <`...,`./ ` `[.= `= / ,_/-/.` '' \`[,-'.v'\`. ".`._ _.:' '-' '.>/ ' [,_,L!`, [` ' `-...______.,-' v /'''|]:.' ``\ //'. .`.`. ' --- -- '' ',-|' ' b'' `.Yv-]-, ',-.'- ,-'''\ [,.-,' `['./,L|'`.],.. .__ _ ,.',. .[ ]'v'] `v-/| <." ..`\-.. ::_ |: ,.-\\',.\'- ' '',' `.:`[/ / ' > .:',.||::_|/--'. ``,\ '/: ' -',:.\`[| .'/,[/ L',] ^ /``,] ``-` -\|, -,: |`-|||/ |``.,..\`_,-' ''--.' ==='|::::\'-'' (Yeah, it's a roulette) I created the same ASCII arts with the ball in different positions (like also the cross on the roulette). My problem is, I think, quite tricky: I'd like to print the roulette to the console something like 4 times per second (maybe more, do not exactly know) at the same place in order that it's looks like a gif. I've no problem to load the files and transform them to string, but I didn't find a way to rewrite at the same place (the \r won't work for multiline text). It would be great, if I could do it without using any library like curses (although I'm a big fan of ncurses in Python!).
type: AnsweredQuestion
score: 3
has title: Printing multiline ASCII animation in the console
possible better answer: http://stackoverflow.com/a/66825482
upvote count: 3
has comment: http://stackoverflow.com/comment/42325529
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/42447764
answer count: 2
has answer: http://stackoverflow.com/a/66825482
has answer: http://stackoverflow.com/a/26690566
accepted answer: http://stackoverflow.com/a/26690566
downvote count: 0
favorite count: 0
tagged with: console

http://stackoverflow.com/a/26861794
has comment: http://stackoverflow.com/comment/42356101
answers question: http://stackoverflow.com/q/26753094
score: 0
accepted answer of: http://stackoverflow.com/q/26753094
has comment: http://stackoverflow.com/comment/42426258
type: AcceptedAnswer
has body: Does ChildClassA also contain a collection, thus you are trying to nest two embedded collections? It looks like it from that stacktrace. This is not possible in Objectify4. I highly recommend the upgrade to 5.
type: Answer

http://stackoverflow.com/a/26716046
has body: You need to call finish() to finish an activity before go to another activity. Example on page 5 : public void onClick(View v) { Intent itn = new Intent(page5.this,page2.class); startActivity(itn); finish(); } With this, user wont be able to go back to page5 from page2 when pressing back button.
downvote count: 0
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26715965

http://stackoverflow.com/comment/41953220
score: 0
comment on: http://stackoverflow.com/a/26676992
has text: We can always create and interface on the second activity/first activity to communicate between those two activities. Yes, we can always use a service for this problem.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26717153
answer count: 2
tagged with: jsp
tagged with: glassfish
score: 0
has answer: http://stackoverflow.com/a/26728614
has answer: http://stackoverflow.com/a/41898837
accepted answer: http://stackoverflow.com/a/41898837
has comment: http://stackoverflow.com/comment/42036535
has title: Glassfish server welcome-file not working?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42036638
possible better answer: http://stackoverflow.com/a/26728614
tagged with: java
tagged with: welcome-file
has body: I have a very simple web.xml file: <?xml version="1.0" encoding="UTF-8" ?> abcd.jsp foo bar and I have 2 jsp files hello.jsp and abcd.jsp in my application. I deployed the war file to Glassfish Server, context root is "novone" When I go to localhost:8080/novone I see hello.jsp, not abcd.jsp... In Glassfish admin panel(local4848/common/index.jsf) Applications->novone->Descriptor->Description-File I see: <?xml version="1.0" encoding="UTF-8" ?> abcd.jsp foo bar How come hello.jsp is served and not abcd.jsp? When I manually go to /novone/abcd.jsp I can see the value "bar" which is loaded from the application scope.
type: Question

http://stackoverflow.com/comment/42065940
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26739984
score: 0
has text: How have you defined your result variable ? is it Double or double ?

http://stackoverflow.com/comment/42103121
type: Comment
comment on: http://stackoverflow.com/a/26759403
score: 0
type: AnswerComment
has text: I've tryed that first of all, but unfortunatelly it does not work.

http://stackoverflow.com/a/26702331
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26702194
has body: One way to do this is to build your whole layout with the text and the buttons, but hide them initially by setting their visibility to gone or invisible. Then in code in the onClick listener of the "hello_text" text view, you can change their visibility to visible. &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;TextView android:id="@+id/hello_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello_text" /&gt; &lt;TextView android:id="@+id/the_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/my_text" android:visibility="invisible" /&gt; &lt;LinearLayout android:id="@+id/btn_holder" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:visibility="invisible"&gt; &lt;Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_text1" /&gt; &lt;Button android:id="@+id/btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_text2" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; Now in your activity or fragment you can do: TextView the_text_view = (TextView) v.findViewById(R.id.the_text); LinearLayout ll_btn_holder = (LinearLayout) v.findViewById(R.id.btn_holder); TextView hello_text_view = (TextView) v.findViewById(R.id.hello_text); hello_text_view.setOnClickListener(new OnClickListener() { public void onClick(View v) { the_text_view.setVisibility(View.VISIBLE); ll_btn_holder.setVisibility(View.VISIBLE); } });
answers question: http://stackoverflow.com/q/26702194
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26718515
has comment: http://stackoverflow.com/comment/42031717
has comment: http://stackoverflow.com/comment/42029530
has comment: http://stackoverflow.com/comment/42027948
score: 1
has comment: http://stackoverflow.com/comment/42029107
has body: Get the rows from it: List&lt;WebElement&gt; tableRows = table.findElements(By.xpath("tr")); And then table cells either: List&lt;WebElement&gt; tableCells= table.findElements(By.xpath("tr/td")); OR - Loop through all tableRows in a for loop and get the cells by for(WebElement row : tableRows) { List&lt;WebElement&gt; cells = row.findElements(By.xpath("td")); } And finally you can get the value in the cell by using for(WebElement cell : tableCells) { System.out.println( "Value = " + cell.getText()); }
has comment: http://stackoverflow.com/comment/42027261
has comment: http://stackoverflow.com/comment/42027625
has comment: http://stackoverflow.com/comment/42033405
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/82525170
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42032921
has comment: http://stackoverflow.com/comment/42029319
has comment: http://stackoverflow.com/comment/42029838
accepted answer of: http://stackoverflow.com/q/26717850
has comment: http://stackoverflow.com/comment/42028487
has comment: http://stackoverflow.com/comment/42027368
has comment: http://stackoverflow.com/comment/42027492
answers question: http://stackoverflow.com/q/26717850

http://stackoverflow.com/q/26778362
has answer: http://stackoverflow.com/a/26782200
score: 0
has title: Solitaire Game using tads(stack, Queue, Deque, List ) in Java - Classe implemented by Stack
has comment: http://stackoverflow.com/comment/42134768
has comment: http://stackoverflow.com/comment/42135260
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42135303
has comment: http://stackoverflow.com/comment/42135460
has comment: http://stackoverflow.com/comment/42135602
has body: I've already started work on drafting Game Solitario with tads and patterns of software in Java and I already started to make the Stack interface public interface Stack &lt;E&gt; { // number of elements in the stack public int size (); // does not contain elements? public boolean isEmpty (); // returns next object to come out without removing public E peek () throws EmptyStackException; // add new stack element public void push (E elem) throws FullStackException; // pops or drop next element public E pop () throws EmptyStackException; } and here I have a calsss LotOfCard has a collection of cards and have the LIFO behavior and you can check if a lot of cards is empty, put or add new cards in the lot and removing cards from the stack. public class LotOfCards implements Stack &lt;Card&gt; { // private HashSet &lt;Card&gt; cards;//contains collections of Card // public LotOfCards() { this.cards= new HashSet &lt;&gt; (); } // public HashSet &lt;Card&gt; getCards () { return cards; } // public void setCards (HashSet &lt;Card&gt; cards) { this.cards= cards; } // return number of elements in the stack Override public int size() { return this.cards.size(); } // does not contain elements? Override public boolean isEmpty () { return (this.cards.isEmpty () || this.cards == null) ; } // add new stack element Override public void push (Card element) throws FullStackException{ this.cards.add (element); } // returns next object to come out without removing Override public Card peek () throws EmptyStackException{//Doubt here if (this.isEmpty ()) { throw new EmptyStackException (); } return (Card) null; } // pops or drop element Override Public Card pop () throws EmptyStackException{//Doubt here if (this.isEmpty ()) { throw new EmptyStackException (); } // returns the first letter is removed Card card = this.peek(); // after the card is removed this.cards.remove (card); // Doubt // return card return card; } and I doubt the class LotOfCard in methods peek() and pop(), ie, the method…
has comment: http://stackoverflow.com/comment/42135196
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/comment/42022683
comment on: http://stackoverflow.com/q/26716239
has text: IEEE floating point numbers can only have 16 digits of precision. Can't do better than that.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26682604
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26682651
has body: I am using the weka java api. How do I set a value as missing as in instance.setValue I am reading the weka source and I see Instance.MISSING_VALUE but it is protected. How do I generally represent a missing value to the weka java?
score: 1
tagged with: java
type: Question
tagged with: weka
downvote count: 0
has title: Java Weka: How to Contruct a Missing Value
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26754639
answer count: 1
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/26755626
score: 0
has body: Actually we are using the Spring for the dependency injection for the decorator design pattern.So the beans will be spread across the different XML files. i Need Some tool or plugin in the Eclipse that navigate rule-ref to the Actual bean location. So analyzing will be easy.
has title: Spring rule-ref to bean naviagation in eclipse
type: UnansweredQuestion
tagged with: spring
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/26673750
score: 0
linked to: http://stackoverflow.com/q/1323408
has comment: http://stackoverflow.com/comment/41947255
answer count: 1
accepted answer: http://stackoverflow.com/a/26673876
tagged with: multithreading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26673876
has body: as the title implies I do not know how there could be three threads in my program? My suggestion is: (1) main-Thread (2) EDT (because of JButton) (3) ???? Here is my Code (it is very simple): package newProject; import javax.swing.JButton; public class MyExample { public static void main(String[] args) { System.out.println(Thread.activeCount() + " " + Thread.currentThread()); MyThread myExample = new MyThread(); System.out.println(Thread.activeCount() + " " + Thread.currentThread()); } } class MyThread { JButton button=new JButton(); public MyThread() { } }
tagged with: java
has title: Why there are suddenly 3 Threads in my Java program?
type: Question
has comment: http://stackoverflow.com/comment/41947201

http://stackoverflow.com/comment/42137523
has text: it could be any sentences that supports 160 characters as this app is used for sms @Aaron Digulla
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26779839

http://stackoverflow.com/comment/42041833
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26726276
has text: i suppose so, anyway seeing the proper output you get in the console would be a good start to know it
type: Comment

http://stackoverflow.com/q/26720156
has answer: http://stackoverflow.com/a/26722222
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42033960
has title: How to add a Sliding Drawer in my mobile messaging Android app?
type: UnansweredQuestion
tagged with: eclipse
tagged with: mobile
favorite count: 0
type: Question
answer count: 2
tagged with: android
has body: I'm new in Android development. My developer is asking huge money Rs. 40,000 to add a "Sliding Drawer" in my mobile messaging app, which is still developed by himself. I've a shoe-string budget. Can you pls help me to add one "sliding Drawer" in my app. I'm very much fascinated by the "Sliding Drawer" of gaana app.
has answer: http://stackoverflow.com/a/26852552
has comment: http://stackoverflow.com/comment/42033646

http://stackoverflow.com/q/26807629
tagged with: jetty
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/38974821
upvote count: 2
linked to: http://stackoverflow.com/q/5283395
tagged with: java
accepted answer: http://stackoverflow.com/a/26874448
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/26866532
has title: Force browser to drop #hash from the URL when sending redirect
answer count: 3
downvote count: 0
tagged with: url
tagged with: web
has answer: http://stackoverflow.com/a/26874448
favorite count: 0
has answer: http://stackoverflow.com/a/38974821
has body: I am running into an issue with a persisting part of the URL, let's call it #x that is used for navigation. I have an AuthenticationFilter on the server side that will redirect users to a login page. The issue is that I can't get this #x to go away. On the server side when I step through the Java code that does the redirect, I see the URL as /login?redirectUrl=%2Fprevious%2Flocation. However, on the client side this is actually /login?redirectUrl=%2Fprevious%2Flocation#x. I understand that this data is actually never sent to the server. My question is how do I force the server to tell the client to drop it? Do I have to switch to client-side redirects?

http://stackoverflow.com/comment/42230409
has text: pls show complete codE
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26831895

http://stackoverflow.com/a/26735425
downvote count: 0
upvote count: 13
answers question: http://stackoverflow.com/q/26735276
type: Answer
score: 13
has body: For performance - use StringBuilder. For convenience you can use Map to store values and replacements. Map<String, String> map = new HashMap<>(); map.put(" "," "); map.put(" "," "); map.put(" "," "); ... StringBuilder builder = new StringBuilder(yourString); for (String key : map.keySet()) { replaceAll(builder, key, map.get(key)); } ... To replace all occurences in StringBuilder you can check here: Replace all occurrences of a String using StringBuilder? public static void replaceAll(StringBuilder builder, String from, String to) { int index = builder.indexOf(from); while (index != -1) { builder.replace(index, index + from.length(), to); index += to.length(); // Move to the end of the replacement index = builder.indexOf(from, index); } }

http://stackoverflow.com/comment/42035777
comment on: http://stackoverflow.com/q/26722960
type: Comment
score: 1
has text: Is that `main()` method supposed to belong to class `MyClass`? It has to belong to *some* class. If you try to compile a Java source file containing only what you presented then the compiler will certainly emit errors.
type: QuestionComment

http://stackoverflow.com/comment/41946615
comment on: http://stackoverflow.com/q/26673316
type: QuestionComment
type: Comment
has text: I think many-to-many database relations solve this. Why do you need to implement that directly into java?
score: 1

http://stackoverflow.com/q/26721810
tagged with: servlets
type: Question
score: 0
tagged with: liferay
answer count: 1
tagged with: jsp
has title: Passing parameter back from JSP in a portlet app
accepted answer: http://stackoverflow.com/a/26721846
has body: In my Liferay 6 app I'm able to pass parameter from java to jsp via: final PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("view"); request.setAttribute("description", "some description"); rd.include(request, response); Then I want user to change the description and pass it back to back-end: UPDATE Nevertheless when I call then System.out.println("request.getAttribute("description")); , I'm getting null. What am I doing wrong?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26721846

http://stackoverflow.com/a/26793078
has comment: http://stackoverflow.com/comment/42161500
has comment: http://stackoverflow.com/comment/42161439
has comment: http://stackoverflow.com/comment/42161534
has body: You can use instanceof if(tokens[2] instanceof String) .... else if(tokens[2] instanceof Double) ....
downvote count: 3
has comment: http://stackoverflow.com/comment/42161631
has comment: http://stackoverflow.com/comment/42161345
has comment: http://stackoverflow.com/comment/42161573
has comment: http://stackoverflow.com/comment/42161563
has comment: http://stackoverflow.com/comment/42161538
score: -2
has comment: http://stackoverflow.com/comment/42161545
has comment: http://stackoverflow.com/comment/42161366
has comment: http://stackoverflow.com/comment/42161724
has comment: http://stackoverflow.com/comment/42161547
has comment: http://stackoverflow.com/comment/42161730
has comment: http://stackoverflow.com/comment/42161602
type: Answer
has comment: http://stackoverflow.com/comment/42161790
answers question: http://stackoverflow.com/q/26793035
has comment: http://stackoverflow.com/comment/42161660
has comment: http://stackoverflow.com/comment/42161521
upvote count: 1

http://stackoverflow.com/q/26685303
downvote count: 1
possible better answer: http://stackoverflow.com/a/26685322
has comment: http://stackoverflow.com/comment/41968648
favorite count: 0
has answer: http://stackoverflow.com/a/26685319
upvote count: 0
has answer: http://stackoverflow.com/a/26685317
tagged with: loops
type: Question
has title: OR conditional in loop with Java
has comment: http://stackoverflow.com/comment/41968838
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26685322
score: -1
has body: I've got a problem which I don't understand at all. public int test213() { int i = 0; // for (i = i; i &lt; 8 || i &lt; 6; i++); while (i &lt; 8 || i != 6){ i++; } return i; } This returns 8, anyone know why?
tagged with: boolean
has comment: http://stackoverflow.com/comment/41969049
has comment: http://stackoverflow.com/comment/41968666
accepted answer: http://stackoverflow.com/a/26685319
has comment: http://stackoverflow.com/comment/41968674
has comment: http://stackoverflow.com/comment/41968649
answer count: 3

eclipse-virgo
tag name: eclipse-virgo
tags question: http://stackoverflow.com/q/26760552
type: Tag

http://stackoverflow.com/a/26676576
answers question: http://stackoverflow.com/q/26676200
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26676200
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: Quoting erickson from the following answer: The access modifier on the field doesn't make any difference in speed, but invoking the accessor method does. ps. Please upvote the original answer instead of this one.

http://stackoverflow.com/comment/42222740
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26778662
has text: Thanks so much for your answer. In case 1, could you also contrast that to **composite element mapping**

http://stackoverflow.com/q/26747473
tagged with: jpa
has comment: http://stackoverflow.com/comment/42080327
downvote count: 0
tagged with: spring-data-jpa
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/42080162
has comment: http://stackoverflow.com/comment/42080180
has comment: http://stackoverflow.com/comment/42080127
favorite count: 0
has answer: http://stackoverflow.com/a/26751543
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42096003
has comment: http://stackoverflow.com/comment/42080050
tagged with: spring
has title: Replace getBean with @Autowired for Service
upvote count: 3
tagged with: java
tagged with: spring-data
has body: Here I have my main class with @Service called RegionsServiceImpl. I'm initializing it with ApplicationContext.getBean, but I want to use @Autowired. And when I do, @Autowired doesn't initialize it. Main class: package com.rebel.shop; public class JpaRepoTest { //ApplicationContext ctx; @Autowired RegionsServiceImpl regionsServiceImpl; public JpaRepoTest() { // ctx = new AnnotationConfigApplicationContext(DataConfig.class); // regionsServiceImpl = ctx.getBean("regionsServiceImpl", RegionsServiceImpl.class); } public static void main(String[] args) { JpaRepoTest jpaRepoTest = new JpaRepoTest(); jpaRepoTest.testService(); } private void testService() { System.out.println(regionsServiceImpl.findById(3l).getName()); } } My Service class: package com.rebel.shop.persistence.jpa.service; @Service public class RegionsServiceImpl implements RegionsService { @Resource private RegionsRepository regionsRepository; @Override public Regions findById(long id) { return regionsRepository.findOne(id); } } It's interface: package com.rebel.shop.persistence.jpa.service; public interface RegionsService { public Regions findById(long id); } Repo: package com.rebel.shop.persistence.jpa.repository; public interface RegionsRepository extends JpaRepository&lt;Regions, Long&gt; { } And Java Config For Spring: package com.rebel.shop.persistence.jpa.config; @Configuration @EnableTransactionManagement @PropertySource("classpath:app.properties") @EnableJpaRepositories("com.rebel.shop.persistence.jpa.repository") @ComponentScan("com.rebel.shop") public class DataConfig { private static final String PROP_DATABASE_DRIVER = "db.driver"; private static final String PROP_DATABASE_PASSWORD = "db.password"; private static final String PROP_DATABASE_URL = "db.url"; private static final String PROP_DATABASE_USERNAME = "db.username"; private static final String PROP_HIBERNATE_DIALECT = "db.hibernate.dialect"; private static final String PROP_HIBERNATE_SHOW_SQL = "db.hibernate.show_sql"; private static final…
type: Question

http://stackoverflow.com/comment/41954056
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26677411
has text: Looks like that worked, thanks. Why do some places require parens around the collection? I have several other repositories that require the parens and the only difference I can see is the parens are on the entity's collection and not the param. Is that the distinction?

http://stackoverflow.com/a/26830575
upvote count: 62
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/48191377
answers question: http://stackoverflow.com/q/26828815
has comment: http://stackoverflow.com/comment/64934338
score: 61
has body: This should be possible by first indexing the RDD. The transformation zipWithIndex provides a stable indexing, numbering each element in its original order. Given: rdd = (a,b,c) val withIndex = rdd.zipWithIndex // ((a,0),(b,1),(c,2)) To lookup an element by index, this form is not useful. First we need to use the index as key: val indexKey = withIndex.map{case (k,v) =&gt; (v,k)} //((0,a),(1,b),(2,c)) Now, it's possible to use the lookup action in PairRDD to find an element by key: val b = indexKey.lookup(1) // Array(b) If you're expecting to use lookup often on the same RDD, I'd recommend to cache the indexKey RDD to improve performance. How to do this using the Java API is an exercise left for the reader.
has comment: http://stackoverflow.com/comment/48193491
has comment: http://stackoverflow.com/comment/42233865
downvote count: 1
has comment: http://stackoverflow.com/comment/68031902
accepted answer of: http://stackoverflow.com/q/26828815

package
tags question: http://stackoverflow.com/q/26741205
tag name: package
tags question: http://stackoverflow.com/q/26748616
type: Tag
tags question: http://stackoverflow.com/q/26779722
tags question: http://stackoverflow.com/q/26803400

http://stackoverflow.com/a/26723992
accepted answer of: http://stackoverflow.com/q/26702605
has body: (there is no GUI in program) .. How can i embed this in HTML? You can't. The only Java classes that can be embedded in HTML are java.applet.Applet and javax.swing.JApplet. Both are GUIs.
answers question: http://stackoverflow.com/q/26702605
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42051630
type: Comment
has text: Well, like every other OOP concept (polymorphism, inheritance, etc), they are all interleaved. One scenario could be that the class your building now will be inherited. Again, focused on the fact that creating a public method (getter/setter/or any other method) is the objects API, your saying that subclasses will comply with your API. So, this class may set a local variable, a subclass may do something more significant for that subclass (polymorphism).
comment on: http://stackoverflow.com/a/26727425
score: 0
type: AnswerComment

http://stackoverflow.com/q/26825373
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26825438
has title: Adding OnClickListener in a listview using prepopulated or external database
has answer: http://stackoverflow.com/a/26825440
has body: I'm trying to build an Onclicklistener in listview using prepopulated database. I don't how to add some onclicklistener in this. Can someone show me how. Thanks! DataListView.java package com.example.thetrial; import java.io.IOException; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.widget.ListView; import android.widget.SimpleCursorAdapter; public class DataListView extends Activity { DBHelper dbhelper; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String[] from = new String[] { "_id", "comm", "desc" }; int[] to = new int[] { R.id.TextView1, R.id.TextView2, R.id.TextView3 }; dbhelper = new DBHelper(this); try { dbhelper.createDataBase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Cursor c = dbhelper.getData(); SimpleCursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.list, c, from, to); ListView list = (ListView) findViewById(R.id.ListView1); list.setAdapter(adapter); } } This is my DBHelper.java package com.example.thetrial; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DBHelper extends SQLiteOpenHelper { private static String DB_NAME = "trialeleventh"; private static int DB_Version = 2; private SQLiteDatabase db; private final Context context; private String DB_PATH; public DBHelper(Context context) { super(context, DB_NAME, null, DB_Version); this.context = context; DB_PATH = "/data/data/" + context.getPackageName() + "/" + "databases/"; } public void createDataBase() throws IOException { boolean dbExist = checkDataBase(); if (dbExist) { try { copyDataBase(); } catch (IOEx…
tagged with: listview
score: 0
tagged with: sqlite
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42219321

count
tags question: http://stackoverflow.com/q/26695850
tags question: http://stackoverflow.com/q/26817588
tag name: count
type: Tag
tags question: http://stackoverflow.com/q/26703137
tags question: http://stackoverflow.com/q/26767142

http://stackoverflow.com/q/26780709
has answer: http://stackoverflow.com/a/26787322
has body: I have installed Java 8 and I have the SchemaCrawler folder on E: on my machine. I run SQL Server 2012. The cmd command used is below sc.cmd -c graph -host=10.52.136.168 -user=sa -database=MyDBName schemacrawler.Main -infolevel=detailed -schemas=dbo -tabletypes=TABLE -outputformat=pdf -outputfile=database-diagram.pdf %* I have checked the suggestions given here but no luck . I still get the below error schemacrawler.schemacrawler.SchemaCrawlerSQLException: Could not connect to jdbc :hsqldb:hsql://10.52.136.168:9001/DeliveryIntelligence;readonly=true;hsqldb.lock _file=false, with properties {user=sa} at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti on(BaseDatabaseConnectionOptions.java:122) at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti on(BaseDatabaseConnectionOptions.java:70) at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(Sche maCrawlerCommandLine.java:176) at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerM ain.java:78) at schemacrawler.tools.hsqldb.Main.main(Main.java:43) Caused by: java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused: connect at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.&lt;init&gt;(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti on(BaseDatabaseConnectionOptions.java:115) ... 4 more Caused by: org.hsqldb.HsqlException: java.net.ConnectException: Connection refus ed: connect at org.hsqldb.ClientConnection.openConnection(Unknown Source) at org.hsqldb.ClientConnection.initConnection(Unknown Source) at org.hsqldb.ClientConnection.&lt;init&gt;(Unknown Source) ...…
type: AnsweredQuestion
has title: Not able to connect to MSSQL using Schemacrawler
tagged with: schemacrawler
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26787322
tagged with: sql-server
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/19659846

http://stackoverflow.com/comment/42034531
comment on: http://stackoverflow.com/q/26721936
has text: can you give me the AMCHART CDN link which you are using??
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26704237
upvote count: 1
answers question: http://stackoverflow.com/q/26704179
type: Answer
downvote count: 0
score: 1
has body: Because the Java compiler doesn't know what actual type to assign to v. If the objects being stored are subclasses of CellObject, then they are assignment compatible with CellObject, so you should be able just to use Vector&lt;CellObject&gt;. That's the whole point of polymorphism. It just means: create a Vector in which I can store anything of CellObject or below in the type hierarchy. If using Vector&lt;? extends CellObject&gt; in that context were meaningful, it could only mean the same as Vector&lt;CellObject&gt;.

http://stackoverflow.com/comment/41948234
type: Comment
score: 7
type: QuestionComment
has text: Look at http://docs.oracle.com/javase/7/docs/api/java/util/Stack.html
comment on: http://stackoverflow.com/q/26674401

http://stackoverflow.com/a/26687625
score: 0
type: Answer
has body: You should try this: for (int i = 0; i &lt; t; i++) { f = name.charAt(i); for (int j = 0; j &lt; t; j++) { // Remove this loop s = name.charAt(j); // Remove this also if (s == f) { // Change this to (c==f) e = 1; } } }
answers question: http://stackoverflow.com/q/26687573

http://stackoverflow.com/comment/42003870
score: 0
has text: You should extend TypeAndSize. Add the two new fields only to the extending class. btw. for the species you should use an enumeration instead of static short fields
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26705387

jetty
tags question: http://stackoverflow.com/q/26781173
tags question: http://stackoverflow.com/q/26700491
tag name: jetty
tags question: http://stackoverflow.com/q/26699090
tags question: http://stackoverflow.com/q/26799483
tags question: http://stackoverflow.com/q/26783215
tags question: http://stackoverflow.com/q/26690910
tags question: http://stackoverflow.com/q/26823338
tags question: http://stackoverflow.com/q/26770791
tags question: http://stackoverflow.com/q/26713630
tags question: http://stackoverflow.com/q/26801958
tags question: http://stackoverflow.com/q/26791966
type: Tag
tags question: http://stackoverflow.com/q/26709389
tags question: http://stackoverflow.com/q/26724120
tags question: http://stackoverflow.com/q/26753992
tags question: http://stackoverflow.com/q/26807629
tags question: http://stackoverflow.com/q/26729885

http://stackoverflow.com/comment/42120694
has text: @ForguesR Thank you. Where is the circular dependency, and why are all those unrelated tables included? The table names or datatype names do not show up in full text searches of the 8 relevant classes that I included in the file sharing link above.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26769989
score: 0

http://stackoverflow.com/q/26787148
upvote count: 1
linked to: http://stackoverflow.com/q/2445089
downvote count: 1
has body: I have a large String with many occurrences like this: List&lt;String&gt; I need to convert that String so that it matches List\&lt;String\&gt; I was assuming that I would use the Java replaceAll("", "") method but I can't get it to work as I am not all that familiar with Regular expressions. Any help would be appreciated
type: Question
has title: Replace specific character with escaped version in Java
has answer: http://stackoverflow.com/a/26787200
score: 0
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/26787200
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42150706

http://stackoverflow.com/a/26759356
type: Answer
downvote count: 0
score: 1
has body: maybe this also will help you. I've put it all together on a jpopupmenu public class Test { JPopupMenu popmenu; public boolean isConnected = false; public Test() { JFrame frame = new JFrame(); frame.setSize(200, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); popmenu = new JPopupMenu(); final JMenuItem connect = new JMenuItem("connect"); connect.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (!isConnected) { System.out.println("connect action"); connect(); isConnected = true; } else { System.out.println("disconnect action"); disconnect(); isConnected = false; } } }); } }); popmenu.insert(connect, 0); frame.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { popmenu.show(e.getComponent(), e.getX(), e.getY()); } } }); frame.setVisible(true); } private void connect() { loginForm login = new loginForm(); login.setVisible(true); // TODO: You should change the label only if connection actually // succeeds connect.setText("Disconnect"); } private void disconnect() { try { client.disconnect(); connect.setText("Connect"); } catch (IOException ex) { Logger.getLogger(systemTray.class.getName()).log(Level.SEVERE, null, ex); } } public static void main(String[] args) { new Test(); } }
answers question: http://stackoverflow.com/q/26757243
upvote count: 1

http://stackoverflow.com/q/26766525
possible better answer: http://stackoverflow.com/a/47903997
accepted answer: http://stackoverflow.com/a/26808275
favorite count: 0
has title: Selenium jSoup get data from Javascript Webpage
has answer: http://stackoverflow.com/a/26808275
type: AnsweredQuestion
has body: Have asked a few questions around this recently, but haven't really found what I'm looking for. I am trying to get all of the matches from http://www.futbol24.com/Live/?__igp=1&amp;LiveDate=20141106 to print out, with time, home team and away team. I understand the content is loaded after the page is. I have been told to use Selenium and then use jSoup on the result to get the data I want. Does anybody have a tutorial or some sample code they could show me, for how to do it on the website above? Any examples would be greatly appreciated, thanks
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/47903997
downvote count: 2
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/42183777
has comment: http://stackoverflow.com/comment/42132832
tagged with: jsoup
has comment: http://stackoverflow.com/comment/42116051
score: -2
tagged with: javascript
answer count: 2

http://stackoverflow.com/q/26743131
has title: The use of checked exception for errors to be dealt with in web layer
tagged with: java
type: Question
score: 0
answer count: 2
has body: I am having a hard time organizing how I should deal with errors that occur in the service layer. The reason for throwing that exception in this method is when the password provided is to weak or the confirmation id is wrong. The name of the exception is not settled yet though. However, are checked exceptions to be avoided in a new application anyway? If so, how do I communicate errors like this to the caller? The caller in this scenario is the web layer which exposes a web service. I want to handle the error in the web layer and create a error message. I have a method: boolean confirmPasswordReset(int accountId, String confirmationId, String newPassword) throws ConstraintViolation; And this is the exception class: public class ConstraintViolation extends Exception { public ConstraintViolation(String message) { super(message); } } From reading this article it looks like it should be right: http://www.oracle.com/technetwork/articles/entarch/effective-exceptions-092345.html Contingency Is considered to be: A part of the design Is expected to happen: Regularly but rarely Who cares about it: The upstream code that invokes the method Examples: Alternative return modes Best Mapping: A checked exception
has answer: http://stackoverflow.com/a/26743603
has answer: http://stackoverflow.com/a/26743437
tagged with: exception
type: UnansweredQuestion
tagged with: spring
tagged with: jakarta-ee
tagged with: spring-mvc

http://stackoverflow.com/comment/42132964
has text: Always try to look for existing thread/solution! Questions for this issue has been asked many times.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26777195

http://stackoverflow.com/comment/41952428
comment on: http://stackoverflow.com/q/26676614
has text: Do this (http://stackoverflow.com/questions/8172420/how-to-convert-a-char-to-a-string-in-java) for each element of your array
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/67735959
comment on: http://stackoverflow.com/q/26781994
has text: @Sagar I haven't figured out any 'magical' solution. But one lesson I have learned is that sometimes it is easier not to use associations and just store ids of referenced objects. Then you could lookup these objects from cached DAO.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26734863
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26734740
answers question: http://stackoverflow.com/q/26734740
has body: Because .getNodeValue(); does not return the value of the attribute. Try (Element)nodeList.item(0).getFirstChild()).getAttribute("value") instead. The value you are trying to read is not in the element node you are accessing. It is in a seperate attribute node which is only accessable when you cast your NodeList entry to Element.
type: AcceptedAnswer

http://stackoverflow.com/q/26764245
answer count: 2
upvote count: 0
tagged with: arrays
has title: How can I add a new row to an existing matrix?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42109475
score: -3
downvote count: 3
has body: public class matrix { public static void main(String [] args) { int rows = 4; int cols = 3; int[][] result = new int[rows][]; for (int i = 0; i &lt; rows; ++i) result[i] = new int[cols]; for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { System.out.print(result[i][j] + " "); } System.out.print("\n"); } } } Can I do the same thing, but for rows? I want to add new rows to a single row matrix.
has answer: http://stackoverflow.com/a/26764321
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26764290

http://stackoverflow.com/q/26801236
tagged with: java
possible better answer: http://stackoverflow.com/a/26802096
has answer: http://stackoverflow.com/a/26802096
has answer: http://stackoverflow.com/a/26809562
has body: I know there are tons of similar questions in SO, but I'm afraid I can't find an analog case to mine. Please forgive me if there is one (and I would love a link :). I have these two base classes, with self-bounded generics: public interface View&lt;V extends View&lt;V, P&gt;, P extends Presenter&lt;V, P&gt;&gt; { P getPresenter(); } public abstract class Presenter&lt;V extends View&lt;V, P&gt;, P extends Presenter&lt;V, P&gt;&gt; { protected V view; public void takeView(V view) { this.view = view; } } The reason behind this is that every presenter know the exact class of its view and viceversa, so they can communicate invoking methods in each other without any fuss. (Each presenter will define its own interface for their views to implement, so the architecture is cleaner, but you know what I mean...) If I implement them, there is no problem: public class FooView implements View&lt;FooView, FooPresenter&gt; { @Override public FooPresenter getPresenter() { FooPresenter p = new FooPresenter(); p.takeView(this); // Nice and clean! return p; } } public class FooPresenter extends Presenter&lt;FooView, FooPresenter&gt; {} Then, I want to create an abstract base class for some kind of views: public abstract class BaseView&lt;V extends BaseView&lt;V,P&gt;, P extends Presenter&lt;V,P&gt;&gt; extends SomeOtherBaseClass implements View&lt;V, P&gt; But I need to do an unchecked cast when linking presenter and view!!! @Override public P getPresenter() { P p = createPresenter(); // Another abstract, so every view can have its own presenter p.takeView((V) this); // Doesn't compile without casting, the cast is marked as unchecked return p; } As a funny aside, if I don't call takeView in BaseView, and do it in every concrete implementation, it works again... public class BarView implements BaseView&lt;BarView, FooPresenter&gt; { @Override public FooPresenter getPresenter() { FooPresenter p = createPresenter(); p.takeView(this); // javac likes this :/ return p; } } Is there any way of…
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42176035
linked to: http://stackoverflow.com/q/211143
has comment: http://stackoverflow.com/comment/42177451
has comment: http://stackoverflow.com/comment/42176703
accepted answer: http://stackoverflow.com/a/26809562
tagged with: generics
favorite count: 0
has title: Can I avoid this unchecked cast using self-bound generics and subclassing in Java?
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42176630
score: 1

http://stackoverflow.com/comment/42049934
has text: Yes i know that.But i want to stop deleting it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26731093

http://stackoverflow.com/q/26798838
has body: Boolean remove(String path, String S) throws ParserConfigurationException, SAXException, IOException{ File fXmlFile = new File(path); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document XMLbook = dBuilder.parse(fXmlFile); Node root = XMLbook.getFirstChild(); //(1) Node book = XMLbook.getElementsByTagName("BOOK").item(0);//(2) NodeList chapterNodes = ((Element)book).getElementsByTagName("Chapter"); Node subChapterNode=null; if(chapterNodes != null && chapterNodes.getLength() > 0) { Node chapterNode = chapterNodes.item(chapterNodes.getLength() - 1); NodeList subChapterNodes = ((Element)chapterNode).getElementsByTagName("Subchapter"); if(subChapterNodes != null && subChapterNodes.getLength() > 0) { subChapterNode = subChapterNodes.item(subChapterNodes.getLength() - 1); // System.out.println(subChapterNode.getNodeName()); Node toRemoveString=subChapterNode.getLastChild(); XMLbook.removeChild(toRemoveString); return Boolean.TRUE; } } return Boolean.FALSE; }; I want to delete the last node paragraph I have, but it gives me the error: Exception in thread "main" org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist. at com.sun.org.apache.xerces.internal.dom.ParentNode.internalRemoveChild(Unknown Source) at com.sun.org.apache.xerces.internal.dom.ParentNode.removeChild(Unknown Source) at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.removeChild(Unknown Source) at Books.SubChapter.remove(BookElement.java:92) at Books.Book.main(Book.java:22) To mention that System.out.println(subChapterNode.getNodeName()); prints well!! "Subchapter" So the problem is at the last two lines The XML file is: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <TITLE>Portocalia ca zapada I.C. Popovici Marin Eminescu Primul paragraf! Al doilea paragraf. Al treilea paragraf Primul paragraf, fata! A fost o data ca niciodata o fata cu parul…
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26799219
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: dom
score: 0
has comment: http://stackoverflow.com/comment/42173985
answer count: 1
has title: Delete XML node

http://stackoverflow.com/comment/42072740
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26743383
has text: No one answered your actual question, “(2-2^23)·2^127 is larger than the temp variable right?”. The answer is no (and you meant 2^-23).

http://stackoverflow.com/comment/42136668
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26779445
score: 2
has text: Look [here](http://stackoverflow.com/questions/8725387/why-there-is-no-sortedlist-in-java) mybe this helps.

http://stackoverflow.com/q/26694929
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26695005
tagged with: arrays
has title: Java 2D array assigning different values at different intervals
has body: I apologize if I'm not clear. I'm new to programming. So lets say I have a char[10][10]. And there are two+ chars I want to assign at intervals for example i[0][0] to i[5][7] have Y and the rest have N. How would I do that if its possible? I've been trying to figure it out for 6+ hours.
possible better answer: http://stackoverflow.com/a/26694995
answer count: 4
has answer: http://stackoverflow.com/a/26694995
accepted answer: http://stackoverflow.com/a/26695005
has answer: http://stackoverflow.com/a/26694999
score: 0
has comment: http://stackoverflow.com/comment/41985088
has answer: http://stackoverflow.com/a/26695066
type: AnsweredQuestion

http://stackoverflow.com/q/26734456
has comment: http://stackoverflow.com/comment/42056175
score: 1
tagged with: java
type: Question
tagged with: instantiation
has answer: http://stackoverflow.com/a/26734645
answer count: 2
upvote count: 1
has title: java getConstructor(String[].class)
has body: I tried the following code: constructor = oneClass.getConstructor(new Class[]{String[].class}); return constructor.newInstance(new String[]{"String01","String02"}) (the return Statement return an IllegalArgumentException) And Class stringArray = Class.forName("[Ljava.lang.String;"); constructor = oneClass.getConstructor(new Class[]{stringArray}) return constructor.newInstance(new String[]{"String01","String02"}) (the return Statement return an IllegalArgumentException) How to say that I want to instantiate a constructor with a String[] as argument. Thank You.
favorite count: 0
tagged with: constructor
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5760569
has answer: http://stackoverflow.com/a/26734544
downvote count: 0
tagged with: reflection

http://stackoverflow.com/a/26743657
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26742593
type: Answer
accepted answer of: http://stackoverflow.com/q/26742593
upvote count: 2
has body: Is there any situation where there is an advantage to keep the EJBs apart, in their own machine? Sometimes, specifics non-functional requirements can determine your app design. For example, security: in order to achieve some security norms, the business layer has to reside in a more secure server not exposed directly to Internet. Availability: if your business layer exposes some services consumed by a different client than the web server, and these services offer some kind of mission-critical functionality, probably they need to run on a 24/7 server. I'm not sure that think in terms of "advantage" is the correct way to see this kind of decoupled architecture. I think that is more like a price (which is translated in a more complex design) that you have to pay if you need achieve this kind of requirements. is there any kind of JavaEE container that manages EJBs but not JSP and servlets? Yes, for example OpenEjb.
has comment: http://stackoverflow.com/comment/42086269

http://stackoverflow.com/q/26708463
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/26708596
tagged with: java
has answer: http://stackoverflow.com/a/26708893
score: 0
answer count: 4
has body: I have a program which will call a function recursively. The below program gives me StackOverflowError. The output I expected is normal print, normal print, normal print, normal print, inside function splcase now, call action key word now, normal print, normal print, normal print, normal print, normal print. Is there any possibility to control the recursive function so that I get the required output? public class mytest1 { String path, keyword; public static void main(String args[]){ exec_script("normal"); } public static void exec_script(String exec_path){ for (int i=0; i&lt;10; i++) { if (i==4) { exec_path = "spl"; } switch (exec_path){ case "spl": spl_case(); break; case "normal": System.out.println("normal print"); break; case "call_action_path": System.out.println("call action key word now"); break; } } } public static void spl_case(){ System.out.println("inside function splcase now"); exec_script("call_action_path"); } }
has title: Java loop StackoverflowError - Any possibility to continue the previous loop when the same function is recurred again?
has answer: http://stackoverflow.com/a/26709164
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26708575

http://stackoverflow.com/q/26691901
type: AnsweredQuestion
tagged with: java
has title: Error serializing object class - when running Wicket and GAE
has comment: http://stackoverflow.com/comment/41981880
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/26708273
answer count: 1
tagged with: google-app-engine
tagged with: wicket
has answer: http://stackoverflow.com/a/26708273
has body: Issues running Wicket with GAE is: [INFO] SEVERE: Error serializing object class com.myapp.app.TemplatePage [object=[Page class = com.myapp.app.TemplatePage, id = 10, render count = 1]] [INFO] java.security.AccessControlException: access denied ("java.io.SerializablePermission" "enableSubclassImplementation") [INFO] at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457) [INFO] at java.security.AccessController.checkPermission(AccessController.java:884) [INFO] at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) [INFO] at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429) [INFO] at java.io.ObjectOutputStream.&lt;init&gt;(ObjectOutputStream.java:275) [INFO] at org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.&lt;init&gt;(JavaSerializer.java:250) [INFO] at org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.&lt;init&gt;(JavaSerializer.java:243) [INFO] at org.apache.wicket.serialize.java.JavaSerializer.newObjectOutputStream(JavaSerializer.java:176) [INFO] at org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:76) [INFO] at org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:376) [INFO] at org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:150) [INFO] at org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:412) [INFO] at org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:181) [INFO] at org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:98) [INFO] at org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:73) [INFO] at org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:258) [INFO] at org.apache.wicket.Application$2.onDetach(Applica…

http://stackoverflow.com/comment/42176335
comment on: http://stackoverflow.com/a/26800737
type: AnswerComment
score: 0
type: Comment
has text: ,Thanks for the suggestion , i have made the the changes as mentioned by you but still i am facing same problem... Please see my edited code

http://stackoverflow.com/comment/42157715
has text: For pity's sake, don't post screenshots of textual information! Copy/paste the ***text*** contained in the command line.
comment on: http://stackoverflow.com/q/26777481
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26770380
tagged with: glassfish
tagged with: servlets
linked to: http://stackoverflow.com/q/19054371
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26788460
tagged with: utf-8
has title: JSP/GlassFish: how to setup UTF-8 encoding correctly
has body: I'm looking for help to get all my layers in the stack to UTF-8 encoding. I found this nice article: http://www.javapractices.com/topic/TopicAction.do?Id=206 describing the 3 places I need to worry about encoding. Since my (1) Oracle database is currently set to UTF-8, that leaves the (2) browser and (3) server to worry about. I also found this detailed article http://balusc.blogspot.com/2009/05/unicode-how-to-get-characters-right.html#JSPServletRequest which I'm trying to follow below, but with some newbie questions about implementation. To address the browser, I've made sure to include the following at the top of each JSP page: <%@page pageEncoding="UTF-8"%> (For reference, see here). To address the server, I made sure to include the following line in the Java servlet and JSP pages before issuing a request.getParameter() or request.getAttribute() statement: request.setCharacterEncoding("UTF-8"); Since I'm using GlassFish 3.1.2, I understand it does not use UTF-8 by default, so I need to set it manually somehow. I've seen a lot of websites talking about a file named glassfish-web.xml. Is this part of the normal glassfish install? I don't know where to find it. I've been using the web.xml file in my WEB-INF folder for my web application. Could someone help me figure out whether I need to modify this web.xml file, or do I need to locate or create a new file named glassfish-web.xml, to configure encoding for glassfish? My web.xml file starts with: <?xml version="1.0" encoding="UTF-8"?> ... For the JSP/servlet request, I include the following line in the web.xml file <parameter-encoding default-charset="UTF-8"/> Is this OK to put in the web.xml file? Or, does it need to go in some glassfish-web.xml file? For the JSP/servlet response, I put the following in my web.xml file (see accepted answer here): *.jsp UTF-8 I'm assuming these lines just insert between and . But, let me know if they should instead go inside some other descriptor (such as and )? I also put the follow…
type: AnsweredQuestion
score: 7
linked to: http://stackoverflow.com/q/6279504
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/26788460
linked to: http://stackoverflow.com/q/2341330
tagged with: java
tagged with: character-encoding
linked to: http://stackoverflow.com/q/7643484

http://stackoverflow.com/comment/42137750
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26770789
has text: Do you have Spring Tool Suite or any other special plugin installed in Eclipse?

http://stackoverflow.com/a/26712829
has body: Just add attributes to your Stensaxpaseclass, something like private int numberOfWinsUser; private int numberOfWinsComputer; And each time someone wins (in berakna) you update them and check if someone has reached 3 wins. Since this event driven, there is no need to use a loop.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42019522
answers question: http://stackoverflow.com/q/26712479
has comment: http://stackoverflow.com/comment/42017291
has comment: http://stackoverflow.com/comment/42017510
has comment: http://stackoverflow.com/comment/42016702

http://stackoverflow.com/comment/42132446
comment on: http://stackoverflow.com/q/26777023
has text: @Lars Blumberg Just trying a coding puzzle...@SpaceTrucker the query is just a String its not Hibernate / JPA.@Stewart thanks
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26806959
score: 0
has title: Change speed of audio by transforming samples NOT the sound card speed (in Java)
has comment: http://stackoverflow.com/comment/42247836
tagged with: android
has comment: http://stackoverflow.com/comment/42312538
tagged with: audio
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has body: I have an application that "syncs" multiple devices playing the same sound in Java. In order to do this I need to slightly speed up/slow down the sound playback. I originally tried this by changing my audio card's sample rate (via Android's AudioTrack api or the Java sound api for the desktop). Unfortunately changing the sample rate on some sound cards introduces a lag and a "popping" noise. So is there a way to remove/add samples to my bytestream of audio data without making the audio sound "weird"? Perhaps a library can do this?

http://stackoverflow.com/a/26833503
has comment: http://stackoverflow.com/comment/42432062
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26827487
downvote count: 0
score: 1
has body: Whenever you get any error back from a queue manager, remember that you should always look in the queue manager AMQERR01.LOG for a more detailed explanation. This is especially true for any security related error, since only a single error code - MQRC_NOT_AUTHORIZED (2035) - which is translated into JMS Exception JMSWMQ2013 - is returned to the application so as to not give away the details why to any potential hacker. You must always look at the queue manager error log for the details.

http://stackoverflow.com/q/26750768
has comment: http://stackoverflow.com/comment/42085414
tagged with: swing
has comment: http://stackoverflow.com/comment/42085349
has comment: http://stackoverflow.com/comment/42086113
has comment: http://stackoverflow.com/comment/42085484
tagged with: java
has comment: http://stackoverflow.com/comment/42085387
type: Question
has body: how can I identify that mousedragged event is stopped even though mouse is not released in java swing. I need to implement a scenario in which when mouse is pressed and moved it has to behave as selection mode then if it waits at a particular location for some time then it behaves as drag drop mode.
has comment: http://stackoverflow.com/comment/42085786
score: 0
has comment: http://stackoverflow.com/comment/42086496
answer count: 0
has comment: http://stackoverflow.com/comment/42086744
has comment: http://stackoverflow.com/comment/42085319
has title: how can I identify that mousedragged event is stopped even though mouse is not released in java swing
type: UnansweredQuestion

http://stackoverflow.com/a/26805172
has body: First, you need to find the encoding of this string. Is it specified somewhere? Once that's accomplished, you can do InputStream in = ...; // open a stream to your RSS feed InputStreamReader reader = new InputStreamReader(in, streamFormat);
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26805083

http://stackoverflow.com/a/26821031
has body: You don't have to always use Intent to send data between activities. You use other android storage options like Sqlite db, SharedPreferences. You can also store data on SDcard. Have a look at Android storage options here
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26820900
downvote count: 0

http://stackoverflow.com/q/26785843
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/42149150
has body: I have problem with working on fragments. I am in Activity 1. I add fragment to this activity and call method. Then this method calls other metod but in fragment class. In this method i want to button.setVisibility(View.VISIBLE) but it throws me NullPointer. Code: Own class container: public class Container { private ImageButton ib; private int stan; private int wartosc; public Container(ImageButton ib, int stan, int wartosc) { this.ib = ib; this.stan = stan; this.wartosc = wartosc; } public int getStan() { return stan; } public int getWartosc() { return wartosc; } public void setWartosc(int wartosc) { this.wartosc = wartosc; } public void setStan(int stan) { this.stan = stan; } public ImageButton getButton() { return ib; } } Fragment: ImageButton b1; Container button1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { V = inflater.inflate(R.layout.face_fragment, container, false); b1 = (ImageButton) getActivity().findViewById(R.id.nr1); // i also tried something like that: b1 = (ImageButton) V.findViewById(R.id.nr1); context = V.getContext(); addResources(); button1 = new Container(b1, 1, 0); return V; } And fragment of method which throw nullpointer: public void setVisible() { if(all) { button1.getButton().setVisibility(View.VISIBLE); //here nullpointer Please, help me, i have no idea.... &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" tools:context=".FaceFragment" android:weightSum="20" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_weight="10" android:weightSum="30" android:layout_width="fill_parent" android:layout_height="0dp" &gt; &lt;ImageButton android:contentDescription="@string/app_name" android:id="@+id/nr1" android:layout_width="0dp" android:layout_height="fi…
has title: fragment setVisibility NullPointer
score: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/26785934
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/26721345
accepted answer: http://stackoverflow.com/a/26723660
tagged with: classloader
has body: I've been messing around with ClassLoaders in java recently, trying to run my automation script code which uses dynamic loading of classes and geting ClassNotFoundException. ##MyCode package com.actitime5.frameworkengine; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import com.gmail5.Testcases.LoginLogout; import org.junit.runner.JUnitCore; public class Init { public static void main(String args[]) throws Exception { Init in=new Init(); String url=in.getConfigValue("url"); ExcelLibrary lib=new ExcelLibrary(); JUnitCore core = new JUnitCore(); int numberofTestcases=lib.getRowCont("Scenario"); System.out.println(numberofTestcases); for(int i=1;i&lt;=numberofTestcases;i++) {String status=lib.getExcelData("Scenario", i, 1); if(status.equals("yes")) {String scriptnam=lib.getExcelData("Scenario", i, 0); System.out.println("Sheet Name"+" "+scriptnam); Class scriptToRun= Class.forName("com.gmail5.Testcases."+scriptnam); core.run(scriptToRun); } }} ##Errors that i am getting : 1 Sheet Name LoginLogout Exception in thread "main" java.lang.ClassNotFoundException:com.gmail5.Testcases.LoginLogout at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.gmail5.frameworkengine.Init.main(Init.java:24) The class which I am trying to load is available in package: com.gmail5.Testcases.*;,but still it throws exception
has title: Getting ClassNotFoundException while using Class.forName("com.actitime5.Testcases."+vriable);
has answer: http://stackoverflow.com/a/26723660
type: AnsweredQuestion
tagged with: java
tagged with: class
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42034140
answer count: 1
has comment: http://stackoverflow.com/comment/42034659

http://stackoverflow.com/q/26789341
downvote count: 1
type: AnsweredQuestion
has body: This may be kind of difficult to explain, but I'm trying to create a Java class from a string of html markup. I'd like to be able to take the string and create an object and populate all the member variables with the values. From there I'd also like to be able to take that object and have it spit back the html markup. The html markup is technically XML so I have to think this is possible. Here's a quick snippet of the html string -- it's fairly straight forward. There's a map tag with 0 to many area tags as children. &lt;map id="..." name="..."&gt; &lt;area shape="rect" alt="" title="" coords="68,67,159,159" href="/" target="_self" /&gt; &lt;area shape="circle" alt="" title="" coords="217,43,344,148" href="google.com" target="" /&gt; .... &lt;/map&gt; Anyone know of any java libraries to ease this process? I'm struggling.
tagged with: java
has comment: http://stackoverflow.com/comment/42155997
tagged with: jaxb
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42184702
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26829142
has comment: http://stackoverflow.com/comment/42154916
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42155184
has comment: http://stackoverflow.com/comment/42180276
accepted answer: http://stackoverflow.com/a/26829142
tagged with: xsd
has title: Model a class from a string of Html, instantiate the class and populate variables from the string, and return the html string from the class
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42155117
upvote count: 1

http://stackoverflow.com/comment/41983799
score: 0
has text: jeez -i need to stay in more!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26694220

http://stackoverflow.com/a/27057974
answers question: http://stackoverflow.com/q/26802394
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26802394
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/42659234
has comment: http://stackoverflow.com/comment/42663499
upvote count: 3
has body: I played around with a Gradle AspectJ plugin and applied it to the annotation subproject like this: buildscript { repositories { maven { url "https://maven.eveoh.nl/content/repositories/releases" } } dependencies { classpath "nl.eveoh:gradle-aspectj:1.4" } } project.ext { aspectjVersion = '1.8.4' } apply plugin: 'aspectj' project.convention.plugins.java.sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_7 project.convention.plugins.java.targetCompatibility = org.gradle.api.JavaVersion.VERSION_1_7 Now the app works in the emulator and DDMS from the Android SDK shows that the advice output is on the console as expected. :-) Please note that I have upgraded the project to AspectJ 1.8.4 and Java 7. I have also changed these settings: Index: app/build.gradle =================================================================== --- app/build.gradle (revision 9d9c3ce4e0f903b5e7c650f231577c20585e6923) +++ app/build.gradle (revision ) @@ -2,8 +2,7 @@ dependencies { // aspectJ compiler - compile 'org.aspectj:aspectjrt:1.8.1' - + compile 'org.aspectj:aspectjrt:1.8.4' compile (project (':annotation')) } @@ -50,13 +49,13 @@ JavaCompile javaCompile = variant.javaCompile javaCompile.doLast { String[] args = ["-showWeaveInfo", - "-1.5", + "-1.7", "-XnoInline", "-inpath", javaCompile.destinationDir.toString(), "-aspectpath", javaCompile.classpath.asPath, "-d", javaCompile.destinationDir.toString(), "-classpath", javaCompile.classpath.asPath, - //"-log", "/home/flo/workspace/test-aspectj/weave.log", + "-log", "weave.log", "-bootclasspath", plugin.project.android.bootClasspath.join(File.pathSeparator)] MessageHandler handler = new MessageHandler(true); Index: build.gradle =================================================================== --- build.gradle (revision 9d9c3ce4e0f903b5e7c650f231577c20585e6923) +++ build.gradle (revision ) @@ -5,7 +5,7 @@ dependencies { classpath 'com.android.tools.build:gradle:0.12.+' // aspectj - http://fernandocejas.com/2014/08/03/aspect-oriented-…

http://stackoverflow.com/q/26722626
tagged with: soap
tagged with: java
linked to: http://stackoverflow.com/q/649209
has body: I try to send soap message from client written by me to server also written by me through sockets. I'll try to paste only important code that should do that (communication between server and client is ok - I can send String object): Client /* Soap */ MessageFactory factory = MessageFactory.newInstance(); SOAPMessage soapMsg = factory.createMessage(); SOAPPart part = soapMsg.getSOAPPart(); SOAPEnvelope envelope = part.getEnvelope(); SOAPHeader header = envelope.getHeader(); SOAPBody body = envelope.getBody(); header.addTextNode("SomeText"); header.setValue("SomeValue"); SOAPBodyElement element = body.addBodyElement(envelope.createName("JAVA", "training", "aaa")); element.addChildElement("XXX").addTextNode("YYY"); SOAPBodyElement element1 = body.addBodyElement(envelope.createName("JAVA", "training", "bbb")); element1.addChildElement("Spring").addTextNode("TrainingonSpring"); /* Soap */ String soapMessage = soapMsg.toString(); Socket s = new Socket(serverHostname, 10007); PrintStream out = new PrintStream(s.getOutputStream(), true); out.println(soapMessage); Server ServerSocket serverSocket = new ServerSocket(10007); Socket socket = serverSocket.accept(); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String inputLine = in.readLine(); // I've read Soap as a String and I want to change it to SoapMessage InputStream is = new ByteArrayInputStream(inputLine.getBytes()); SOAPMessage soap = MessageFactory.newInstance().createMessage(null, is); // I try to print for example Header Value to system output System.out.println(soap.getSOAPHeader().getValue().toString()); I have a lot of runtime errors in Server when I try to call last line. ERROR: 'Content is not allowed in prolog.' Nov 03, 2014 9:25:43 PM com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope SEVERE: SAAJ0511: Unable to create envelope from given source Exception in thread "main" com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create enve…
type: Question
tagged with: network-programming
has answer: http://stackoverflow.com/a/26768562
has title: Sending SOAPMessage through sockets
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/42116701

http://stackoverflow.com/comment/42142132
type: Comment
has text: What does the SQL for the table creation show?
comment on: http://stackoverflow.com/q/26774684
score: 0
type: QuestionComment

http://stackoverflow.com/a/26734469
score: 1
answers question: http://stackoverflow.com/q/26734389
downvote count: 0
has body: You should save your downloaded file in Hangman.java and not hangman.java (see it needs 'H' in caps same as your class name).
type: Answer
upvote count: 1

http://stackoverflow.com/a/26814452
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26804982
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26804982
has body: In a fixedRate task, for every iteration the executor checks if the number of currently running threads is less than corePoolSize then it creates a new thread and starts at the exact fixedRate time is greater than corePoolSize but less than maximum pool size then it creates a new thread and starts at the exact fixedRate time is equal to the maximum pool size then that execution is lost For example, if you are using the ThreadPoolTaskScheduler the maximum pool size is set to Integer.MAX_VALUE.

http://stackoverflow.com/a/26813817
type: Answer
answers question: http://stackoverflow.com/q/26813744
has comment: http://stackoverflow.com/comment/42199449
score: 0
has comment: http://stackoverflow.com/comment/42199404
has comment: http://stackoverflow.com/comment/42199840
has body: when you want add SampleFragment to your activity set it a tag, e.g "SampleFragment". then public void onButtonClick(...){ FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); SampleFragment parent = (SampleFragment)fm.findFragmentByTag("SampleFragment"); parent.refreshview(); } have not test it but it may help:-)

http://stackoverflow.com/comment/42160321
type: Comment
has text: I need to store byte array in values ... and key will just increment when i'm adding new value..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26791295

identifier
tag name: identifier
tags question: http://stackoverflow.com/q/26791204
type: Tag
tags question: http://stackoverflow.com/q/26745402

http://stackoverflow.com/comment/42217342
comment on: http://stackoverflow.com/q/26719773
type: QuestionComment
type: Comment
has text: And, please, stackusers... Don't feed these behaviours just because you love to have reputation because you're turning a useful forum-solving-issue tool into a lazy programmer code generation tool!!!!
score: 0

excel
tags question: http://stackoverflow.com/q/26745959
tags question: http://stackoverflow.com/q/26721094
tags question: http://stackoverflow.com/q/26687171
tags question: http://stackoverflow.com/q/26709945
tags question: http://stackoverflow.com/q/26675062
tag name: excel
tags question: http://stackoverflow.com/q/26688945
tags question: http://stackoverflow.com/q/26714801
tags question: http://stackoverflow.com/q/26808626
tags question: http://stackoverflow.com/q/26758099
type: Tag
tags question: http://stackoverflow.com/q/26755449
tags question: http://stackoverflow.com/q/26697255
tags question: http://stackoverflow.com/q/26771133
tags question: http://stackoverflow.com/q/26804035
tags question: http://stackoverflow.com/q/26829424
tags question: http://stackoverflow.com/q/26680184
tags question: http://stackoverflow.com/q/26733258
tags question: http://stackoverflow.com/q/26808053

http://stackoverflow.com/comment/42007401
has text: @mussharapp this is the code `return HttpManager.getData(params[0]);`
comment on: http://stackoverflow.com/q/26707385
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26798843
has comment: http://stackoverflow.com/comment/42172016
score: 2
type: AnsweredQuestion
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/42179440
has answer: http://stackoverflow.com/a/51397511
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42175685
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42171880
favorite count: 0
accepted answer: http://stackoverflow.com/a/51397511
has body: I have the following LocalContainerEntityManagerFactoryBean @Bean public static LocalContainerEntityManagerFactoryBean fakeEntityManagerFactory(){ LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean(); MergingPersistenceUnitManager persistenceManager = new MergingPersistenceUnitManager(); persistenceManager.setPersistenceXmlLocation("classpath*:META-INF/fake/persistence.xml"); bean.setPersistenceUnitManager(persistenceManager); bean.setPersistenceUnitName("fake"); HibernateJpaVendorAdapter jpaVendorAdapter= new HibernateJpaVendorAdapter(); jpaVendorAdapter.setGenerateDdl(false); bean.setJpaVendorAdapter(jpaVendorAdapter); return bean; } The Persistence.xml contains the following: org.hibernate.ejb.HibernatePersistence fake ENABLE_SELECTIVE however when it sets the persistenceUnitName (bean.setPersistenceUnitName("fake");) I get the exception java.lang.IllegalArgumentException: No persistence unit with name 'fake' found I believe this is because the bean hasn't yet loaded the persistence units when it is being set. How can this be resolved? Edit: I read that .setPersistenceUnitName shouldn't be used if setting the persistenceUnitManager : (taken from official docs) NOTE: Only applied if no external PersistenceUnitManager specified. However If i remove it, it results in an : java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/fake/persistence.xml}
has title: LocalContainerEntityManagerFactoryBean instantiation not finding persistenceunit
has comment: http://stackoverflow.com/comment/42171859
upvote count: 2
tagged with: spring

http://stackoverflow.com/a/27773148
has body: The simplest way is to use mvn -Dtest=LUDecompositionTest from the top level of the source distribution (or a checkout of the development sources or a release tag). If you don't want to use maven, but you are willing to use Ant, there is a build.xml included with the source and you can edit the compile.tests target to include only the test you want to execute. Just eliminate the wildcards and specify &lt;include name="**/*LUDecompositionTest.java"/&gt; then do ant clean test If you really want to do this on the command line without either Ant or Maven, you need to create a new jar including your changes and put jar on the classpath above in place of the distribution jar.
answers question: http://stackoverflow.com/q/26711327
score: 0
type: Answer

http://stackoverflow.com/comment/42167967
has text: Impossible unless you've created both in the same millisecond. Or, in case you're rounding down to seconds, in the same second.
comment on: http://stackoverflow.com/a/26796966
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26729489
tagged with: esb
has title: multiple inbound in one flow mule esb
tagged with: ftp
has answer: http://stackoverflow.com/a/26730106
type: UnansweredQuestion
tagged with: http
type: Question
tagged with: java
tagged with: mule
has body: I need to create one esb flow. first use http inbound to post json. on basis of post json I get filename. fetch that file from ftp server. drop that file to another ftp server call external api is we can do this using esb? I am using first http-inbound to post json then ftp-inbound to fetch file but I am getting error?
answer count: 1
score: 0

http://stackoverflow.com/comment/42210732
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26820390
has text: I would say do not mix data transmission mechanisms with protocols. But I honestly don't get your point there.

http://stackoverflow.com/q/26712466
has comment: http://stackoverflow.com/comment/42016164
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26712576
has comment: http://stackoverflow.com/comment/42016224
has answer: http://stackoverflow.com/a/26712576
has answer: http://stackoverflow.com/a/26712955
favorite count: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26712955
has title: my eclipse ide can't compile my android program
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42016226
tagged with: java
has body: am not new to java programming. I recently downloaded the android SDK to begin practice android programming. my eclipse Ide hasn't really been friendly with me because, at first it refused to install the adt plugin I donwloaded. till I installed it from google. and now it find it difficult to run even the helloworld program. it gives me several errors. something about */user/***/res/value/*.xml not found or dark theme something not found, appcompat.v7 no resoirse found . and also do I really to install all the items in the android SDK before I can compile anything. because the file size of my android-SDK-windows file is way over 10gb. and it looks odd plus my data bundle has been exhausted. thanks..
tagged with: eclipse

http://stackoverflow.com/comment/41986766
type: Comment
type: QuestionComment
has text: OK, with an array 10 times larger (about 50000 elements), it takes 7s vs. 3s.
comment on: http://stackoverflow.com/q/26695869
score: 0

http://stackoverflow.com/a/26752794
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You do not need the Resources/ ResourceBundle.getBundle("MessageBundle"); From javadoc : baseName - the base name of the resource bundle, a fully qualified class name As Resources seems to be in your class path, it should work.
answers question: http://stackoverflow.com/q/26752667

http://stackoverflow.com/a/26736648
has comment: http://stackoverflow.com/comment/42060990
has comment: http://stackoverflow.com/comment/42065500
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42065644
has comment: http://stackoverflow.com/comment/42065753
answers question: http://stackoverflow.com/q/26736562
accepted answer of: http://stackoverflow.com/q/26736562
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/42061360
downvote count: 0
has comment: http://stackoverflow.com/comment/42060928
has body: The Activity class does not have a getSupportFragmentManager() method. Instead make your activity extend FragmentActivity which does have.
has comment: http://stackoverflow.com/comment/42065879
has comment: http://stackoverflow.com/comment/42066265
upvote count: 6
has comment: http://stackoverflow.com/comment/42065571

http://stackoverflow.com/a/26750405
score: 1
answers question: http://stackoverflow.com/q/26748246
has comment: http://stackoverflow.com/comment/42099330
has body: Try adding "-XX:PermSize=128M -XX:MaxPermSize=256M" in your Run Configuration->Arguments tab-> VM arguments
upvote count: 2
type: Answer
downvote count: 1

android-open-accessory
tag name: android-open-accessory
type: Tag
tags question: http://stackoverflow.com/q/26699782

http://stackoverflow.com/comment/48887364
comment on: http://stackoverflow.com/a/30399432
score: 0
type: Comment
has text: _"The original string is lost; there is no way to convert from the resulting integer to the input string."_ Note that this is true for any good hash function: they're deliberately one-way.
type: AnswerComment

http://stackoverflow.com/a/26804605
type: AcceptedAnswer
score: 0
type: Answer
has body: Problem solved! The handler was not properly deployed on the esb server
accepted answer of: http://stackoverflow.com/q/26678938
answers question: http://stackoverflow.com/q/26678938

http://stackoverflow.com/comment/42180973
type: Comment
comment on: http://stackoverflow.com/q/26792363
score: 2
has text: Why would I do that? The reason we use JPA is to be able to change out our ORM if we want.
type: QuestionComment

http://stackoverflow.com/comment/42201371
has text: Perfect! Just what I was looking for but failed to find - many thanks.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26808455
type: AnswerComment

http://stackoverflow.com/a/26796381
has body: I need to get only Staemap as respone but i am getting whole jsp page as response. Because you are returning the ModelAndView object with the view here, return new ModelAndView("LoginForm","state" ,stateMap); If you need to return the respone alone from the controller method.However you cant print the HashMap directly in the ajax response on your jsp. IMHO you can convert it to JSONArray JSONArray jarray = JSONArray.fromObject(statemap); Read , send array from controller to a view using JSON in MVC Sending JSON response from spring controller loop through json array jquery
upvote count: 1
answers question: http://stackoverflow.com/q/26796352
has comment: http://stackoverflow.com/comment/42172246
type: Answer
has comment: http://stackoverflow.com/comment/42172120
downvote count: 0
has comment: http://stackoverflow.com/comment/42199535
has comment: http://stackoverflow.com/comment/42199489
score: 1

http://stackoverflow.com/q/26711358
type: Question
accepted answer: http://stackoverflow.com/a/26711393
has title: Java compilation error with BlueJ
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42014119
tagged with: java
tagged with: bluej
upvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42013994
has answer: http://stackoverflow.com/a/26711393
has body: For practicing purpose, I am trying to copy and paste a program from a book and find out the result but it still brings me the compilation error: "cannot find symbol - class ActionListner". My compiler if BlueJ. The code is: import java.awt.*; import java.awt.event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Ex3 { public static void main (String[] args) { F f = new F (" Exemplul 3 "); f.setSize(300, 100); f.setVisible(true); } } class F extends Frame implements ActionListner { Label L1, L2; TextField T1, T2; Button B; int c1, c2; F(String s) { setTitle(s); setLayout(new FlowLayout()); L1 = new Label("Numar"); add(L1); T1 = new TextField("0"); add(T1); L2 = new Label("Plus "); add(L2); T2 = new TextField("0"); add(T2); B = new Button("Adauga"); add(B); B.addActionListner(this); } public void actionPerformed(ActionEvent e) { c2 = Integer.parseInt (T2.getText()); c1 += c2; T1.seText(Integer.toString(c1)); } } Can anyone give any clue about the error, please? BTW: please note that this is my 1st Java code. Thanks a lot.
favorite count: 0
score: -1

http://stackoverflow.com/a/26822832
has comment: http://stackoverflow.com/comment/42215120
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26822796
upvote count: 2
has body: The simple reason is: because JOptionPane.showInputDialog() returns a String, regardless of what you actually want the user to input. There's no mechanism in Java to do automatic conversion based on the type of your destination variable myScore (though some other languages can do this, e.g. implicit conversions in Scala). You could (in principle) create a custom dialog that returns an int , e.g. by getting the user to choose from a pulldown list of numbers, and then no parsing would be needed. But otherwise, you have to do parsing explicitly.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26822796

http://stackoverflow.com/a/26829337
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42227325
has comment: http://stackoverflow.com/comment/42226307
answers question: http://stackoverflow.com/q/26829280
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42226512
has comment: http://stackoverflow.com/comment/42226783
has comment: http://stackoverflow.com/comment/42226410
has body: You're using the wrong type of OnClickListener! Here is what my code looks like: receiverList = dbTools.getAllReceivers(); dbTools.close(); listView = getListView(); if(receiverList.size() != 0) { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int index, long id) { TextView textView = (TextView) view.findViewById(R.id.receiverId); setReceiverSelection(Integer.valueOf(textView.getText().toString())); ((SimpleAdapter) getListAdapter()).notifyDataSetChanged(); } }); SimpleAdapter adapter = getNewAdapter(); setListAdapter(adapter); } You need to use AdapterView.OnItemClickListener(). In its onItemClick() method, you'll get the view and index of the row that was clicked. Hope this helps. Good luck :) EDIT: If you are looking to have a listener on the button in the row, this is the easiest way to do it. In the XML for the added rows, add android:onClick="methodName" to the XML for the Button. Then in the activity where you have your ListView, add the bottom, add a method called methodName which takes a View as a parameter. It'll look like this. public void methodName(View view) { } Now inside of that, we'll want to figure out which row had it's button pressed. I did that this way: public void methodName(View view) { LinearLayout vwParentRow = (LinearLayout)view.getParent(); TextView recId = (TextView) vwParentRow.findViewById(R.id.receiverId); System.out.println(recId.getText().toString() + " had its button pressed!"); } If your button is 'buried' deeper (like if you have a LinearLayout inside of your LinearLayout and the button is inside of that, just get the parent of the parent: LinearLayout parentOfParent = (LinearLayout) vwParentRow.getParent(); EDIT2: You can also add a listener programmatically as far as I know and have it do the same thing onClick as I showed you in methodName. The way I showed definitely works - I used it in my app.

http://stackoverflow.com/q/26705103
has answer: http://stackoverflow.com/a/26705652
type: Question
tagged with: computer-science
linked to: http://stackoverflow.com/q/6144227
score: -2
has answer: http://stackoverflow.com/a/26705232
has comment: http://stackoverflow.com/comment/42003842
has title: How to set numbers to a name in java
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/26705652
has body: Im trying to design a game that plays the Hi/Lo card game until the user gets 4 correct answers in a row, although theres a problem with the code.. I dont know how to make it so the card number that pops up once the user states "Higher", "Lower" or "Equal" is the number that they were comparing the last 'cardGenerated' number to. Right now its comparing it to a number that the user doesnt see or is unknown to, so they dont know wether they were right or wrong. I know i can just add the 'nextCard' variable into the showOptionDialog output although i'd prefer to just have one number being output, so if the program prints: "The Card pulled is the 9 Is the next card Higher, Lower or Equal?" the next number/card outputted is the number that the user was comparing the previous number(9) to. Also, I have set the constants, but I'm not sure how to make it so instead of printing 11, 12, 13, 1, it prints JACK, QUEEN, KING, ACE, and what not. import java.util.Random; import javax.swing.JOptionPane; public class HiLo { public static final int JACK = 11; public static final int QUEEN = 12; public static final int KING = 13; public static final int ACE = 1; public static void main(String[] args) { int correctGuesses = 0; Random generator = new Random(); int currentCard; int nextCard = generator.nextInt( KING+1 ); while (correctGuesses &lt; 4) { currentCard = nextCard; nextCard = generator.nextInt( KING+1 ); Object[] options = {"Higher", "Lower", "Equal"}; int Input = JOptionPane.showOptionDialog(null, "The Card pulled is the " + currentCard + " \nis the next card Higher, Lower or Equal?", "HiLo Card Game", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if ( nextCard &gt; currentCard &amp;&amp; Input == JOptionPane.YES_OPTION ) { correctGuesses++; } else if ( nextCard &gt; currentCard &amp;&amp; Input == JOptionPane.NO_OPTION ) { correctGuesses = 0; } else if ( nextCard &gt; currentCard &amp;&amp; Input == JOptionPane.CANCEL_OPTION ) { …
favorite count: 0
duplicate of: http://stackoverflow.com/q/6144227
has comment: http://stackoverflow.com/comment/42003320
has comment: http://stackoverflow.com/comment/42003436
has comment: http://stackoverflow.com/comment/42003484
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42003924
tagged with: java
accepted answer: http://stackoverflow.com/a/26705232

http://stackoverflow.com/comment/42033719
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26721749
has text: Also, look the answer here: http://stackoverflow.com/questions/19563766/eclipse-kepler-for-os-x-mavericks-request-java-se-6
type: QuestionComment

http://stackoverflow.com/q/26727620
tagged with: string-formatting
has answer: http://stackoverflow.com/a/26727688
has body: So i am writing a method that takes in a file input and a file output. Reads the input file and adds line numbers to the lines so it should read " 1 | LINE" so the number is right aligned 3 spaces followed by number and a "|" with a space before and after it. I am having trouble printing out the line. My code so far is: public class LineNumbers { public static void process(File input, File output) { ArrayList&lt;String&gt; fileInput = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; out = new ArrayList&lt;String&gt;(); int counter = 0; int counter1= 1; try { Scanner scanner = new Scanner(input); PrintWriter writer = new PrintWriter(output); while (scanner.hasNextLine()) { fileInput.add(scanner.nextLine()); String a = fileInput.get(counter); String line = String.format("%3s | " ,counter1,a); out.add(line); counter++; counter1++; for(String n:fileInput){ writer.println(n); } } scanner.close(); writer.close(); } catch (IOException e) { } } }
downvote count: 1
has title: How to add line numbers to input file
tagged with: java
score: -1
type: Question
answer count: 2
upvote count: 0
tagged with: file-io
has answer: http://stackoverflow.com/a/26728040
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26682460
downvote count: 0
has comment: http://stackoverflow.com/comment/41975769
has comment: http://stackoverflow.com/comment/41963835
score: 5
has comment: http://stackoverflow.com/comment/41963689
has body: Reflection is almost never considered the answer to a problem. Its just hard to read because a lot of people don't know what it is and people that come behind you to modify your code cannot understand it easily. Its not "self-documenting" to use a term from the book Code Complete. Reflection is powerful, as you just found out doing it to implement a DAO. But you should just be weary of it. A term we use around my office is "code stink", which is code that might be there for specific purpose, but shouldn't be used everywhere unless absolutely needed. Make sure to documented properly so that people that do actually come behind you will know what the heck it is. I like to use it to write jUnit tests in Spring to compare two objects from two different databases using reflection. But that's a test and isn't actually in production code. Hope this helps and is kind of what you are looking for!
answers question: http://stackoverflow.com/q/26682356
upvote count: 5
has comment: http://stackoverflow.com/comment/41963822
type: Answer
has comment: http://stackoverflow.com/comment/41963634

http://stackoverflow.com/comment/42073882
comment on: http://stackoverflow.com/a/26743196
type: AnswerComment
has text: OK i added that to my Login.java and it came with a bunch of errors...did i add it to the wrong class or something? sorry i'm just confused i think to help me understand it better would it be easier to just use the AsyncTask even though i'm not familiar with it?
score: 0
type: Comment

http://stackoverflow.com/q/26786155
has answer: http://stackoverflow.com/a/28084272
tagged with: glassfish
has answer: http://stackoverflow.com/a/27367799
favorite count: 0
upvote count: 3
type: UnansweredQuestion
score: 3
has title: GlassFish 4.1 deploy is failing on eclipse Luna with JDK 8
has comment: http://stackoverflow.com/comment/42290993
tagged with: java
has body: Cannot deploy Glassfish.jsp on eclipse Luna, with JDK 8, glassfish 4.1. Exception Stack Trace: org.glassfish.tools.ide.admin.CommandException: Cannot initialize Runner class at org.glassfish.tools.ide.admin.AdminFactory.newRunner(AdminFactory.java:180) at org.glassfish.tools.ide.admin.AdminFactoryHttp.getRunner(AdminFactoryHttp.java:110) at org.glassfish.tools.ide.admin.ServerAdmin.exec(ServerAdmin.java:75) at oracle.eclipse.tools.glassfish.GlassfishServerBehaviourDelegate.publishDeployedDirectory(GlassfishServerBehaviourDelegate.java:608) at oracle.eclipse.tools.glassfish.GlassfishV4ServerBehavior.publishModuleForGlassFishV3(GlassfishV4ServerBehavior.java:96) at oracle.eclipse.tools.glassfish.GlassfishV4ServerBehavior.publishModule(GlassfishV4ServerBehavior.java:56) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1091) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1183) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:987) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3157) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Session Data: eclipse.buildId=4.4.1.M20140925-0400 java.version=1.8.0_25 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=es_MX Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
tagged with: eclipse
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/a/26810592
has body: Hashmaps aren't faster at retrieval of something at a known index. If you are storing things in a known order, the list will win. But say instead of your example of inserting everything into the list 1-4000, you did it in a total random order. Now to retrieve the correct item from a list, you have to check each item one by one looking for the right item. But to retrieve it from the hashmap, all you need to know is the key you would have given it when you inserted it. So really, you should be comparing Hashmap.get(i) to for(Integer i : integerList) if(i==value) //found it! Then you would see the real efficiency of the hashmap.
accepted answer of: http://stackoverflow.com/q/26809537
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42242492
answers question: http://stackoverflow.com/q/26809537
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/q/26770793
tagged with: swing
possible better answer: http://stackoverflow.com/a/26770891
tagged with: jbutton
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/26770902
accepted answer: http://stackoverflow.com/a/26770979
tagged with: java
has body: I am writing a Blackjack program using JFrame and trying to keep it as simple as possible. My JButton, jbHit works with a single click, however it overwrites the playersHand and playerSide slot with every click. I would like it to work with multiple clicks (3 clicks - since that is the max number of cards you can get after the first two are dealt) options It should count them so to speak so that the array index can record the card image. Here is my ActionListener code that I have so far. I am afraid I am stuck. Should I use some sort of for loop with an int i++? //Hit Button ActionListener jbHit.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if ( playerValue &lt; 21 ) { //Draw a card Card c = deck.drawCard(); playersHand.add(c); playerSide[2].setIcon( new ImageIcon( c.getFilename() ) ); } //If playerValue &gt; 21, bust else if ( playerValue &gt; 21 ) { //Toggle Buttons jbDeal.setEnabled(true); jbHit.setEnabled(false); jbStand.setEnabled(false); jbDoubleDown.setEnabled(false); message = "You bust."; } } });
score: 0
has title: give JButton multiple options for mouse clicks (Blackjack Game)
has comment: http://stackoverflow.com/comment/42121914
has comment: http://stackoverflow.com/comment/42122277
answer count: 3
has comment: http://stackoverflow.com/comment/42122162
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42122185
has answer: http://stackoverflow.com/a/26770891
tagged with: blackjack
has answer: http://stackoverflow.com/a/26770979

http://stackoverflow.com/comment/42209854
comment on: http://stackoverflow.com/a/26819260
has text: You already know how for/next loops work, and string concatenation using `+`. All you need in addition is String.length().
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42214706
comment on: http://stackoverflow.com/q/26822651
score: 0
has text: @SihanWang just do `tt.add(new ArrayList<>(t));` instead to make a copy and get what you want.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26701467
has comment: http://stackoverflow.com/comment/41999894
tagged with: android
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/41999941
has title: USB Device to Android Communication
tagged with: java
has comment: http://stackoverflow.com/comment/41998358
score: 0
has body: I am researching and trying to find more information how to get a USB Device to send commands to my phone. For example, I will have a device attached to my SAMSUNG GALAXY NOTE 3 - through the charging port. I will have some sort of device that we can call a "controller". This controller will have buttons on it. I want to know if anyone can point me in the right direction for what exactly it is that I need. Basically I need these buttons to be able to perform commands on my phone, for example - Open An App. Take A Picture, etc. I see a lot of threads about how one would use their phone to send data TO a device, but I need a device to send data to my phone. Is this possible? If so, can you maybe point me in the right direction towards useful resources? Thanks!

http://stackoverflow.com/comment/42201910
type: QuestionComment
has text: Don't you mean `long long` instead of `long` in C?
score: 1
comment on: http://stackoverflow.com/q/26815471
type: Comment

http://stackoverflow.com/comment/42183460
score: 1
has text: I ended up keeping the DefaultTableCellRenderer renderer = new FormatTableCellRenderer(); so that is possibly the cause of the issue I was having there.
comment on: http://stackoverflow.com/q/26761920
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26707363
favorite count: 0
type: UnansweredQuestion
has body: I have an Android Native Game which is running through JNI. When I wanted to quit the application, I am calling the Activity's Finish method. The activity is getting destroyed, but the native ( process or memory ) is not getting destroyed ( or cleared ). So when I launch the game again, the previous state of the game is restored directly with out any native loading. How can kill my native process as well, to free the resources.
has answer: http://stackoverflow.com/a/35862133
score: 3
has answer: http://stackoverflow.com/a/26708105
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/42007643
downvote count: 1
type: Question
upvote count: 4
has title: How to destroy Native process when Android Activity is destroyed
tagged with: native
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/26707666

http://stackoverflow.com/a/26764714
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26764684
answers question: http://stackoverflow.com/q/26764684
type: Answer
has body: Use IN. SELECT cod FROM services, services_has_tab2 WHERE services.id = services_has_tab2.services_id AND services_has_tab2.tab2_id IN ( "1", "2" );

http://stackoverflow.com/comment/42071625
score: 0
type: Comment
has text: One of the problem is you are using static method for recursion. In that you were doing n=n+2 you should not do that ...
comment on: http://stackoverflow.com/a/26742109
type: AnswerComment

http://stackoverflow.com/q/26773042
linked to: http://stackoverflow.com/q/19385065
tagged with: java
has answer: http://stackoverflow.com/a/26773159
possible better answer: http://stackoverflow.com/a/26773133
tagged with: int
has answer: http://stackoverflow.com/a/26773160
score: 0
has body: I am working on homework for my class. I have written a method to throw an error if an incorrect integer is entered and I am trying to give an error message when a string is entered instead of an int but I am not sure how. I am not allowed to use parsInt or built in string methods. I would be grateful for any help. int playerNum = stdin.nextInt(); while (invalidInteger(playerNum) == -1 || invalidInteger(playerNum) == -2 || invalidInteger(playerNum) == -3) { if(invalidInteger(playerNum) == -1) { System.out.println("Invalid guess. Must be a positive integer."); System.out.println("Type your guess, must be a 4-digit number consisting of distinct digits."); count++; } if(invalidInteger(playerNum) == -2) { System.out.println("Invalid guess. Must be a four digit integer."); System.out.println("Type your guess, must be a four digit number consisting of distinct digits."); count++; } if(invalidInteger(playerNum) == -3) { System.out.println("Invalid guess. Must have distinct digits."); System.out.println("Type your guess, must be a four digit number consisting of distinct digits."); count++; } playerNum = stdin.nextInt(); } Added this snippet to catch the exception. Thanks to almas shaikh. try { int playerNum = scanner.nextInt(); //futher code } catch (InputMismatchException nfe) { System.out.println("You have entered a non numeric field value"); }
tagged with: string
has comment: http://stackoverflow.com/comment/42125616
tagged with: exception
has title: Throw an error when a string is entered instead of an int
duplicate of: http://stackoverflow.com/q/19385065
answer count: 4
has answer: http://stackoverflow.com/a/26773133
has answer: http://stackoverflow.com/a/26773112
accepted answer: http://stackoverflow.com/a/26773112
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/42126290
type: Question

http://stackoverflow.com/comment/42234746
comment on: http://stackoverflow.com/q/26831893
type: Comment
type: QuestionComment
has text: [getting result set into DTO with native SQL Query in Hibernate](http://stackoverflow.com/a/3937519/2754530)
score: 1

http://stackoverflow.com/a/26697576
has body: The array you pass to displayRiver contains only zeroes, since you never change its default values. Therefore your switch statement always reaches the part the displays empty space : case 0: // Unknown System.out.print(" "); break; You should assign 1 or -1 to the relevant locations of the array based on the user input. It looks like the loop in the main method should be : while(!showShip) { val = promptForInt("\n" + "Guess again. "); if(val == randomShipLocation) // val, instead of userInput { System.out.println("\n" +" BOOM!"); showShip = true; riverLength[val] = 1; // mark a hit } else { riverLength[val] = -1; // mark a miss } displayRiver(riverLength, showShip); } This assumes your promptForInt method validates the input (to make sure it is within the range of the array).
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26697526
downvote count: 0

http://stackoverflow.com/a/26700183
type: Answer
has comment: http://stackoverflow.com/comment/41994272
upvote count: 1
has comment: http://stackoverflow.com/comment/41994523
has comment: http://stackoverflow.com/comment/41994279
answers question: http://stackoverflow.com/q/26699930
has comment: http://stackoverflow.com/comment/41994321
has comment: http://stackoverflow.com/comment/41994347
score: 1
accepted answer of: http://stackoverflow.com/q/26699930
has comment: http://stackoverflow.com/comment/41994393
has comment: http://stackoverflow.com/comment/41994233
has comment: http://stackoverflow.com/comment/41994184
has comment: http://stackoverflow.com/comment/41994670
type: AcceptedAnswer
downvote count: 0
has body: Your problem is the content of the while loop: while (breakSwitch = true) { if (nameField.getText().isEmpty()) { errorReportField.setText("name error"); break; } // stuff omitted if (e.getSource() == addVolumeButton) { // stuff omitted nameField.setText(""); // stuff omitted } if (e.getSource() == addNumberButton) { // stuff omitted nameField.setText(""); // stuff omitted } errorReportField.setText(""); } First of all: you've created a loop with an assignment instead of a boolean comparison. And now the problem: if e.getSource() is either addVolumeButton or addNumberButton, then you're removing the content of nameField. In the next iteration of your loop you're testing if nameField.getText().isEmpty(), which return true now. You'll now get the error and exit the loop there. How to fix the problem? I recommend to think about that loop, because I'm relatively sure, that it is unnecessary to loop there. A version of your actionPerformed method without the loop could look like this: @Override public void actionPerformed(ActionEvent e) { if (nameField.getText().isEmpty()) { errorReportField.setText("name error"); return; // error occured; exit the method early } try { price = Integer.parseInt(priceField.getText()); } catch (NumberFormatException exception) { errorReportField.setText("price error"); priceField.setText(""); return; // error occured; exit the method early } try { number = Integer.parseInt(numberField.getText()); } catch (NumberFormatException exception) { errorReportField.setText("number error"); numberField.setText(""); return; // error occured; exit the method early } if (e.getSource() == addVolumeButton) { // omitted } if (e.getSource() == addNumberButton) { // omitted } errorReportField.setText(""); } This version uses the code word return; to exit the current method if an error occured.
has comment: http://stackoverflow.com/comment/41994155

http://stackoverflow.com/a/26829200
upvote count: 1
type: Answer
has body: Since OSGi is multi-platform and needs to take care of appearing and disappearing bundles, the handling of native libraries (as rxtx does) needs to be explicitly specified for a bundle. That is done using a Bundle-NativeCode header in the bundle that includes the rxtx jar file. The native library to load can be indicated per os and architecture. In this case it may look like: Bundle-NativeCode: lib/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so; osname="Linux";processor="x86-64", lib/Windows/i368-mingw32/rxtxSerial.dll; osname="Windows" The above example indicates that for Linux x86-64 the library can be found in lib/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so and for Windows (all architectures) in lib/Windows/i368-mingw32/rxtxSerial.dll. Paths are relative in the bundle, therefore don't forget to include the shared libraries in your bundle. For further details, look in the OSGi core specification.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26739459

http://stackoverflow.com/q/26825957
answer count: 1
score: 0
has body: I am trying to read a svg file whose initial couple of lines are as follows: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt; &lt;svg viewBox="0 0 800 800" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg" version="1.1"&gt; &lt;g fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8481"&gt; .... &lt;/svg&gt; When I try to run this in MATLAB (R2014a), I get the following error: &gt;&gt; xInfo = xmlread('1.svg'); Error using xmlread (line 97) Java exception occurred: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) .... Since it looked like a connection issue, I changed the web settings of MATLAB and Java(via Java Control Panel) so that it would use the proxy of my workplace. But the error persists. Any idea how to solve this ?
tagged with: http://stackoverflow.com/tag/xml
tagged with: http://stackoverflow.com/tag/svg
has title: Error while reading svg file in MATLAB using xmlread
type: UnansweredQuestion
tagged with: matlab
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26829263
tagged with: xml-parsing

http://stackoverflow.com/comment/65681841
score: 0
type: Comment
has text: java.util.Date class overrides toString() method of Object class to print the date in following format: dow mon dd hh:mm:ss zzz yyyy The real reason of 'why?' is that his Date object is not of java.util.Date class but his own Date class.
type: AnswerComment
comment on: http://stackoverflow.com/a/26722425

http://stackoverflow.com/comment/42027190
type: AnswerComment
comment on: http://stackoverflow.com/a/26718576
type: Comment
has text: Yes, i use Eclipse, but i would understand the reason of do that in this case. Thanks for support.
score: 0

http://stackoverflow.com/q/26729554
type: AnsweredQuestion
has body: I run into one small problem. &lt;button onclick="foo('${some_string_param}')"&gt;&lt;/button&gt; It goes without any trouble when some_string_param doesn't contain apostrophe. But when it contains any apostrophe, it goes with Uncaught SyntaxError: Unexpected identifier error. What should I change in my foo invocation?
has title: How to pass string parameter into function in button onclick event
upvote count: 1
has answer: http://stackoverflow.com/a/26730121
type: Question
linked to: http://stackoverflow.com/q/23986135
score: 1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26729599
accepted answer: http://stackoverflow.com/a/26729599
downvote count: 0
tagged with: jsp
tagged with: javascript
possible better answer: http://stackoverflow.com/a/26730121
favorite count: 0

http://stackoverflow.com/comment/42022927
has text: I use JavaFX 2.0 which built-in in IntelliJ IDEA 139.222 build
comment on: http://stackoverflow.com/q/26715454
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26718381
has body: i'm guessing you just want a List, but since you're using raw jdbc calls, you still have to traverse the ResultSet. you would need to craft your query to just return the one column and then extract each single item row into your result List object. now if you were using JPA, you could fetch the result into a List by crafting your query to just return the one column and JPA would automatically unwrap it into a List (or List for other types like Date or Integer).
score: 0
answers question: http://stackoverflow.com/q/26718059
type: Answer

http://stackoverflow.com/comment/42054258
has text: i use facesconfig.xml.i dont use annotations here
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26721822

http://stackoverflow.com/q/26795976
has answer: http://stackoverflow.com/a/26796017
accepted answer: http://stackoverflow.com/a/26796017
type: Question
answer count: 2
tagged with: executable-jar
has body: We know that jar is a compressed archive file format which acts as a container for compiled java classes and conf files. As far as I know, for reading any contents from a compressed container file, first they need to be extracted somewhere. So how does the JVM execute classes inside the jar? Does it extract the contents of the jar to a temp location and then executes the classes?
has title: How does a jar file get executed? Do the classes get extracted somewhere?
possible better answer: http://stackoverflow.com/a/26797009
downvote count: 1
has comment: http://stackoverflow.com/comment/42166242
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/42166185
linked to: http://stackoverflow.com/q/13927217
upvote count: 22
type: AnsweredQuestion
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/26797009

http://stackoverflow.com/q/26707233
has comment: http://stackoverflow.com/comment/42007092
type: Question
has answer: http://stackoverflow.com/a/26711521
tagged with: java
tagged with: adventure
answer count: 1
has comment: http://stackoverflow.com/comment/42007185
has comment: http://stackoverflow.com/comment/42007136
favorite count: 0
downvote count: 3
linked to: http://stackoverflow.com/q/2710300
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/57686474
has body: Question: How can I fix my program to where it could continue after the third option? I'm making a short adventure game,and there seems to be some problems. I'm brand new to this so any advice is great. The main problem is when the player clicks "yes" ,or "no" at Go into the abandon house? 1.I don't see why not. 2.I rather stay outside,(user_name) snickers. After the player makes their choice the program ends. The program is supposed to continue into a fight after the player chooses,but nope! Here's my code: import java.util.Scanner; public class NewAdventureProject { public static void main(String[] args) throws java.io.IOException{ int MonsterHealth; int PlayerHealth ; int GhostHealth; char input='a';//The attack key for battles PlayerHealth=100;//Health of the player MonsterHealth=100;//Health of the Monster GhostHealth=120;//Health of the ghost Scanner user_input=new Scanner(System.in); String user_name; System.out.println("Enter Your name or prefered nick name:");//player name option user_name=user_input.next(); System.out.println(user_name+" you stepped into the light."); System.out.println("You see a house"); System.out.println("It looks abandon. Do you want to investigate it?"); System.out.println("1.Yes."); System.out.println("2.No."); Scanner scan = new Scanner(System.in);//Declares new scanner int a = scan.nextInt();//Helps me navigate around long if and while statements switch(a){ case 1://outcome one System.out.println("As you get closer to the abandon house, you " + "hear a random roar."); break; case 2://outcome two System.out.println("The clouds black out the sun.\nYour " + "face is sprinkled with water"+". It's raining now.\nY" + "ou shiver."); System.out.println("You hear a faint scream from the abandon " + "house. Do you want to investigate?"); break; } System.out.println("Go into the abandon house?"); System.out.println("1.I don't see why not."); System.out.println("2.I rather stay outside,"+user_name+" snickers."); Scanner sc = new Scanner(Syste…
has title: Can someone please help me with my adventure code?
tagged with: netbeans
upvote count: 0

http://stackoverflow.com/comment/42122959
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26763393
has text: No idea really. You need to do further investigation.
score: 0

http://stackoverflow.com/comment/42171670
comment on: http://stackoverflow.com/q/26795275
score: 0
type: QuestionComment
type: Comment
has text: What happens if you re-save the document in Excel and then try to open it in Numbers, or even create manually a new file with such formatting? Does it work then? This is to rule out it's a general problem with Numbers, and not some quirk with Apache POI.

http://stackoverflow.com/q/26762494
has answer: http://stackoverflow.com/a/26783160
type: AnsweredQuestion
tagged with: maven-antrun-plugin
downvote count: 0
has answer: http://stackoverflow.com/a/26764625
accepted answer: http://stackoverflow.com/a/26764625
score: 1
tagged with: java
type: Question
has title: Run specific standalone ant target from Maven
answer count: 2
upvote count: 1
favorite count: 0
has body: I've got the following plugin defined in my POM in an attempt to deploy the maven produced .war file either on our test or production tomcat server: org.apache.maven.plugins maven-antrun-plugin 1.7 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> <deploy path="/${project.name}" url="http://test-server:8080/manager/text" username="user" password="pass" war="file:${project.build.directory}/${project.build.finalName}.${project.packaging}" update="true"/> <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> <deploy path="/${project.name}" url="http://prod-server:8080/manager/text" username="user" password="pass" war="file:${project.build.directory}/${project.build.finalName}.${project.packaging}" update="true"/> org.apache.tomcat tomcat-catalina-ant 8.0.14 From reading the Maven AntRun Plugin usage it looks like I should be able to add a target name (as I've done), but I'm not sure how to invoke a specific target. The web-deploy target is the only target run even if I try to invoke only the test-deploy target with: mvn antrun:run -Dtarget=test-deploy How do I specify which ant target I'd like to run?
tagged with: maven
possible better answer: http://stackoverflow.com/a/26783160

http://stackoverflow.com/q/26799403
tagged with: selenium-webdriver
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42172923
tagged with: selenium
has comment: http://stackoverflow.com/comment/42176167
upvote count: 1
tagged with: google-chrome
type: Question
has comment: http://stackoverflow.com/comment/42176071
has body: Directly typing the below url in the browser, it works, http://username:p%40ssword@examplesite.com:80/yyyy But, when i use the same url, for selenium webdriver tests, it is connecting to http://examplesite.com/yyyy and asking for the HTTP authentication. Do i need to change any settings in the chrome browser, or tweak the default profile?
has comment: http://stackoverflow.com/comment/42173214
has comment: http://stackoverflow.com/comment/42175931
has comment: http://stackoverflow.com/comment/42174796
linked to: http://stackoverflow.com/q/19357634
tagged with: http-authentication
has answer: http://stackoverflow.com/a/42178238
has comment: http://stackoverflow.com/comment/42172884
linked to: http://stackoverflow.com/q/3021602
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42172807
favorite count: 0
has comment: http://stackoverflow.com/comment/42173079
has comment: http://stackoverflow.com/comment/42179169
has title: HTTP url authentication not working while using it through selenium webdriver - Chrome
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26676658

http://stackoverflow.com/q/26821773
has body: In an Android project, I am using the code below. I get the error: variable tts might not have been initialized. If I change the place where the variable tts is declared, I no longer get the error. If I comment out the two lines which reference tts in the inner OnInitListener class, I also no longer get the error (but nothing interesting happens either). So, I deduce that the inner class cannot "see" the tts variable if it is declared in the enclosing method (even when it is declared as final), but it can see it when it is declared as a instance variable of the enclosing class. I come from a JavaScript background; obviously Java treats variable scope in a different way in this context. I would be grateful if you could explain what Java is doing under the hood, so that I can make sense of these differences. package com.example.texttospeech; import android.speech.tts.TextToSpeech; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import java.util.HashMap; import java.util.Locale; public class MainActivity extends ActionBarActivity { //private TextToSpeech tts; // UNCOMMENT THIS... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); testTextToSpeech(); } private void testTextToSpeech() { final String toSpeak = getString(R.string.hello_world); final int mode = TextToSpeech.QUEUE_FLUSH; final HashMap hashMap = new HashMap&lt;String, String&gt;(); final TextToSpeech tts; // ... AND COMMENT THIS OUT... tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status != TextToSpeech.ERROR) { // ... OR SIMPLY COMMENT OUT THE NEXT TWO LINES tts.setLanguage(Locale.UK); tts.speak(toSpeak, mode, hashMap); } } }); } }
type: AnsweredQuestion
downvote count: 0
tagged with: inner-classes
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26821853
has answer: http://stackoverflow.com/a/26821853
type: Question
has answer: http://stackoverflow.com/a/26821932
accepted answer: http://stackoverflow.com/a/26821932
answer count: 3
upvote count: 1
favorite count: 0
tagged with: scope
tagged with: android
has title: Understanding scope in a Java inner class
has answer: http://stackoverflow.com/a/26821915

http://stackoverflow.com/a/26679688
has comment: http://stackoverflow.com/comment/42054914
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42055362
accepted answer of: http://stackoverflow.com/q/26677075
type: Answer
has comment: http://stackoverflow.com/comment/42037267
upvote count: 1
has body: I guess, something like this should do the trick - to be added in build.gradle of :serviceA &amp; :serviceB configurations { commonJars } dependencies { commonJars project( path: ':commonLibs' ) // might be needed to add 'configuration' as well } ospackage { from configurations.commonJars .. }
answers question: http://stackoverflow.com/q/26677075
score: 1
has comment: http://stackoverflow.com/comment/42035923
has comment: http://stackoverflow.com/comment/42013708

http://stackoverflow.com/comment/42088900
type: Comment
type: QuestionComment
has text: Append your ShowCarListAction.
comment on: http://stackoverflow.com/q/26737402
score: 0

http://stackoverflow.com/comment/71504054
score: 0
type: Comment
has text: how is this possible in STS 3.8.3 RELEASE? Can .groovy and .java co-exist in same spring boot application?
comment on: http://stackoverflow.com/a/36195202
type: AnswerComment

http://stackoverflow.com/q/26787509
type: Question
has title: open Instagram hashtag intent
tagged with: java
has answer: http://stackoverflow.com/a/32370354
has body: For opening an specific image in Instagram i use this intent: Uri uri = Uri.parse("http://instagram.com/p/IMAGE_ID"); Intent insta = new Intent(Intent.ACTION_VIEW, uri); if i want to see an specific hashtag all images what i have to do? Actually i want to open Instagram and see images of an hashtag
answer count: 1
score: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/32370354
type: AnsweredQuestion
upvote count: 2
tagged with: android-intent
downvote count: 1

http://stackoverflow.com/q/26731276
tagged with: eclipse
tagged with: api
type: UnansweredQuestion
type: Question
has title: How can I update the available Android APIs in Eclipse (ADT)
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/29273346
answer count: 1
has body: I am trying to update my API level choices within eclipse. Currently, the highest I can get to is API 19: - I am interested in starting with 5.0 and making that my target API, but I cannot seem to get it as an available option. I have tried updating eclipse via the help -> check for updates, but have seen nothing new. Currently, I am using the ADT via eclipse (See picture below) - I am sure it is something very simple that I am missing, but can someone tell me where I can find the update to this so that I can start working with things like the glass API, wearables, and Lollipop? Is there a section for updating that I have not seen? Thanks all!
tagged with: java
tagged with: adt

http://stackoverflow.com/comment/42176611
has text: great answer Thomas... since this array will be average size 200 it's not important... I just want very fast backend so that I can run millions (or even billions) of AI fights (AI vs AI) in reasonable amount of time, to try to get the game properly balanced between different strategies.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26801015
type: Comment

http://stackoverflow.com/comment/42206909
has text: The link you posted is about implementing your own linked list data structure, and your own reverse function. Not about using the standard Java LinkedList class, which uses nodes internally, but doesn't expose them.
comment on: http://stackoverflow.com/q/26818382
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26719896
has comment: http://stackoverflow.com/comment/96194706
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42033019
has comment: http://stackoverflow.com/comment/42031886
accepted answer of: http://stackoverflow.com/q/26719106
has comment: http://stackoverflow.com/comment/42031676
answers question: http://stackoverflow.com/q/26719106
has comment: http://stackoverflow.com/comment/42040388
has comment: http://stackoverflow.com/comment/42032511
has body: It's not exactly clear what you're asking. A category would have super-categories and sub-categories, and an article belongs to a categories, but an article doesn't have parent categories. If you look at the HTML rendering of a DBpedia resource, you can see that its categories are values of the dcterms:subject property. E.g., at dbpedia:Pizza, you can see dcterms:subject category:Flatbreads category:Greek_inventions category:Italian_cuisine category:Italian_inventions category:Mediterranean_cuisine category:Pizza category:World_cuisine So, you can use a query like this to retrieve those values: select ?category { dbpedia:Pizza dcterms:subject ?category } SPARQL results Now, if you have a category, e.g., category:Flatbreads, and you actually want the its supercategories, you can see that they're connected by the skos:broader property. So: select ?supercategory { category:Flatbreads skos:broader ?supercategory } SPARQL results
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42043610
has comment: http://stackoverflow.com/comment/42031624
has comment: http://stackoverflow.com/comment/42030884
type: Answer

http://stackoverflow.com/q/26711830
downvote count: 0
has answer: http://stackoverflow.com/a/26714674
has comment: http://stackoverflow.com/comment/42014929
tagged with: exception
has comment: http://stackoverflow.com/comment/42015107
has body: I've got this strange stack trace from Flurry Analytics and I have no idea where it comes from. All the classes are from android system and not a single line that tells me where it comes from. This error happened 3 times on a same device with android 4.4.4 Any ideas? Thanks. java.lang.RuntimeException android.app.ActivityThread.performResumeActivity(ActivityThread.java:2836) android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2865) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2291) android.app.ActivityThread.access$800(ActivityThread.java:144) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:212) android.app.ActivityThread.main(ActivityThread.java:5135) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:515) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) dalvik.system.NativeStart.main(Native Method) Caused by: android.app.ActivityThread.deliverResults(ActivityThread.java:3455) android.app.ActivityThread.performResumeActivity(ActivityThread.java:2823) android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2865) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2291) android.app.ActivityThread.access$800(ActivityThread.java:144) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:212) android.app.ActivityThread.main(ActivityThread.java:5135) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:515) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) dalvik.system.NativeStart.main(Native Method)
tagged with: android
has title: Strange runtime exception on Android 4.4.4
favorite count: 0
has comment: http://stackoverflow.com/comment/42015187
accepted answer: http://stackoverflow.com/a/26714674
has comment: http://stackoverflow.com/comment/42015097
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42032526
tagged with: java
has comment: http://stackoverflow.com/comment/42014881
type: Question
has comment: http://stackoverflow.com/comment/42015037
answer count: 1

http://stackoverflow.com/q/26811636
has comment: http://stackoverflow.com/comment/42195677
tagged with: string
has comment: http://stackoverflow.com/comment/42195680
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26811667
has body: if((type.toLowerCase()).equals("phone number")) { System.out.println("Enter phone number: "); kb.nextLine(); individual.setPhoneNumber(kb.nextLine()); } Basically if the user enters a phone number the first time, it is ignored. The user must then re-enter the information for the string and it will work the second time. For an identical piece of code in which an integer is enterred, however, it works on the first input.
tagged with: input
score: -2
has title: Why is the first user input ignored when entering string input?
tagged with: java
has comment: http://stackoverflow.com/comment/42195728
downvote count: 2
answer count: 1
linked to: http://stackoverflow.com/q/13102045
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42195672
has comment: http://stackoverflow.com/comment/42195684
upvote count: 0
has comment: http://stackoverflow.com/comment/42195797

http://stackoverflow.com/q/26819798
has answer: http://stackoverflow.com/a/26819892
has body: Multiple Clients say(A, B, C, D etc) make connection to one server through same socket. They all send messages to server as and when required. Client messages are sent only to server(and not to other clients). But whenever server sends a message it should be delivered to all the clients. Please help me out jam only able to get server message on only 1 client //MultithreadedServer.java package server; import java.io.*; import java.net.*; import java.util.ArrayList; import java.util.Vector; public class MultithreadedServer { Vector&lt;ClientHandler&gt; clients = new Vector&lt;ClientHandler&gt;(); Vector&lt;String&gt; users = new Vector&lt;String&gt;(); private static ServerSocket servSocket; private static final int PORT = 1247; public MultithreadedServer() throws IOException{ servSocket = new ServerSocket(PORT); while(true) { Socket client = servSocket.accept(); System.out.println("\nNew client accepted.\n"); ClientHandler handler; handler = new ClientHandler(client); clients.add(handler); } } public static void main(String[] args) throws IOException { MultithreadedServer ms = new MultithreadedServer(); } class ClientHandler extends Thread { private Socket client; private BufferedReader in; private PrintWriter out; String name,message,response; public ClientHandler(Socket socket) { //Set up reference to associated socket... client = socket; try { in = new BufferedReader( new InputStreamReader( client.getInputStream())); out = new PrintWriter( client.getOutputStream(),true); } catch(IOException e) { e.printStackTrace(); } start(); } public void sendMessage(String msg) { System.out.println("is it even coming here?"); out.println("Server:" + msg); } public void boradcast(String message) { // send message to all connected users for (ClientHandler c : clients) { c.out.println("Server: hello"); } } public String getUserName() { return name; } public void run() { try { String received; do { System.out.println("Enter Your Message: "); String msg = in.readLine(); out.println(…
type: UnansweredQuestion
has title: How do i send the message to multiple clients in java Client-Server Program
tagged with: netbeans
tagged with: java
score: 0
type: Question
tagged with: client-server
answer count: 1

http://stackoverflow.com/comment/42007241
comment on: http://stackoverflow.com/q/26707314
has text: In what way does it not work? What is the error (if any)?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42082305
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/26748928
has text: The lines under `horror` all begin with `drama.add(...` so I think it's just a typo there.
type: Comment

http://stackoverflow.com/comment/41980017
type: AnswerComment
comment on: http://stackoverflow.com/a/26692124
type: Comment
score: 0
has text: How do you know that's the OP's problem?

http://stackoverflow.com/a/26809966
answers question: http://stackoverflow.com/q/26792134
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42216597
upvote count: 2
score: 2
has body: Because it is impossible to do so without breaking the contract of Setor List. A Setmay not hold duplicates. What happens if you use the container as a List and try to add a duplicate?

http://stackoverflow.com/q/26687171
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42087096
score: 0
has body: I have xlsx document with one sheet. In cell 'A2' i have a reference to cell 'A1'. The following code writes data to cell 'A1'. When I open the document, cell 'A2' is not updated with value of cell 'A1' automatically. I am required to click on cell 'A2' and press enter, only then I see the new value. What can be done so when document is opened the value will be updated? FileInputStream inputStream = null; FileOutputStream outputStream = null; XSSFWorkbook book = null; String path = "c://temp//doc.xlsx"; inputStream = new FileInputStream(path); book = new XSSFWorkbook(inputStream); XSSFSheet sheet = book.getSheetAt(0); XSSFRow row = sheet.getRow(0); row.createCell(0).setCellValue("VALUE"); outputStream = new FileOutputStream(path); book.write(outputStream); outputStream.close();
favorite count: 0
type: UnansweredQuestion
tagged with: excel
tagged with: apache-poi
linked to: http://stackoverflow.com/q/5937373
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41972281
has title: Auto Refresh referenced cell written with POI

http://stackoverflow.com/comment/42006486
has text: So, `EMPTY` is static filed of `enum` class, it is allowed to access that static member using reference variable `Species`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26706743
type: AnswerComment

http://stackoverflow.com/a/46731362
type: Answer
has body: If you use @DiscriminatorColumn remember to put there too. Like this: @DiscriminatorColumn(name = "MyTableName", discriminatorType = DiscriminatorType.STRING, columnDefinition = "char") and into the attribute @Column(name="MyColumnName",nullable = true, insertable = true, updatable = true, length = 1, columnDefinition = "char") private String type;
answers question: http://stackoverflow.com/q/26774193
score: 0

http://stackoverflow.com/a/26715088
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26714143
score: 4
answers question: http://stackoverflow.com/q/26714143
has body: The Problem If you simply do: import javax.xml.bind.annotation.*; @XmlRootElement(name = "query") public class SimplePreconditionQuery extends PreconditionQuery { private String query; @XmlValue public String getQuery() { return query; } public void setQuery(String query) { this.query = query; } } You will get the following exception because SimplePreconditionQuery subclasses something other than java.lang.Object. Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions @XmlValue is not allowed on a class that derives another class. this problem is related to the following location: at public java.lang.String forum26714143.SimplePreconditionQuery.getQuery() at forum26714143.SimplePreconditionQuery at @javax.xml.bind.annotation.XmlSeeAlso(value=[class forum26714143.SimplePreconditionQuery, class forum26714143.CompoundAndPreconditionQuery, class forum26714143.CompoundOrPreconditionQuery]) at public forum26714143.PreconditionQuery forum26714143.Precondition.getQuery() at forum26714143.Precondition Removing PreconditionQuery from the inheritance hierarchy. We can use the @XmlTransient annotation at the class level to remove the class from JAXB. All the properties from the super class will be treated as properties of the super class. import javax.xml.bind.annotation.*; @XmlSeeAlso({SimplePreconditionQuery.class, CompoundAndPreconditionQuery.class, CompoundOrPreconditionQuery.class}) @XmlTransient public abstract class PreconditionQuery { // JAXB does not deal with interfaces by default &gt;:( } Now we get the following exception: Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions Invalid @XmlElementRef : Type "class forum26714143.PreconditionQuery" or any of its subclasses are not known to this context. this problem is related to the following location: at public forum26714143.PreconditionQuery forum26714143.Precond…
upvote count: 4
has comment: http://stackoverflow.com/comment/42021771
type: AcceptedAnswer

http://stackoverflow.com/a/26708575
has body: You get a stackoverflow error because your recursion goes on executing the method many times until the stack overflows. What happens is that,after calling the method from main,the method calls spl_case in the 4th iteration and it executes the 2nd exec_script and then,in the 4th iteration,it calls spl_case and the process continues until the stack overflows. The following program does what you want: public class mytest1 { String path, keyword; //you have unused variables public static void main(String args[]){ exec_script("normal"); } public static void exec_script(String exec_path){ for (int i=0; i&lt;10; i++) { if (i==4) { exec_path = "spl"; } switch (exec_path){ case "spl": spl_case(); System.out.println("call action key word now"); exec_path = "normal"; break; case "normal": System.out.println("normal print"); break; } } } public static void spl_case(){ System.out.println("inside function splcase now"); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26708463

http://stackoverflow.com/comment/42315539
type: AnswerComment
comment on: http://stackoverflow.com/a/26838344
type: Comment
has text: Then simply use `DistributedCache` and load meta in a `Map` object(or any suitable data structure) inside `setup` of the `Mapper`. You won't need a `Reducer` anymore !
score: 1

http://stackoverflow.com/comment/80597030
score: 0
type: Comment
type: QuestionComment
has text: @clay Take a look at https://github.com/Devskiller/hbm2ddl-maven-plugin
comment on: http://stackoverflow.com/q/26788463

http://stackoverflow.com/q/26734907
tagged with: epub
answer count: 2
has comment: http://stackoverflow.com/comment/42182240
has answer: http://stackoverflow.com/a/42526986
has answer: http://stackoverflow.com/a/47892008
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has body: I would like to convert an EPUB document into a PDF using Java. I found a lot of questions about converting PDF to EPUB but nothing the other way around. Is there a Java library or a command-line tool that I could call through Java that would do the magic? Thx in advance! -Gesh
has title: Converting EPUB to PDF with Java
has comment: http://stackoverflow.com/comment/42056380
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42067224
upvote count: 3
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42130104
has comment: http://stackoverflow.com/comment/42056504

http://stackoverflow.com/comment/41950753
type: QuestionComment
has text: yes "c" is 14 and it holds the number that we want in the end. It is the counter.. "how many numbers are divisible by the given three numbers"
comment on: http://stackoverflow.com/q/26675725
score: 0
type: Comment

http://stackoverflow.com/comment/41992693
comment on: http://stackoverflow.com/a/26699079
has text: It works in my simple project I created to test it. But I don't run it in Tomcat. Btw, I just looked at your updated question. If you are running in Tomcat don't define the static application context like that in your configuration class. The application context will be created automatically. How are you bootstrapping your spring application and registering your config classes? web.xml or using Java config (web application initializer)? Please share that code if possible. It might help.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26810188
type: AnsweredQuestion
tagged with: enums
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/42692090
has answer: http://stackoverflow.com/a/42054523
type: Question
tagged with: c#
has body: This is my proto file : message MSG { required MsgCodes MsgCode = 1; optional int64 Serial = 2; // Unique ID number for this person. required int32 From = 3; required int32 To = 4; //bla bla... enum MsgCodes { MSG = 1; FILE = 2; APPROVE=4; ACK=8; ERROR_SENDING=16; WORLD=32; } } In my C# I'm trying to : msg = msg.ToBuilder().SetMsgCode(msg.MsgCode | MSG.Types.MsgCodes.ACK | MSG.Types.MsgCodes.APPROVE).Build(); SendToJava(msg); But the JAVA tells me : missing MsgCode ( which is a required) Removing the combination - does solve it But I need to specify combinations Question How can I solve it ? nb : The weird thing is that if I create a msg and set multiple enums , and then reads it in C# again - it does work...:-(
has title: Protocol buffers and enums combinations?
upvote count: 13
has answer: http://stackoverflow.com/a/26810740
tagged with: protobuf-csharp-port
has answer: http://stackoverflow.com/a/42692090
favorite count: 0
has answer: http://stackoverflow.com/a/32082350
tagged with: protocol-buffers
answer count: 5
has answer: http://stackoverflow.com/a/26822782
accepted answer: http://stackoverflow.com/a/26822782
score: 13

http://stackoverflow.com/comment/42218608
has text: the code you have written needs some edit , that was what i meant
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26824547

http://stackoverflow.com/a/26682362
upvote count: 2
has comment: http://stackoverflow.com/comment/41963802
type: Answer
answers question: http://stackoverflow.com/q/26682300
has comment: http://stackoverflow.com/comment/41963772
score: 2
has body: A bit of code such as (x + a) by itself is invalid. You must assign the value too a variable, such as int n = (x + a). Also, you must have a semicolon ; after your break statement. Lastly, there is no print statement in Java. What you are looking for is this: System.out.println(x); Hope that helped, good luck!
downvote count: 0

http://stackoverflow.com/q/26796986
has comment: http://stackoverflow.com/comment/42168078
tagged with: regex
accepted answer: http://stackoverflow.com/a/26797018
has comment: http://stackoverflow.com/comment/42168116
upvote count: 2
has comment: http://stackoverflow.com/comment/42167984
has comment: http://stackoverflow.com/comment/42168997
has comment: http://stackoverflow.com/comment/42168902
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42168865
has comment: http://stackoverflow.com/comment/42168155
tagged with: java
has comment: http://stackoverflow.com/comment/42167936
has comment: http://stackoverflow.com/comment/42169417
has comment: http://stackoverflow.com/comment/42168917
type: Question
has title: how to convert the String "http:\/\/www.178.com" to "http://www.178.com" in Java
downvote count: 4
has answer: http://stackoverflow.com/a/26797018
has comment: http://stackoverflow.com/comment/42167953
score: -2
has body: I want to get some URL from a web page. The getted the URL like this: http:\/\/xiaoshuo.360.cn\/novel.html Then I want to connect these urls. The exception will show,since the no valid url. My question is: how to convert http:\/\/xiaoshuo.360.cn\/novel.html to http://xiaoshuo.360.cn/novel.html I try use the s.replace("\\", ""); and replaceAll("\\", ""); It doesn't work. Add the sourcecode: public class GetUrls { public static void main(String[] args) throws Exception { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); String Url = "http://hao.360.cn/"; list = getUrls(list, Url); if (list.size() &lt; 6000) { for (int i = 0; i &lt; list.size(); i++) { getUrls(list, list.get(i)); } } } public static List&lt;String&gt; getUrls(List&lt;String&gt; list, String Url) throws Exception { URL url = new URL(Url); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); BufferedReader br = new BufferedReader(new InputStreamReader( conn.getInputStream())); String str; while ((str = br.readLine()) != null) { if (str.contains("http")) { String[] strs = str.split("\""); for (String s : strs) { if (s.startsWith("http") &amp;&amp; (s.endsWith("com") | s.endsWith("cn") | s .endsWith("html"))) { s.replaceAll("\\\\", ""); System.out.println(s); list.add(s.toString()); if (list.size() &gt;= 6000) { break; } } } if (list.size() &gt;= 6000) { break; } } } return list; } }
answer count: 1
has comment: http://stackoverflow.com/comment/42168388
favorite count: 0
has comment: http://stackoverflow.com/comment/42168165
has comment: http://stackoverflow.com/comment/42168047
has comment: http://stackoverflow.com/comment/42169647

http://stackoverflow.com/comment/42044951
type: Comment
comment on: http://stackoverflow.com/q/26726720
has text: Wouldn't it be simpler to just change the attribute of the pojo?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42286661
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26832131
has text: Ok so far I now know that changing the input device isnt the problem. The problem is that I only can get the input of the primary input device.

maven
tags question: http://stackoverflow.com/q/26673437
tags question: http://stackoverflow.com/q/26807683
tags question: http://stackoverflow.com/q/26829424
tags question: http://stackoverflow.com/q/26675368
tags question: http://stackoverflow.com/q/26707123
tags question: http://stackoverflow.com/q/26783708
tags question: http://stackoverflow.com/q/26801268
tags question: http://stackoverflow.com/q/26740023
type: Tag
tags question: http://stackoverflow.com/q/26729885
tags question: http://stackoverflow.com/q/26757506
tags question: http://stackoverflow.com/q/26689881
tags question: http://stackoverflow.com/q/26789225
tags question: http://stackoverflow.com/q/26674166
tags question: http://stackoverflow.com/q/26786013
tags question: http://stackoverflow.com/q/26831148
tags question: http://stackoverflow.com/q/26792533
tags question: http://stackoverflow.com/q/26812463
tags question: http://stackoverflow.com/q/26809308
tags question: http://stackoverflow.com/q/26819626
tags question: http://stackoverflow.com/q/26707831
tags question: http://stackoverflow.com/q/26699644
tags question: http://stackoverflow.com/q/26692112
tags question: http://stackoverflow.com/q/26736876
tags question: http://stackoverflow.com/q/26831798
tags question: http://stackoverflow.com/q/26741498
tags question: http://stackoverflow.com/q/26774480
tags question: http://stackoverflow.com/q/26802620
tags question: http://stackoverflow.com/q/26782887
tags question: http://stackoverflow.com/q/26698239
tags question: http://stackoverflow.com/q/26791647
tags question: http://stackoverflow.com/q/26822561
tags question: http://stackoverflow.com/q/26798171
tags question: http://stackoverflow.com/q/26776303
tags question: http://stackoverflow.com/q/26672990
tags question: http://stackoverflow.com/q/26709325
tags question: http://stackoverflow.com/q/26733946
tags question: http://stackoverflow.com/q/26736988
tags question: http://stackoverflow.com/q/26729048
tags question: http://stackoverflow.com/q/26776645
tags question: http://stackoverflow.com/q/26737447
tags question: http://stackoverflow.com/q/26718746
tags question: http://stackoverflow.com/q/26777122
tags question: http://stackoverflow.com/q/26730838
tags question: http://stackoverflow.com/q/26699470
tags question: http://stackoverflow.com/q/26692277
tags question: http://stackoverflow.com/q/26732452
tags question: http://stackoverflow.com/q/26748646
tags question: http://stackoverflow.com/q/26682588
tags question: http://stackoverflow.com/q/26755706
tags question: http://stackoverflow.com/q/26719731
tags question: http://stackoverflow.com/q/26805115
tags question: http://stackoverflow.com/q/26696653
tags question: http://stackoverflow.com/q/26817636
tags question: http://stackoverflow.com/q/26774325
tags question: http://stackoverflow.com/q/26814443
tags question: http://stackoverflow.com/q/26716110
tags question: http://stackoverflow.com/q/26783215
tags question: http://stackoverflow.com/q/26693126
tags question: http://stackoverflow.com/q/26690910
tags question: http://stackoverflow.com/q/26800404
tags question: http://stackoverflow.com/q/26679415
tags question: http://stackoverflow.com/q/26822907
tags question: http://stackoverflow.com/q/26809271
tags question: http://stackoverflow.com/q/26823338
tags question: http://stackoverflow.com/q/26823594
tags question: http://stackoverflow.com/q/26674806
tags question: http://stackoverflow.com/q/26694307
tags question: http://stackoverflow.com/q/26724001
tags question: http://stackoverflow.com/q/26687588
tags question: http://stackoverflow.com/q/26795688
tags question: http://stackoverflow.com/q/26732641
tags question: http://stackoverflow.com/q/26714607
tags question: http://stackoverflow.com/q/26788818
tags question: http://stackoverflow.com/q/26677912
tags question: http://stackoverflow.com/q/26777706
tags question: http://stackoverflow.com/q/26694109
tags question: http://stackoverflow.com/q/26766323
tags question: http://stackoverflow.com/q/26756430
tags question: http://stackoverflow.com/q/26721079

http://stackoverflow.com/comment/42009845
score: 1
comment on: http://stackoverflow.com/q/26708903
has text: Exactly like any other map?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26696126
score: 0
has comment: http://stackoverflow.com/comment/42010516
has body: I am using LWJGL and SlickUtil to make a game, and I made my own GLButton class that you can click. It works fine, but I want to add action listener implementation so I don't have to make a new class for each button that has a different action when it gets clicked. I want it so I can do GLButton.addActionListener((ActionEvent e) -&gt; { //do method here }); Here is the code of the class public class GLButton { private boolean alive = false; private float x1; private float y1; private float x2; private float y2; private String text; private final Texture tex; private final Texture texOver; private final Texture texPressed; private Texture currentTexture; private boolean pressed=false; public GLButton(float x, float y, float width, float height, String text) { this.x1=x; this.y1=y; this.x2=width; this.y2=height; this.text=text; tex=loadTexture("btn"); texOver=loadTexture("btnOver"); texPressed=loadTexture("btnPressed"); currentTexture = tex; alive=true; } public void draw() { if(!alive) return; pollInput(); currentTexture.bind(); glColor3f(1,1,1); glBegin(GL_QUADS); glTexCoord2f(0,0);glVertex2f(x1,y1); glTexCoord2f(0,1);glVertex2f(x1,y1+y2); glTexCoord2f(1,1);glVertex2f(x1+x2,y1+y2); glTexCoord2f(1,0);glVertex2f(x1+x2,y1); glEnd(); } public void setText(String text) { this.text=text; } public void setLocation(float x, float y) { this.x1=x; this.y1=y; } public void setSize(float width, float height) { this.x2=width; this.y2=height; } private Texture loadTexture(String key) { try { return TextureLoader.getTexture("PNG", new FileInputStream( Start.main_dir+"\\res\\textures\\"+key+".png")); } catch (IOException ex) { Logger.getLogger(GLButton.class.getName()).log(Level.SEVERE, null, ex); } return null; } private void pollInput() { if(GameWindow.grabbed==true) return; int mouseY = Math.abs(Mouse.getY()-Display.getHeight()); currentTexture = tex; if(Mouse.getX()&gt;=(int)x1 &amp;&amp; Mouse.getX()&lt;=(int)x1+(int)x2 &amp;&amp; mouseY &gt;= (int)y1 &amp;&amp; mouseY &lt;= (…
has title: How to make an actionlistener to a custom class?
answer count: 0
type: UnansweredQuestion
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/41994277

http://stackoverflow.com/q/26735902
has answer: http://stackoverflow.com/a/26736031
tagged with: arrays
has comment: http://stackoverflow.com/comment/42058155
answer count: 5
has answer: http://stackoverflow.com/a/26736021
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26736027
tagged with: java
has title: Initialize double array java with enum value
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/26736025
score: 0
has body: I have a little problem, I hope you can help me: I have the class in java called TOKEN and it has this inside: public enum TOKEN { EMPTY, WHITE, BLACK } In other class (same package) i'm trying to create a matrix of arrays with columns and rows, and i'm trying to initialize it with the value "EMPTY" from the other class "TOKEN": public class Board { private int row; private int column; private TOKEN[][] board; public Board(int nr, int nc){ this.row = nr; this.column = nc; for(int a=0; a &lt; row; a++) { for(int b=0; b &lt; column; b++) board[a][b] = TOKEN.EMPTY; } } NR, and NC are ints and have values (for example 6,7) but when i try to run the code, it stops here (first iteration) board[a][b] = TOKEN.EMPTY; Someone can help me please? Thank you!
has answer: http://stackoverflow.com/a/26736041

http://stackoverflow.com/comment/94536482
score: 2
has text: This is not an answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/26765811
type: Comment

http://stackoverflow.com/q/26685807
type: Question
has answer: http://stackoverflow.com/a/26685843
has title: Having a little trouble with compareto and clone method
type: AnsweredQuestion
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26685843
has body: I am having a little trouble implementing the compareto and clone method in my program, where i get an error that says: "Car is not abstract and does not override abstract method compareTo(java.lang.Object) in java.lang.Comparable". Any help is appreciated:) This is what i have so far: import java.util.*; public class Car implements Comparable, Cloneable { private String model; private String color; private int year; private int vin_number; private double price; public Car(){} public Car(String model, String color, int year, int vin_number, double price) { this.model = model; this.color = color; this.year = year; this.vin_number = vin_number; this.price = price; } public Object clone() { // shallow copy try { return super.clone(); } catch (CloneNotSupportedException e) { return null; } } public String getModel(){return model;} public String getColor(){return color;} public int getYear(){return year;} public int getVinNumber(){return vin_number;} public double getPrice(){return price;} public void setModel(String newModel){model = newModel;} public void setColor(String newColor){color = newColor;} public void setYear(int newYear){year = newYear;} public void setVinNumber(int newVinNumber){vin_number = newVinNumber;} public void setPrice(double newPrice){price = newPrice;} public String toString() { return "Model: " + model + " Color: " + color + " Year: " + year + " Vin Number: " + vin_number + " Price: " + price; } public int compareTo(Car o) { if(this.getModel().compareTo(car.getModel())) //gives 1 return 1; if(car.getModel().compareTo(this.getModel())) //gives -1 return -1; else { return 0; } } public static void main(String [] args) { } }
has comment: http://stackoverflow.com/comment/41969682

http://stackoverflow.com/comment/42183946
comment on: http://stackoverflow.com/q/26805261
score: 0
type: Comment
type: QuestionComment
has text: That shouldn’t be a problem, the app won't connect but that’s an user error.

http://stackoverflow.com/comment/42130561
comment on: http://stackoverflow.com/a/26775138
type: Comment
has text: There is panel available in template
type: AnswerComment
score: 0

android-asynctask
tags question: http://stackoverflow.com/q/26762212
type: Tag
tags question: http://stackoverflow.com/q/26804040
tag name: android-asynctask
tags question: http://stackoverflow.com/q/26695006
tags question: http://stackoverflow.com/q/26779273
tags question: http://stackoverflow.com/q/26708801
tags question: http://stackoverflow.com/q/26798003
tags question: http://stackoverflow.com/q/26810542
tags question: http://stackoverflow.com/q/26822697
tags question: http://stackoverflow.com/q/26813023

http://stackoverflow.com/comment/42080934
type: Comment
type: QuestionComment
has text: You can download the 4th edition of this book [here](http://www.saeedsh.com/resources/Thinking%20in%20Java%204th%20Ed.pdf), and this example is on page 486 (page 508 of the PDF). I've also looked at the 3rd edition, and this example is the same in that one as well.
score: 0
comment on: http://stackoverflow.com/q/26747867

http://stackoverflow.com/a/26690178
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/26690163
has comment: http://stackoverflow.com/comment/41977155
downvote count: 0
has body: Basically I need to find a way to construct a class from the Type, then create an instance of it. A Type is a class (or a struct, etc). Once you've got an appropriate Type, there are various options for instantiating it... for example, Activator.CreateInstance(), or call Type.GetConstructors(), find the right constructor and then invoke it. All of these approaches return object, so you'll need to cast: Packet packet = (Packet) Activator.CreateInstance(type);
type: Answer
has comment: http://stackoverflow.com/comment/41977207

http://stackoverflow.com/a/26724780
has comment: http://stackoverflow.com/comment/42039543
has comment: http://stackoverflow.com/comment/42039342
has comment: http://stackoverflow.com/comment/42039423
has body: Change this: String input = console.nextLine(); To: String input = console.next(); next() should take String types. According to http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html: public String next(Pattern pattern) Returns the next token if it matches the specified pattern. This method may block while waiting for input to scan, even if a previous invocation of hasNext(Pattern) returned true. If the match is successful, the scanner advances past the input that matched the pattern. Parameters: pattern - the pattern to scan for Returns: the next token Throws: NoSuchElementException - if no more tokens are available IllegalStateException - if this scanner is closed
type: Answer
has comment: http://stackoverflow.com/comment/42065568
has comment: http://stackoverflow.com/comment/42039639
score: 0
has comment: http://stackoverflow.com/comment/42039509
answers question: http://stackoverflow.com/q/26724764

http://stackoverflow.com/comment/42192816
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26790462
type: Comment
has text: @JavaNoob put the full code on paste bin or something g so I can access it and have a better look.

http://stackoverflow.com/a/26770929
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26770846
accepted answer of: http://stackoverflow.com/q/26770846
upvote count: 1
has body: This Algorithm Prints Maximum in a array First Argument (A) is the array, Second Argument (n) is the index of item that now checks for max and third Argument (x) is maximum in that time. in worst case you have a sorted array and in every check (if A[n] &lt; x then) you have to update third Argument with max that means at most you have to check all of array. the algorithm take a max from index n to n-1 and check that with max from n to n-2 and check that with max in n to n-3 index and it continues to check with n to 1 to get max item. that means it is O(n+(n-1)+(n-2)+...+2+1) = O(n^2) Sorry about Pic Quality :)
has comment: http://stackoverflow.com/comment/42122642

http://stackoverflow.com/comment/42106037
type: Comment
comment on: http://stackoverflow.com/a/26762047
score: 0
type: AnswerComment
has text: @Sikor: interesting. maybe make the association to the joined thing lazy?

http://stackoverflow.com/q/26690817
has body: We are trying to use Sonar for Code Analyzes locally our plan is to host the project on travis in the future and make Sonar run there with gradle our problem is that Sonar is always trying to connect to a server what we have now in our build file is: apply plugin: 'java' apply plugin: 'application' apply plugin: 'jacoco' apply plugin: 'sonar' /* other tasks*/ sonar { project { name = "Late-Term-Assignment" language = "java" version = "1.0" // whatever version you want here. withProjectProperties { props -&gt; props["sonar.jacoco.reportPath"] = "${buildDir}/reports/jacoco/jacoco.exec"} } } the error that we get is: * What went wrong: Executin failed for task ':sonarAnalyze'. &gt; java.net.ConnectionException: Connection refused: connect Is there any way to get Sonar to run on code that is stored locally? best wishes and thank you in advance!
upvote count: 1
tagged with: build
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72176972
possible better answer: http://stackoverflow.com/a/47703435
has comment: http://stackoverflow.com/comment/41988411
has title: Sonar with Gradle Locally
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26691194
accepted answer: http://stackoverflow.com/a/26691194
tagged with: sonarqube
tagged with: gradle
type: Question
tagged with: local
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/47703435
answer count: 3

http://stackoverflow.com/comment/42028570
score: 0
type: Comment
type: QuestionComment
has text: Yes, thank you. I forgot that I can pass list to the constructor of the ArrayList
comment on: http://stackoverflow.com/q/26719154

http://stackoverflow.com/comment/42043910
type: QuestionComment
comment on: http://stackoverflow.com/q/26727736
has text: I recommend having a good look at the javadoc for the `Color` class.
score: 0
type: Comment

http://stackoverflow.com/comment/42080304
comment on: http://stackoverflow.com/a/26747485
has text: thanks for ur comprehensive answer ...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26786563
accepted answer of: http://stackoverflow.com/q/26784038
type: Answer
score: 1
upvote count: 1
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26784038
has body: You can use InputStream @POST public String MyPost(InputStream is) throws IOException { BufferedImage image = ImageIO.read(is); JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(image))); System.out.println("Service invoked"); return "Hello, I am a POST response"; } Aside, in your client code, you haven't actually written anything to the output stream. It should be something more more like FileInputStream is = new FileInputStream(image); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); byte[] fileInBytes = buffer.toByteArray(); Response response = target.request().post(Entity.entity(fileInBytes, MediaType.APPLICATION_OCTET_STREAM)); UPDATE You can actually use a byte array. You just need to use the primitive byte[] @POST public String MyPost(byte[] bytes) throws IOException { JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(bytes))); System.out.println("Service invoked"); return "Hello, I am a POST response"; } It also even possible to use File @POST public String MyPost(File file) throws IOException { BufferedImage image = ImageIO.read(file); JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(image))); System.out.println("Service invoked"); return "Hello, I am a POST response"; } JAX-RS creates a temporary file for input on disk. It reads from the network buffer and saves the bytes read into this temporary file. They all work. Pick your poison

jquery
tags question: http://stackoverflow.com/q/26756458
tags question: http://stackoverflow.com/q/26817059
tags question: http://stackoverflow.com/q/26798858
tags question: http://stackoverflow.com/q/26796396
tags question: http://stackoverflow.com/q/26757554
type: Tag
tags question: http://stackoverflow.com/q/26778292
tags question: http://stackoverflow.com/q/26780358
tags question: http://stackoverflow.com/q/26800164
tags question: http://stackoverflow.com/q/26772715
tags question: http://stackoverflow.com/q/26745644
tags question: http://stackoverflow.com/q/26707222
tags question: http://stackoverflow.com/q/26799064
tags question: http://stackoverflow.com/q/26716327
tags question: http://stackoverflow.com/q/26768947
tags question: http://stackoverflow.com/q/26769381
tags question: http://stackoverflow.com/q/26734458
tags question: http://stackoverflow.com/q/26794520
tags question: http://stackoverflow.com/q/26803620
tags question: http://stackoverflow.com/q/26722090
tags question: http://stackoverflow.com/q/26675415
tag name: jquery
tags question: http://stackoverflow.com/q/26740489
tags question: http://stackoverflow.com/q/26734266
tags question: http://stackoverflow.com/q/26770791
tags question: http://stackoverflow.com/q/26761157
tags question: http://stackoverflow.com/q/26698454
tags question: http://stackoverflow.com/q/26732509
tags question: http://stackoverflow.com/q/26794699
tags question: http://stackoverflow.com/q/26715821
tags question: http://stackoverflow.com/q/26796580

http://stackoverflow.com/a/26794280
accepted answer of: http://stackoverflow.com/q/26794181
has comment: http://stackoverflow.com/comment/42163323
score: 0
type: AcceptedAnswer
has body: in your JFrame class, when you add you buttons LightsOutButton b = new LightsButton(..); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //you have acces to JFrame methods .. });
answers question: http://stackoverflow.com/q/26794181
type: Answer

http://stackoverflow.com/comment/41995968
has text: You have not shown us the dump of the array data going into your *encryption*, to demonstrate that it matches the array data coming out of *decryption*. Clearly, unless that data matches you can't expect to get valid character data.
comment on: http://stackoverflow.com/q/26699317
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41951606
has text: Like [that](http://stackoverflow.com/questions/2784514/sort-arraylist-of-custom-objects-by-property)?
score: 1
comment on: http://stackoverflow.com/q/26676210
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42125120
has text: It is just checking if `amount` variable matches a signed decimal number.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26772788

http://stackoverflow.com/comment/42155884
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26768272
has text: I've already written clients in Python and C# that handle such cookies just fine. Anyway, it turned out that the underlying HTTP library (it looks like Android uses apache httpclient internally) was buggy, the version 4.0 used String.split("=") to separate name and value fields, and it only checked for the first two elements of the returned array. I've managed to get a newer version of the Apache library (4.3) which solves this bug and handles cookies without a problem.
type: Comment

http://stackoverflow.com/comment/42151305
type: QuestionComment
has text: Please read [the intro tour](http://stackoverflow.com/tour).
type: Comment
comment on: http://stackoverflow.com/q/26787382
score: 0

http://stackoverflow.com/a/26724004
score: 20
accepted answer of: http://stackoverflow.com/q/26723526
upvote count: 20
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42037742
type: Answer
answers question: http://stackoverflow.com/q/26723526
has body: As you said, the CLASSPATH you need depends on version, location, and type of installation. How to install it is a separate discussion, but assuming you have a proper hadoop setup installed, it's easy (though I admit, I have no clue where it is documented). Hadoop provides a convenient utility to get the CLASSPATH information you need. Run this bin/hadoop classpath This should give you the information you need set your classpath for compiling your code.
has comment: http://stackoverflow.com/comment/67370300

http://stackoverflow.com/comment/41954407
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26676549
has text: It worked after I added the PropertyPlaceholderConfigurer. @GaryRussell - You are right about the overhead. I will create the template in Java
score: 0

http://stackoverflow.com/comment/41982237
score: 0
has text: `System.out.println(str1.intern()==str2.intern());` should not return true... The text is different.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26693369

http://stackoverflow.com/a/26762204
score: -1
has comment: http://stackoverflow.com/comment/42107455
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42106035
has comment: http://stackoverflow.com/comment/42105935
type: Answer
has comment: http://stackoverflow.com/comment/42106058
has body: since the continue is at the end of the inner loop, simply using break should start the next iteration of the main loop.
answers question: http://stackoverflow.com/q/26762148
has comment: http://stackoverflow.com/comment/42105841

http://stackoverflow.com/q/26771250
has comment: http://stackoverflow.com/comment/42122635
score: 0
has body: I am working on my own personal app for minecraft. I would forget what recipe I need, and I would just search, and have it display the recipe. Now, I have the list and search function with it being alphabetical. Now I am manually adding images, and everything else I need. BUT I think it would be more efficient if I had a array string like this String test1[] = { "diamond", "Iron", "Leather" }; String test2[] = { "Leggings", "Boots", "Helmet", "Chestplate" } and in my list view I want the end result to be like this. Diamond leggings Diamond boots Diamond Helmet Diamond Chestplate Iron Leggings ... ... Gold Leggings ... ... ... What would I need to do to achieve that? I think it would be ineffecient if I did it like this test3.add("Diamond Chestplate") test3.add("Diamond boots") etc.. .. ... and end up having big list instead where I can combine them.
has answer: http://stackoverflow.com/a/26771939
tagged with: android
has answer: http://stackoverflow.com/a/26771297
answer count: 4
type: AnsweredQuestion
has title: combine two array string to make a list
tagged with: java
has answer: http://stackoverflow.com/a/26771609
has answer: http://stackoverflow.com/a/26771425
accepted answer: http://stackoverflow.com/a/26771297
type: Question
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26771425

tomcat8
tags question: http://stackoverflow.com/q/26791454
type: Tag
tag name: tomcat8
tags question: http://stackoverflow.com/q/26681930
tags question: http://stackoverflow.com/q/26709325
tags question: http://stackoverflow.com/q/26788762
tags question: http://stackoverflow.com/q/26823640
tags question: http://stackoverflow.com/q/26682862

http://stackoverflow.com/q/26800445
tagged with: java
has comment: http://stackoverflow.com/comment/42175317
downvote count: 1
has answer: http://stackoverflow.com/a/26800646
type: Question
has body: QUESTION: print the string by removing the PRIME ASCII CHARACTERS. Here is print Code chart-> http://en.wikipedia.org/wiki/ASCII#ASCII_printable_code_chart Clearly, question says if the ASCII numbers are prime that means you'd have to remove the character. It means If i give input.. Input 4 MEHTA Mehta HELLO hello OUTPUT must be MEHTA Mht HELL hllo Okay, finally i hope you understand this question above .. So as far as i tried this codes: package lesson.practice; import java.util.*; public class MainProgram { public static void main(String[] args){ Scanner in=new Scanner(System.in); System.out.println("Enter your number:"); int num=in.nextInt(); String name = null; System.out.println("Enter name"); for(int i=0; i&lt;=num; i++){ name=in.nextLine(); } String str1=name.replace(new String(Character.toChars(97)), ""). replace(new String(Character.toChars(101)), ""). replace(new String(Character.toChars(103)), ""). replace(new String(Character.toChars(107)), ""). replace(new String(Character.toChars(107)), ""). replace(new String(Character.toChars(113)), ""). replace(new String(Character.toChars(117)), ""). replace(new String(Character.toChars(119)), ""). replace(new String(Character.toChars(67)), ""). replace(new String(Character.toChars(71)), ""). replace(new String(Character.toChars(73)), ""). replace(new String(Character.toChars(79)), ""). replace(new String(Character.toChars(81)), ""). replace(new String(Character.toChars(83)), ""). replace(new String(Character.toChars(87)), ""). replace(new String(Character.toChars(89)), ""); System.out.println("PRIME ASCII ARE REMOVED:"); for(int i=1; i&lt;=num; i++){ System.out.println(str1); } } } But as i run my program, it repeats the String .. HAve a look into output OUTPUT Enter your number: 4 Enter name Mehta MEHTA HELLO Hello PRIME ASCII ARE REMOVED: Hllo Hllo Hllo Hllo
possible better answer: http://stackoverflow.com/a/26800646
score: -1
accepted answer: http://stackoverflow.com/a/26800649
tagged with: ascii
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42174595
has title: My string name is repeating along loop?
has answer: http://stackoverflow.com/a/26800769
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/42174680
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26800649

http://stackoverflow.com/comment/42119059
score: 0
type: Comment
type: QuestionComment
has text: Top tip: Don't put logic in your constructors. put it in methods.
comment on: http://stackoverflow.com/q/26769207

http://stackoverflow.com/a/26693668
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41983571
type: Answer
has comment: http://stackoverflow.com/comment/41989458
has body: The source of your problem is probably that init scripts (Elastic init script in this case) don't see most environment variables (eg JAVA_HOME, JRE_HOME, etc). If you look at the ElasticSearch init script, you will see that PATH variable is set explicitly in that init script and JAVA_HOME is determined by looping through predefined set of possible locations: JDK_DIRS="/usr/lib/jvm/jdk-7-oracle-x64 /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-openjdk-amd64/ /usr/lib/jvm/java-7-openjdk-armhf /usr/lib/jvm/java-7-openjdk-i386/ /usr/lib/jvm/default-java" So you could put your Java installation for example to /usr/lib/jvm/jdk-7-oracle-x64 directory and the init script should pick it up. Update Looking at the init script I noticed that you can set JAVA_HOME in /etc/default/elasticsearch to skip looping through the predefined JDK locations as mentioned above (Source).
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26693437
has comment: http://stackoverflow.com/comment/68667961
answers question: http://stackoverflow.com/q/26693437
upvote count: 2

xslt
tags question: http://stackoverflow.com/q/26722012
tags question: http://stackoverflow.com/q/26784835
tag name: xslt
tags question: http://stackoverflow.com/q/26790924
tags question: http://stackoverflow.com/q/26791857
type: Tag
tags question: http://stackoverflow.com/q/26737628

http://stackoverflow.com/comment/42132026
score: 0
has text: Ok, i see my problem! The ending ; is too much! The correct pattern is of course -> "+#0.000; -#0.000"
comment on: http://stackoverflow.com/q/26776293
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42166762
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26796109
has text: @NorbertRadyk I want to convert this particular string to long/double/int form since the spec says it is a total time which the transaction took.I do a simple split and calculate the seconds .As it is mentioned in the spec as ISO 8601 format,hence the confusion.Wanted to know if there was anything specific to take care w.r.t the format.
type: Comment

http://stackoverflow.com/comment/42151367
score: 1
comment on: http://stackoverflow.com/q/26787305
type: Comment
type: QuestionComment
has text: Indeed, as StackFlowed pointed out, the problem is exactly that getActivity() is returning null.

http://stackoverflow.com/q/26686459
upvote count: 1
has comment: http://stackoverflow.com/comment/41970994
has comment: http://stackoverflow.com/comment/41970942
has comment: http://stackoverflow.com/comment/41970890
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am facing problem in this java function i am trying to post data from my table to server but not able to post as i am getting already connected error Only the first record is posted public int myfuction(){ try{ String url = "myurl/page.php"; String urlParameters=null; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); //add reuqest header con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); Cursor c1 = db.rawQuery("SELECT * FROM temtable ", null); String id = null; if (c1 != null ) { if (c1.moveToFirst()) { do { suid = c1.getString(c1.getColumnIndex("puid")); urlParameters ="text=STAT=1,DEVICEID=10,TERMINALID="+terminal+",USERID="+id; // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); //con.disconnect(); Toast.makeText(this, "Send Para-"+urlParameters, Toast.LENGTH_SHORT).show(); pstatus = 1; }while (c1.moveToNext()); } } con.disconnect(); Toast.makeText(this, "Send Success", Toast.LENGTH_SHORT).show(); } catch(Exception ex) { Toast.makeText(this, "Error:"+ ex.getMessage(), Toast.LENGTH_SHORT).show(); } return 1; } This is what i am using please help...
has answer: http://stackoverflow.com/a/26686773
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/12862347
has comment: http://stackoverflow.com/comment/41970927
downvote count: 0
has comment: http://stackoverflow.com/comment/41971005
possible better answer: http://stackoverflow.com/a/26686854
has comment: http://stackoverflow.com/comment/41970921
has comment: http://stackoverflow.com/comment/41971027
has title: Error Exception: Already connected In java HttpURLConnection of post method
has answer: http://stackoverflow.com/a/26686854
tagged with: android
accepted answer: http://stackoverflow.com/a/26686773
tagged with: httpurlconnection
favorite count: 0

http://stackoverflow.com/comment/42187111
type: Comment
comment on: http://stackoverflow.com/a/26807042
type: AnswerComment
score: 2
has text: Why not just compute `end / 30`, since any number divisible by 2, 3, and 5 must be divisible by 30 = 2 * 3 * 5?

http://stackoverflow.com/a/26750516
score: 13
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26750377
upvote count: 13
has comment: http://stackoverflow.com/comment/42085104
has body: Try this way, hope this will help you to solve your problem. Instead of using getInt(String name) try to use optInt(String name) or optInt(String name,int fallBack) which will handle null value: jsonObject.optInt("OWNER_ID"); Or jsonObject.optInt("OWNER_ID", 0);
answers question: http://stackoverflow.com/q/26750377
has comment: http://stackoverflow.com/comment/94031304
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42084943
has comment: http://stackoverflow.com/comment/42084982
has comment: http://stackoverflow.com/comment/109299007
type: Answer

http://stackoverflow.com/a/26825421
has body: ​If you want to replace words in a sentence which are separated by white space as shown in your example you can use this simple algorithm. Split story on white space Replace each elements, if foo replace it to bar and vice varsa Join the array back into one string ​If Splitting on space is not acceptable one can follow this alternate algorithm. ​You need to use the longer string first. If the stringes are foo and fool, you need to use fool first and then foo. Split on the word foo Replace bar with foo each element of the array Join that array back adding bar after each element except the last
has comment: http://stackoverflow.com/comment/42277718
answers question: http://stackoverflow.com/q/26791441
downvote count: 0
has comment: http://stackoverflow.com/comment/42250001
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/a/26790925
type: AcceptedAnswer
score: 0
type: Answer
has body: I don't know that much about Socket but I can tell you there is definitely a problem with your for loop: for (int x = 1; x == 65535; x++) Remember that a for loop just expands like a while loop, so this translates to the following: int x = 1; while (x == 65535) { // ... x++; } You can probably see what is going on now. (The loop is never executed.) It seems like you intended this: // v for (int x = 1; x &lt;= 65535; x++)
accepted answer of: http://stackoverflow.com/q/26790854
answers question: http://stackoverflow.com/q/26790854

http://stackoverflow.com/comment/42262825
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26821754
has text: Thank you for your answer. I will look into teaching myself key binding.
type: AnswerComment

http://stackoverflow.com/comment/42135104
comment on: http://stackoverflow.com/q/26758972
has text: @KarthikPrasad The sample in the link not applicate in my case. My problem is in the return of function. In parameters is ok. In XML Based, call functions work perfect: ` ` `{ CALL #{outParam, jdbcType=NUMERIC, mode=OUT} := funcName(` `#{param1, jdbcType=NUMERIC, mode=IN},` `#{param2, jdbcType=NUMERIC, mode=IN},` `#{param3, jdbcType=NUMERIC, mode=IN}` ` )}` ` `
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41948764
type: Comment
has text: Is this the only way I can do that? What if I don't want to use the path? My web.xml already on context.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26674664

http://stackoverflow.com/q/26677465
tagged with: openssl
score: 0
has comment: http://stackoverflow.com/comment/41954070
answer count: 0
has comment: http://stackoverflow.com/comment/41954205
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41954339
has comment: http://stackoverflow.com/comment/41953832
has title: Explicitly triggering 'peer not authenticated' exception for a Java client
tagged with: java
has comment: http://stackoverflow.com/comment/41954637
type: Question
has body: I am working on a tutorial for some of my coworkers in an effort to educate them on how to diagnose and deal with SSL Certificate errors. One of the specific errors we run into is the 'peer not authenticated' error that pops out in our logs when we have a bad SSL remote. I have created a local set of certificates: Root CA Intermediate CA Self-signed certificate Root CA signed certificate Intermediate CA signed certificate with no chain Intermediate CA signed certificate with chain Additionally, I've got a maven based project using the maven-jetty-plugin to run up the container with different SSL configurations on different ports. During the course of this I can get the PKIX path validation errors no problem, what I cannot seem to explicitly trigger is a 'peer not authenticated' error. Can anyone point me in a direction to noodle this one out?
tagged with: ssl-certificate

http://stackoverflow.com/comment/42113627
type: Comment
comment on: http://stackoverflow.com/a/26764859
score: 1
type: AnswerComment
has text: What does "this can be everything" mean?

http://stackoverflow.com/a/26831599
downvote count: 0
has comment: http://stackoverflow.com/comment/115535589
upvote count: 8
type: AcceptedAnswer
has body: You only have to use a single for loop - like this: public static void main(String[] args) { int[] numbers = new int[10]; //Generates 10 Random Numbers in the range 1 -20 for(int i = 0; i &lt; numbers.length; i++) { numbers[i] = (int)(Math.random()*20 + 1); }//end for loop System.out.println("Numbers Generated: " + Arrays.toString(numbers)); }
type: Answer
accepted answer of: http://stackoverflow.com/q/26831340
score: 8
answers question: http://stackoverflow.com/q/26831340

http://stackoverflow.com/q/26808858
has comment: http://stackoverflow.com/comment/42196987
has body: I have the layout for the pyramid set I just can't find out how I would combine or mathematically get the next few numbers. What I need is: 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 My code right now is: int x = 7; for (int i =1; i&lt;=x; i++) { for (int j =1; j&lt;=x-i; j++) { System.out.print(" "); } for (int k=1; k&lt;=i;k++) { System.out.printf("%2d",k); } for(int k=i-1; k&gt;=1;k--) { System.out.printf("%2d",k); } System.out.println(" "); } But my output comes out as: 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 1 2 3 4 5 6 5 4 3 2 1 1 2 3 4 5 6 7 6 5 4 3 2 1 Sorry if this came out weird; this is my first question ever on this site. How can I modify my code to get the other pyramid?
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42196995
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42198251
has answer: http://stackoverflow.com/a/26841625
has comment: http://stackoverflow.com/comment/42197023
tagged with: pascals-triangle
has comment: http://stackoverflow.com/comment/42198317
upvote count: 2
type: UnansweredQuestion
tagged with: loops
downvote count: 1
type: Question
has title: I need help producing a pyramid with a certain algorithm to combine numbers (nested loops)
has comment: http://stackoverflow.com/comment/42190517
tagged with: nested-loops
tagged with: java

http://stackoverflow.com/a/26823057
accepted answer of: http://stackoverflow.com/q/26822505
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: Ok, this link gives a quite detailed explanation on how to start the Tomcat Server from within Eclipse and deploy your project onto it. Basically, it consists of these steps: Start Eclipse, go to Help -> Install new software -> Choose The Eclipse Web Tools Platform -> Pick the latest SDK Make sure your project is a Dynamic Web Project and configure its target runtime to be the Apache Tomcat Configure the Tomcat Server, from within Eclipse/Your project Run your project as "Run on Server"
type: Answer
has comment: http://stackoverflow.com/comment/42215392
answers question: http://stackoverflow.com/q/26822505
has comment: http://stackoverflow.com/comment/42215386
score: 4
has comment: http://stackoverflow.com/comment/42215313

http://stackoverflow.com/a/26716976
has comment: http://stackoverflow.com/comment/42094228
upvote count: 3
has comment: http://stackoverflow.com/comment/42089151
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42090233
accepted answer of: http://stackoverflow.com/q/26710017
type: Answer
has body: Forget everything about the sessions from the jsp and servlets world while working with the Play's session. Play doesn't store anything on the server side and by design it's completely stateless. The Play session is just a cookie attached to every http request and it's stored on the client side. Word 'session' may be misleading in your case. Working with the session is pretty straight forward. All you need is inherited from play.mvc.Controller which you have to extend when creating your own controller. To put a value in it you simply call the session(String key, String value) method from within a controller. For example: public class Application extends Controller { public static Result login() { session("key", "example value"); return ok("Welcome!"); } } If there is no session cookie stored on client side this method will create new one and attach it to the HTTP response. Otherwise it will modify the existing one. To read stored value use: String value = session("key"); You can also remove value from the session: session().remove("key"); or completely destroy it: session().clear(); These are helper methods to work with the particular cookie witch in Play's terminology is called session. Nothing stops you from creating another cookie with similar purpose. But it'll require more writing. These helper methods saves your time and in many cases are more than enough. You can specify session cookie name in your application.conf by setting session.cookieName property.
has comment: http://stackoverflow.com/comment/42088801
answers question: http://stackoverflow.com/q/26710017
has comment: http://stackoverflow.com/comment/44502860
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42090395
has comment: http://stackoverflow.com/comment/42090857

http://stackoverflow.com/q/26780358
tagged with: jquery-file-upload
type: Question
favorite count: 0
tagged with: image-uploading
upvote count: 1
tagged with: spring
answer count: 1
tagged with: java
has body: I am doing project in Spring java. Need to upload the image without using form submit and use only ajax call of jquery (Since i need to process back the image in the same page) I have input tag with type=file and I have already loaded commons-fileupload, commons-io jar in spring maven and also added multipartResolver Now I am using below code for servlet @RequestMapping(value = "/upload", method = RequestMethod.POST) @ResponseBody public Map<String, Object> upload(@RequestParam("file") MultipartFile file) { Map<String, Object> map = Maps.newHashMap(); try { BufferedImage src = ImageIO.read(new ByteArrayInputStream(file.getBytes())); File destination = new File("C:/Users/XXX/Desktop/Image_files/Image1.png"); ImageIO.write(src, "png", destination); } catch(Exception e) { e.printStackTrace(); } return map; } my js file $("#uploadbutton").on("click", function() { var oMyForm = new FormData(); oMyForm.append("file", $("#imageid").prop("files")[0]); $.ajax({ url: "/photo/upload/upload", data: oMyForm, processData: false, contentType: false, type: 'POST', success: function(response) { alert("success"); }, error: function() { alert("unable to create the record"); } }); }); The problem is I can able to select image in input type=file tag, but when i click upload button, onclick event triggers and does not make ajax call, showing the error messages "405 method not allowed", Kindly do me favour ???? Eagerly waiting the positive reply .... Any alternative way also warmly welcome
has answer: http://stackoverflow.com/a/26813917
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: jquery
has title: Image upload using ajax jquery in spring without Form submit

http://stackoverflow.com/comment/42125139
type: QuestionComment
has text: one trims the string, one does not. One returns true for `" "`, the other returns false.
score: 1
comment on: http://stackoverflow.com/q/26772777
type: Comment

http://stackoverflow.com/q/26702533
accepted answer: http://stackoverflow.com/a/26703133
score: 4
has title: Retrofit.Callback's success() and failure() in case of two interface implementations in same Activity
has answer: http://stackoverflow.com/a/26703133
tagged with: retrofit
has comment: http://stackoverflow.com/comment/50438417
answer count: 1
has body: I am currently writing an app that connects to a server to make POST requests. For this reason, I have created multiple Retrofit interfaces for various network operations. I have one that performs registration: I take the username, e-mail etc, make a POST request and then as a final parameter I have a Callback (RegistrationResult is a POJO that accepts "success" or "failure" in a class variable). This interface looks like this: public interface RegistrationInterface { @FormUrlEncoded @POST("/api/apiregistration.php") void connect(@Field("country") String country, @Field("state") String state, @Field("email") String email, @Field("pwd") String password, Callback&lt;RegistrationResult&gt; resp); } Now, because I'm going to use GCM for push notifications, I have another interface that sends the registration id of the particular device to the server and, again, gets a response back. That interface looks like this: public interface SendRegIDInterface { @FormUrlEncoded @POST("/api/apiregid.php") void connect(@Field("reg_id") String reg_id, Callback&lt;RegIDResult&gt; resp); } So far, so good. The problem arises when I try to create implementations of both interfaces in the same class. Let's say I have an Activity that, for some reason, should use implementations from both interfaces. So I have this: public class MessageActivity extends Activity implements Callback { public void onCreate(Bundle firebug) { RestAdapter restAdapter1 = new RestAdapter.Builder().setEndpoint(endpoint).build(); RegistrationInterface regInter = restAdapter1.create(RegistrationInterface.class); regInter.connect(// parameters here, MessageActivity.this); RestAdapter restAdapter2 = new RestAdapter.Builder().setEndpoint(endpoint).build(); SendRegIDInterface regIDInter = restAdapter2.create(SendRegIDInterface.class); regIDInter.connect(reg_id, MessageActivity.this); } @Override public void failure(RetrofitError arg0) { } @Override public void success(Object arg0, Response arg1) { } } My problem is this…
favorite count: 0
tagged with: interface
tagged with: android
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/23383203

http://stackoverflow.com/comment/42184731
has text: show me the line:33 in MainActivity.java also..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26805817
score: 0

http://stackoverflow.com/comment/42183872
comment on: http://stackoverflow.com/a/26805339
type: AnswerComment
has text: Do you want to compile a C program with MinGW from java without installing MinGW? If so I would say it is impossible.
score: 0
type: Comment

http://stackoverflow.com/q/26827244
answer count: 3
has answer: http://stackoverflow.com/a/26827339
accepted answer: http://stackoverflow.com/a/26827339
has comment: http://stackoverflow.com/comment/42222425
tagged with: inheritance
favorite count: 0
possible better answer: http://stackoverflow.com/a/26827346
linked to: http://stackoverflow.com/q/3404301
linked to: http://stackoverflow.com/q/15986475
tagged with: abstract
tagged with: exception
has answer: http://stackoverflow.com/a/26827346
duplicate of: http://stackoverflow.com/q/3404301
duplicate of: http://stackoverflow.com/q/15986475
upvote count: 27
has comment: http://stackoverflow.com/comment/42222458
downvote count: 4
type: AnsweredQuestion
has body: I have a abstract class and a derived class. Look at provided code:- public abstract class Parent{ public Parent(){ init(); } public abstract void init(); } public class Child extends Parent{ private String mTitle = null; public Child(){ super(); System.out.println(mTitle.toString()); } public void init(){ mTitle = "It' a test"; } } When I will execute the above code it will throw NullPointerException on printing the value of mTitle. If you check the code in constructor of parent I have called the the abstract method which will called the init method of derived class, In abstract method I have initialize the value of mTitle value as ="It's a test"; After calling parent constructor derived class have to call the System.out.println. If it is doing in that way then why it is throwing NullPointerException. But, If I just leave the assignment of mTitle it will not throw Exception like:- private String mTitle; If initialization of variable occur on calling of the contruct of class and we know by default global object have initialize to null. But in this case it will not throw Exception.
score: 23
type: Question
has comment: http://stackoverflow.com/comment/42222429
has title: Why NullPointerException?
tagged with: java
has answer: http://stackoverflow.com/a/26831461
has comment: http://stackoverflow.com/comment/42222615

http://stackoverflow.com/q/26788151
accepted answer: http://stackoverflow.com/a/26788172
has title: How to get a Double instead of a double when parseing a String?
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26788172
type: Question
has comment: http://stackoverflow.com/comment/42152689
has body: I'm trying to parse a String into a Double and due to restrictions on variables I have to do it in a very odd way. Currently I am having the issue of having two functions both named the same, but one takes a Double and the other a double. public class Calculator { Double x; public Double x(String x){ //code ommited x(Double.parseDouble(x.substring(x.lastIndexOf(" ") + 1, x.length()))); //^^ attempting to get this variable to be a Double instead of double return new Double(x); } public Double x(Double x){ //code ommited return new Double(0); } public Double x(double x){ //code ommited return new Double(0); } }
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42153004
favorite count: 0
tagged with: parsing
tagged with: double

http://stackoverflow.com/comment/41989611
has text: Okay... I´ll open a new one as soon as I got the time. Thank you for your help until now! ^^ I´d give you a vote-up but I don´t have much reputation yet, sorry. ^^;
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26697468

http://stackoverflow.com/q/26809588
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26809632
downvote count: 1
type: Question
has body: I'm trying to print all from 6 to n but when i run the code it gives me all the numbers but not the right perfect numbers. For example when I enter 30 it prints out all numbers but it says only 6 and 7 are perfect numbers only 7 is not a perfect number and 28 is. import java.util.Scanner; public class PerfectN { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter a number that is 6 or above: "); int n = scanner.nextInt(); int sum = 0; if(n&lt;6){ System.out.println("Incorrect number."); } else for(int i = 6;i&lt;=n;i++){ for(int j = 1; j&lt;i; j++){ if(i%j==0) sum += j; } if(sum==i){ System.out.println(i + " is a perfect number."); } else System.out.println(i + " is not a perfect number."); } } }
tagged with: for-loop
tagged with: if-statement
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/42191920
has title: Printing all perfect and non perfect numbers 6 to n
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26809632
tagged with: perfect-numbers

http://stackoverflow.com/comment/41974832
score: 2
type: Comment
comment on: http://stackoverflow.com/q/26688928
type: QuestionComment
has text: Google for C# attributes

http://stackoverflow.com/a/28317769
upvote count: 1
has body: #Ubuntu 14.04 LTS. #Tomcat 7. #OpenJDK 7. #(copie jenkins.war from your local to the server &lt;user&gt; directory) #go to home/&lt;user&gt; cp ~ #Copie jenkins.war in /var/lib/tomcat7/ cp jenkins.war /var/lib/tomcat7/webapps sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/ sudo chown -R tomcat7:tomcat7 /etc/tomcat7/ sudo chown -R tomcat7:tomcat7 /usr/share/tomcat7 sudo service tomcat7 restart And it's ok
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26761980
score: 1

http://stackoverflow.com/q/26765798
has title: Trouble implementing a spinner
tagged with: android
score: 1
tagged with: spinner
favorite count: 0
has answer: http://stackoverflow.com/a/26766664
type: UnansweredQuestion
upvote count: 1
has body: I'm fairly new to Java and android development. I am having trouble implementing a spinner in an android app. The spinner populates fine, but I cannot get it to the labels of the conversions variables to change when the index changes in the spinner. Essentially, the class I am having trouble getting to work is selectOption() or public void onItemSelected(AdapterView parent, View view, int position, long id) class. Any help is extremely appreciated. package com.example.conversion; import java.util.ArrayList; import java.util.List; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.TextView.OnEditorActionListener; public class MainActivity extends ActionBarActivity implements OnEditorActionListener, AdapterView.OnItemSelectedListener{ //Graphical Variables private Spinner option; private TextView inputTextView; private TextView outputTextView; private EditText conversionInput; private TextView conversionOutput; //Conversions private float milesToKil = 1.6093f, kilToMiles = 0.6214f, inchToCent = 2.54f, centToInch = 0.3937f; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //get IDs option = (Spinner) findViewById(R.id.option); inputTextView = (TextView) findViewById(R.id.inputTextView); outputTextView = (TextView) findViewById(R.id.outputTextView); conversionInput = (EditText) findViewById(R.id.conversionInput); conversionOutput = (TextView) findViewById(R.id.conversionOutput); conversionInput.setOnEditorActionListener(this); //Add values to spinner addToSpinner(); //selectOption(); display(""); } //Spinner public void addToSpinner() …
tagged with: java
has answer: http://stackoverflow.com/a/26766438
tagged with: eclipse
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/26710660
has comment: http://stackoverflow.com/comment/42013032
type: UnansweredQuestion
has body: im developing an application which downloads images to an user phones.the download part works properly and the images are stored in "/Android/data//files/". I first do a check to see if the file exists,if not then i want to download it. but when i run the app it keep throwing a NullpointerException.is it because the "/Android/data//files/" doesn't exist during the first run time?if so how do i resolve this issue. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); testtv = (TextView) findViewById(R.id.testtv); String imagename = "/img11.png"; File image = new File(Environment.getExternalStorageDirectory() .getAbsolutePath() + "/Android/data/com.id.imagedownloader/files" + imagename); // testtv.setText(image.toString()); if (image.exists()) { testtv.setText("file exists"); } else { Boolean result = isDownloadManagerAvailable(getApplicationContext()); if (result) { downloadFile(imagename); } } } @SuppressLint("NewApi") public void downloadFile(String imagename) { // TODO Auto-generated method stub String DownloadUrl = "http://testing16.comlu.com/images/" + imagename; DownloadManager.Request request = new DownloadManager.Request( Uri.parse(DownloadUrl)); request.setDescription("sample file for testing"); // appears the same // in Notification // bar while // downloading request.setTitle("Test Title"); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } String fileName = DownloadUrl.substring( DownloadUrl.lastIndexOf('/') + 1, DownloadUrl.length()); request.setDestinationInExternalFilesDir(getApplicationContext(), null, fileName); // get download service and enqueue file DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } public static boolean isDownloadManagerAvailable(Context contex…
has answer: http://stackoverflow.com/a/26710914
has comment: http://stackoverflow.com/comment/42018162
has comment: http://stackoverflow.com/comment/42012963
has answer: http://stackoverflow.com/a/26711118
has answer: http://stackoverflow.com/a/26710709
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/42012919
has title: how to Check dir if file exists?
type: Question
has comment: http://stackoverflow.com/comment/42012904
score: 0
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/42012800

http://stackoverflow.com/comment/42029770
comment on: http://stackoverflow.com/q/26719830
type: QuestionComment
has text: try nextLine() instead of next()
type: Comment
score: 0

http://stackoverflow.com/comment/42071942
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26743040
has text: To expand this a bit. It is not a bad idea in general to send sensitive data to a servlet - encryption and the use of the HTTP post method provided. The problem here is that every proxy in between as well as your browser will save that password since it is part of the requested URL (details aside). Your database _root password_ in this special case. That is a Very Bad Idea™, as duskwuff correctly pointed out.
score: 0

http://stackoverflow.com/comment/42166661
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26687044
type: Comment
has text: Where are you putting android:textColor="#FFFFFF"?

http://stackoverflow.com/q/26712158
has comment: http://stackoverflow.com/comment/42015516
tagged with: maven
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42015455
type: Question
answer count: 1
has title: How to create a test only Maven project?
has body: In my directory structure I use src only. And I am only writing up Selenium Junit tests. So I would only be writing test classes. How can I configure maven to test only with src ? Tried pointing to same output directory, but mvn clean test cannot run the test files. ${project.build.directory}/classes ${project.build.directory}/classes If I add below entries, I see the project gets built twice. ${project.basedir}/src ${project.basedir}/src
has answer: http://stackoverflow.com/a/26712521
type: UnansweredQuestion

http://stackoverflow.com/q/26686089
tagged with: arraylist
score: 0
answer count: 2
tagged with: while-loop
has answer: http://stackoverflow.com/a/26686108
type: AnsweredQuestion
tagged with: java
has title: ending my game with a while loop -- java
type: Question
possible better answer: http://stackoverflow.com/a/26686126
has answer: http://stackoverflow.com/a/26686126
accepted answer: http://stackoverflow.com/a/26686108
has body: I added this code as I was trying to make a TicTacToe Game. Initially the game only played for a single turn, but I needed a way to make it end after the players played the game to finish. But when i ran the code, it didn't even make a turn play. I tested it earlier with a simple while(a>3){/play turn/ a++;} and it worked for the most part, but the loop failed to properly end, just leaving it tapering and forcing me to manually shut down my terminal. http://hastebin.com/iziselusex.tex This is my turns method since you asked for it http://hastebin.com/isoxifufeq.axapta And this contains the Initialize method, as well as the methods mentioned in the turns function int[][] anArray = new int[3][3]; aBoard.initialize(); int end = 0; int t = 0; while(end != 1){ //so long as end isn't reached, the game will still play while(t &lt; 4){ //there are a total of 4 turns that can take place before the board is filled up. 5 if you include the last piece, but i wasn't sure about including it. anArray = this.turns(anArray);//this starts the turn if((anArray[0][0] == anArray[1][1]) &amp;&amp; (anArray[1][1] == anArray[2][2])){ end = 1; }else if((anArray[0][2] == anArray[1][1]) &amp;&amp; (anArray[1][1] == anArray[2][0])){ end = 1; }else if((anArray[0][0] == anArray[0][1]) &amp;&amp; (anArray[0][1] == anArray[0][2])){ end = 1; }else if((anArray[1][0] == anArray[1][1]) &amp;&amp; (anArray[1][1] == anArray[1][2])){ end = 1; }else if((anArray[2][0] == anArray[2][1]) &amp;&amp; (anArray[2][1] == anArray[2][2])){ end = 1; }else if((anArray[0][0] == anArray[1][0]) &amp;&amp; (anArray[1][0] == anArray[2][0])){ end = 1; }else if((anArray[0][1] == anArray[1][1]) &amp;&amp; (anArray[1][1] == anArray[2][1])){ end = 1; }else if((anArray[0][2] == anArray[1][2]) &amp;&amp; (anArray[1][2] == anArray[2][2])){ end = 1; }else{ end = 0; }//this checks for possible victories that could have been made during the last turn t++; //starts the next cycle over again } end = 1; //once all the turns are exhaust…

http://stackoverflow.com/comment/42261455
comment on: http://stackoverflow.com/a/26845050
type: Comment
has text: Very nice book "Learning Libgdx Game Development" https://www.packtpub.com/game-development/learning-libgdx-game-development I downloaded this book from torrent (piracy, arrrgghh). And then googled my questions. At the end of the book there is some information about box2d to create carrot rain. And i learned box2d reading great official manual (all code is in C++ but you'll untderstand it) and a lot of googling.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42046072
type: Comment
comment on: http://stackoverflow.com/a/26728943
score: 1
has text: His underlying data struct is an array of String, so you're also going to have to rearrange the remaining elements as well as adjusting the count of elements and potentially resizing the array list.
type: AnswerComment

http://stackoverflow.com/comment/42155343
type: QuestionComment
has text: I do hope you are not thinking of storing 10 Android `Activity` instances in _anything_.
comment on: http://stackoverflow.com/q/26789497
score: 0
type: Comment

http://stackoverflow.com/a/26699634
upvote count: 0
has comment: http://stackoverflow.com/comment/41993099
score: -1
has comment: http://stackoverflow.com/comment/41993138
downvote count: 1
has comment: http://stackoverflow.com/comment/41993080
answers question: http://stackoverflow.com/q/26699611
has comment: http://stackoverflow.com/comment/41993127
has comment: http://stackoverflow.com/comment/41993288
type: Answer
has body: Try using a long value: long byt = file.length();

javascript
tags question: http://stackoverflow.com/q/26794699
tags question: http://stackoverflow.com/q/26715821
tags question: http://stackoverflow.com/q/26742442
tags question: http://stackoverflow.com/q/26800231
tags question: http://stackoverflow.com/q/26817059
tags question: http://stackoverflow.com/q/26791070
tags question: http://stackoverflow.com/q/26705372
tags question: http://stackoverflow.com/q/26741866
tags question: http://stackoverflow.com/q/26796396
tags question: http://stackoverflow.com/q/26800164
tag name: javascript
tags question: http://stackoverflow.com/q/26732923
tags question: http://stackoverflow.com/q/26707222
tags question: http://stackoverflow.com/q/26774109
tags question: http://stackoverflow.com/q/26730663
tags question: http://stackoverflow.com/q/26737270
tags question: http://stackoverflow.com/q/26715570
tags question: http://stackoverflow.com/q/26816203
tags question: http://stackoverflow.com/q/26721936
tags question: http://stackoverflow.com/q/26732973
tags question: http://stackoverflow.com/q/26785759
tags question: http://stackoverflow.com/q/26826668
tags question: http://stackoverflow.com/q/26768947
tags question: http://stackoverflow.com/q/26743643
tags question: http://stackoverflow.com/q/26771104
tags question: http://stackoverflow.com/q/26713270
tags question: http://stackoverflow.com/q/26798858
tags question: http://stackoverflow.com/q/26731417
type: Tag
tags question: http://stackoverflow.com/q/26769381
tags question: http://stackoverflow.com/q/26735645
tags question: http://stackoverflow.com/q/26739630
tags question: http://stackoverflow.com/q/26698266
tags question: http://stackoverflow.com/q/26772715
tags question: http://stackoverflow.com/q/26714912
tags question: http://stackoverflow.com/q/26729554
tags question: http://stackoverflow.com/q/26795429
tags question: http://stackoverflow.com/q/26799064
tags question: http://stackoverflow.com/q/26766525
tags question: http://stackoverflow.com/q/26742241
tags question: http://stackoverflow.com/q/26674544
tags question: http://stackoverflow.com/q/26700890
tags question: http://stackoverflow.com/q/26810180
tags question: http://stackoverflow.com/q/26727527
tags question: http://stackoverflow.com/q/26745263
tags question: http://stackoverflow.com/q/26795915
tags question: http://stackoverflow.com/q/26745708
tags question: http://stackoverflow.com/q/26734458
tags question: http://stackoverflow.com/q/26826077
tags question: http://stackoverflow.com/q/26684665
tags question: http://stackoverflow.com/q/26807434
tags question: http://stackoverflow.com/q/26723776
tags question: http://stackoverflow.com/q/26722090
tags question: http://stackoverflow.com/q/26772793
tags question: http://stackoverflow.com/q/26684520
tags question: http://stackoverflow.com/q/26754510
tags question: http://stackoverflow.com/q/26698454
tags question: http://stackoverflow.com/q/26819978
tags question: http://stackoverflow.com/q/26767683
tags question: http://stackoverflow.com/q/26758136
tags question: http://stackoverflow.com/q/26750738

http://stackoverflow.com/comment/41953799
type: Comment
type: AnswerComment
has text: One follow up question: can Exif (JFIF) encoded JPEG files also contain, non-Exif (non-JFIF) metadata at the same time? Or is it a fair assumption that an Exif or JFIF file contains either Exif stuff or JFIF stuff and nothing else.
comment on: http://stackoverflow.com/a/26675954
score: 0

http://stackoverflow.com/comment/42214476
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis, I removed `JsonSerialize.Inclusion.ALWAYS` but I still get `null`s. I am going to try newer `Jackson` version
comment on: http://stackoverflow.com/q/26822561
score: 0

http://stackoverflow.com/comment/42015024
comment on: http://stackoverflow.com/a/26711850
score: 0
type: AnswerComment
type: Comment
has text: It looks like a good option .but can you elaborate how to calculate T(i) using Map.

http://stackoverflow.com/q/26730758
has body: I have Order collection: { orderId: "A1", items: [ {itemId: "i001", qty: "20", description: "whatever..."}, {itemId: "i004", qty: "10", description: "whatever..."}, .... ] } { orderId: "A2" ... } How can i add or update an item, depending on itemId being present or not - against a order document? A typical update would result in qty change for an itemid. addToSet (adds if not present, but does not update) and push (always adds) - does not seem to solve this problem.
favorite count: 0
has answer: http://stackoverflow.com/a/26737792
accepted answer: http://stackoverflow.com/a/26737792
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
tagged with: mongodb
has title: MongoDB Java - Add or Update an Array
answer count: 1
tagged with: mongodb-java

http://stackoverflow.com/a/32871785
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/57145115
type: Answer
answers question: http://stackoverflow.com/q/26788260
has body: The existing answer already correctly defines what these actions are. As for the reordering: look at the following example of a thread-divergence action: class ThreadDivergence { int foo = 0; void thread1() { while (true); // thread-divergence action foo = 42; } void thread2() { assert foo == 0; } } You would expect this assertion to never fail. Without thread-divergence actions, this could not be guaranteed because the unreachable definition of setting foo = 42 could be reordered to be executed first. This is forbidden by the JMM. Similarly, external actions are added to avoid surprising outcomes: class Externalization { int foo = 0; void method() { jni(); // external action foo = 42; } native void jni(); /* { assert foo == 0; } */ } Assuming that the JNI method was implemented to run the same assertion, you would not expect this to fail. The JIT compiler cannot determine the outcome of anything external such that the JMM forbidds such reorderings, too.
upvote count: 7
accepted answer of: http://stackoverflow.com/q/26788260

http://stackoverflow.com/comment/41991279
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26698516
has text: I think the port is not closing properly. As a result in the second time when server is trying to listen to the port (which is already occupied by previous run) is getting this error.

http://stackoverflow.com/comment/42101889
score: 0
type: Comment
type: QuestionComment
has text: I'm asking for the logcat output from ADB, not an in-app error message. You can view in your IDE, or follow directions here http://developer.android.com/tools/help/logcat.html
comment on: http://stackoverflow.com/q/26760108

http://stackoverflow.com/comment/41964960
comment on: http://stackoverflow.com/q/26683168
type: Comment
score: 1
type: QuestionComment
has text: What is the code supposed to be doing? What input generated that output and what output did you expect?

http://stackoverflow.com/comment/41993976
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26700058
has text: thank you fr the answe, but please let me know, why the right shift is used followed by And peration over 0xFF
score: 0

http://stackoverflow.com/q/26740095
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26740581
has comment: http://stackoverflow.com/comment/42066240
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
has body: Just spend two hours debugging this, I think I know the cause of the problem but I don't understand how can it produce the kind of results it does. I've got a Swing based application where I override JPanel.paint(Graphics g) like this public void paint(Graphics g) { &lt;snipped code&gt; Insets is = getInsets(); Dimension sz = getSize(); g2.setClip(is.left + 1, is.top + 1, sz.width - is.right - is.left - 2, sz.height - is.top - is.bottom - 2); int w = getWidth(); int h = getHeight(); double s = Math.min(sz.getWidth(), sz.getHeight()); AffineTransform mc = g2.getTransform(); AffineTransform m1 = new AffineTransform(mc); m1.preConcatenate(AffineTransform.getTranslateInstance(-m_CenterX, -m_CenterY)); m1.preConcatenate(AffineTransform.getScaleInstance(m_ScaleX * s, -m_ScaleY * s)); m1.preConcatenate(AffineTransform.getTranslateInstance(w / 2, h / 2)); AffineTransform m2 = new AffineTransform(mc); m2.preConcatenate(AffineTransform.getTranslateInstance(-m_CenterX, -m_CenterY)); m2.preConcatenate(AffineTransform.getScaleInstance(m_ScaleX * s, -m_ScaleY * s)); m2.preConcatenate(AffineTransform.getTranslateInstance(w / 2, h / 2)); try { m_InverseViewTransform = m1.createInverse(); } catch (NoninvertibleTransformException e) { AffineTransform m3 = new AffineTransform(mc); m3.preConcatenate(AffineTransform.getTranslateInstance(-m_CenterX, -m_CenterY)); m3.preConcatenate(AffineTransform.getScaleInstance(m_ScaleX * s, -m_ScaleY * s)); m3.preConcatenate(AffineTransform.getTranslateInstance(w / 2, h / 2)); System.out.println("m1 = " + m1); System.out.println("m2 = " + m2); System.out.println("m3 = " + m3); AffineTransform m4 = new AffineTransform(mc); System.out.println("m4 = " + m4); m4.preConcatenate(AffineTransform.getTranslateInstance(-m_CenterX, -m_CenterY)); System.out.println("m4 = " + m4); m4.preConcatenate(AffineTransform.getScaleInstance(m_ScaleX * s, -m_ScaleY * s)); System.out.println("m4 = " + m4); m4.preConcatenate(AffineTransform.getTranslateInstance(w / 2, h / 2));…
has comment: http://stackoverflow.com/comment/42066659
has title: How can same calculation produce different results
downvote count: 0
score: 1
tagged with: java
tagged with: affinetransform
type: Question
has comment: http://stackoverflow.com/comment/42066524
has comment: http://stackoverflow.com/comment/42066706

http://stackoverflow.com/q/26814711
accepted answer: http://stackoverflow.com/a/26814802
type: Question
tagged with: mongodb-query
score: 0
has title: MongoDb how to fetch rows with missing property
answer count: 1
has body: When finding non deleted rows, I use the following filer: DBCursor myCursor=collection.find(new BasicDBObject("companyId",companyId) .append("isDeleted",Boolean.FALSE)) The issue is that some records doesn't have the "isDeleted" column, so (I assume) that this is the reason they don't appear in the list How to include both records with isDeleted= false and records where the isDeleted property is missing?
tagged with: java
has answer: http://stackoverflow.com/a/26814802
tagged with: mongodb
type: AnsweredQuestion

http://stackoverflow.com/q/26735739
has comment: http://stackoverflow.com/comment/42063174
tagged with: raspbian
tagged with: java
has comment: http://stackoverflow.com/comment/42057997
has title: Raspbian, Java and GStreamer
answer count: 0
has body: I have to generate a jar with eclipse on my mac, and use it on a Raspberry Pi (with Raspbian) I use webcam-capture to take snapshoot with a usb webcam, with the driver-gstreamer. But, after all installations on the raspberry, I have an error when I launch the jar. Exception in thread main java.lang.UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10': Native library (linux-arm/libgstreamer-0.10.so) not found in resource path ([file:/home/pi/Desktop/test.jar]) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) at com.sun.jna.Library.&lt;init&gt;(Library.java:147) at com.sun.jna.Native.loadLibrary(Native.java:412) at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:48) at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:45) at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42) at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39) at org.gstreamer.Gst.&lt;clinit&gt;(Gst.java:59) at com.github.sarxos.webcam.ds.gstreamer.GStreamerDriver.init(GStreamerDriver.java:90) at com.github.sarxos.webcam.ds.gstreamer.GStreamerDriver.&lt;init&gt;(GStreamerDriver.java:49) at CamFloat.&lt;clinit&gt;(CamFloat.java:24) gstreamer-0.10 is installed, with sudo apt-get install gstreamer-0.10 How can I launch the jar file with the native library? And where can I find it? It is mabye a stupid question, but I really don’t understand how it should work. Thank you for reading and sorry for my bad English.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42066044
type: Question
tagged with: gstreamer
score: 0

http://stackoverflow.com/comment/42020284
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26714535
type: AnswerComment
has text: You're right, a java class doesn't have to be public and I updated my answer. I don't know scala, but my superficial search of the web tells me that they typically aren't saved as .java files.

http://stackoverflow.com/q/26735753
tagged with: tcp
tagged with: java
score: -1
has body: i am new at socket programming in java. while running the client code i face these exceptions. i don't understand how to overcome it ! here is my client code import java.io.*; import java.net.*; public class SOCK_1_CLIENT { public static void main(String[] args) throws Exception { SOCK_1_CLIENT client = new SOCK_1_CLIENT(); client.run(); } public void run() throws Exception { Socket sock = new Socket("local host",5050); PrintStream ps = new PrintStream(sock.getOutputStream()); ps.println("Hello to server from client"); InputStreamReader ir = new InputStreamReader(sock.getInputStream()); BufferedReader br = new BufferedReader(ir); String msg = br.readLine(); System.out.println(msg); } } these are the exceptions..!! Exception in thread "main" java.net.UnknownHostException: local host at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at SOCK_1_CLIENT.run(SOCK_1_CLIENT.java:18) at SOCK_1_CLIENT.main(SOCK_1_CLIENT.java:11)
type: Question
upvote count: 0
answer count: 1
has title: Exceptions while doing socket programming in java
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/26735788

http://stackoverflow.com/q/26687540
tagged with: android
has body: I am using signalR java client, i am using this method for connecting the host but getting negotiation exception and connectionid returs null connection = new HubConnection(host); hub = connection.createHubProxy("Chat"); hub.subscribe(MainActivity.this); hub.on("addChatMessage", new SubscriptionHandler() { @Override public void run() { // TODO Auto-generated method stub Log.e("test", "entered in hub.on method"); } }); // connection.start(); SignalRFuture&lt;Void&gt; awaitConnection = connection.start(); try { awaitConnection.get(); } catch (InterruptedException e) { Log.e("&lt;&lt;&lt;Exception&gt;&gt;&gt;", ""+ e.toString() + "&lt;&lt;&lt;&gt;&gt;&gt;" + e.getMessage()); } catch (ExecutionException e) { Log.e("&lt;&lt;&lt;Exception&gt;&gt;&gt;", "" + e.toString() + "&lt;&lt;&lt;&gt;&gt;&gt;" + e.getMessage()); } Log.e("", "connectionId : "+ connection.getConnectionId());
has answer: http://stackoverflow.com/a/26687551
type: UnansweredQuestion
tagged with: java
tagged with: signalr
has title: HubConnection.getConnectionId() returns null in signalR in android
downvote count: 1
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/42070431
type: QuestionComment
has text: @Nambari ,K thanks for reply, I think my question is right, I don't known why it down voted?
comment on: http://stackoverflow.com/q/26742042
score: 0
type: Comment

http://stackoverflow.com/comment/72775361
type: Comment
has text: Hello, please vote positive my question. if you dont do it i need to remove the question because this removes-me points
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26726562

http://stackoverflow.com/q/26684178
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41967197
has body: I have been having problems with appcompat_v7, someone told me to use Android-21 target. An error with that got me told to use JDK 1.8. I currently have JDK 1.6 installed. How do I switch Eclipse over to use JDK 1.8? I see no place to set the JDK path. The other time this question was asked, the questioner was referred to the JRE settings ... but the JDK is not the JRE, there are two separate paths. How do I get Eclipse to use the new JDK?
score: 0
tagged with: java
tagged with: eclipse
type: Question
has title: Updating JDK in Eclipse
has answer: http://stackoverflow.com/a/26684223
answer count: 1

http://stackoverflow.com/comment/41987477
type: AnswerComment
score: 0
type: Comment
has text: In order to use ofy().load().type(Entity.class).id(someEntity.getId()).now(); you would need the reference 'someEntity' (so that someEntity.getId() can be invoked). But isn't the whole point of the line ofy().load().type(Entity.class).id(someEntity.getId()).now() to actually obtain 'someEntity' (well at least that was what I wanted to do). If I did not have a reference to 'someEntity' (which is why I want to use ofy.load(), to actually load 'someEntity' from datastore), it would seem impossible to retrieve it via key/id. Do you see where Im coming from? What am I missing?
comment on: http://stackoverflow.com/a/26693340

http://stackoverflow.com/q/26692795
answer count: 4
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26692840
has answer: http://stackoverflow.com/a/26692846
tagged with: object
linked to: http://stackoverflow.com/q/8803674
tagged with: java
has answer: http://stackoverflow.com/a/26692866
type: Question
has answer: http://stackoverflow.com/a/26692839
tagged with: for-loop
has body: I don't understand why this works and I hope somebody can explain it to me. Here is an example: TestObject array[] = new TestObject[10]; for(int i= 0; i &lt;= 10; i++){ TestObject object = new TestObject(); object.setValue(i); array[i] = object; System.out.println(array[i].getObject()); } Why can I create multiple instances of "TestObject" with the same name in the loop? Usually you can't create instances with the same name: TestObject o = new TestObject(1); TestObject o = new TestObject(2); Well, this will obviously throws an error...
has title: Why can I create multiple instances with the same name in a loop?
has comment: http://stackoverflow.com/comment/41981249
score: 0

http://stackoverflow.com/q/26690910
has body: Before I made a simple dynamic web project with websockets and without maven, it works fine. Now I try to use maven. But when I'm compiling my project with mvn compile jetty:run it doesn't build with javax.servlet.UnavailableException: Servlet class com.example.testbattle.ServerSide is not a javax.servlet.Servlet exception. It requires to implement Servlet interface. Why didn't I need it with simple dynamic web project. How could I avoid this problem? UPDATE: I have found out the problem it was wrong web.xml Now I can't launch serverside. What should I put into web.xml?
has comment: http://stackoverflow.com/comment/41980279
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26717502
tagged with: web-applications
has comment: http://stackoverflow.com/comment/41981998
has title: Maven doesn't compile webapp
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41981897
score: 0
accepted answer: http://stackoverflow.com/a/26717502
answer count: 1
tagged with: jetty
tagged with: maven

http://stackoverflow.com/a/26696655
has comment: http://stackoverflow.com/comment/41989273
answers question: http://stackoverflow.com/q/26696528
downvote count: 1
has body: Java has two kinds of types: primitive data types and reference data types. int is a primitive data type. A reference data type references an instance of a class , or an instance of an array. For primitive data types, the new operator is not used. Primitive data types are always passed by value. For reference data types, the reference is passed by value, but you can have many references pointing to the same object or array. So if you change anything in the object that your reference points to, all other references also see the change. For primitive data types, this doesn't happen. More information about primitive and reference data types: Chapter 4 of the Java Language Specification
score: 3
has comment: http://stackoverflow.com/comment/41987982
has comment: http://stackoverflow.com/comment/41988026
upvote count: 4
has comment: http://stackoverflow.com/comment/41987975
has comment: http://stackoverflow.com/comment/41987992
has comment: http://stackoverflow.com/comment/41988060
type: Answer

http://stackoverflow.com/comment/42026512
comment on: http://stackoverflow.com/q/26718165
score: 0
type: Comment
type: QuestionComment
has text: the RunFirst listener is only defined in the web-fragment.xml of my fragment

http://stackoverflow.com/comment/42017165
type: QuestionComment
has text: What happens if you do a cmis query like `my:shopping.list = "bread" OR (my:shopping.list = "cheese" and my:shopping.list = "milk")` - does that not work?
score: 0
comment on: http://stackoverflow.com/q/26700632
type: Comment

http://stackoverflow.com/comment/43354164
has text: @Alex- Why are you removing all your questions??? Any problem???
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26677486
type: QuestionComment

http://stackoverflow.com/q/26804606
score: 1
tagged with: java
tagged with: mapreduce
has comment: http://stackoverflow.com/comment/42241880
type: Question
tagged with: hadoop
has title: parsing files with mapreduce in hadoop
downvote count: 0
favorite count: 0
tagged with: parsing
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: I have a log file named 2014-11-10.log, the structure is like this head1, body1_a head2, body2 head3, body3 head1, body1_b ... The body with same header may not be equal, for example, body1_a and body1_b are not equal. I want to parse each body into csv files, where each csv file is corresponding to a head. for example, head1, age:5,money:1000,sex:boy head2, email,something@gmail.com, age,20, sex,boy head2, email,something@yahoo.com, age,20 head1, age:5,money:1000 all the lines with head1 can be parsed into a csv file: age,money,sex 5, 1000, boy 5,1000,null Suppose I have 3 head in each log, then I will parse them into 3 csv files. I try to write a mapreduce program for parsing such a big data sets. My mapreduce program takes one log file to a mapper, the parsing logic is done in the mapper, and use the mapper to write the csv files. In my program, no reducers are needed. For example, when encountering head1 of processed line, mapper write to head1.csv after parsing its body. The key is head and the value is the parsed body( For example, "5, 1000, boy" is the value) However, the program is too slow than I expected (one hour about ten thousands of logs, each log is not exceeded 1MB) . Even though I use an empty mapper ( I remove the parsing logic and just write constant string to the csv file), it still run about one hour. Why is such design of program is too slow and How can I improve that. Many thanks.

http://stackoverflow.com/comment/41956895
comment on: http://stackoverflow.com/q/26678869
has text: I added it. It's at line 140.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26700742
has comment: http://stackoverflow.com/comment/41995186
has answer: http://stackoverflow.com/a/26700831
has comment: http://stackoverflow.com/comment/41995124
has body: Hey this is my first time posting! I got my program to print out the vowels from an input from user but I feel like I have repeated myself a lot in the for loop. Is there a quicker way to do this? Also is this code readable and in the correct format? import java.util.Scanner; public class Task09 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String vowels =""; //input from user String answer= input.next() //loop to find vowels for(int i = 0 ;i&lt;answer.length();i++) { char answerPosition = answer.charAt(i); //checks if there are vowels in code if (answerPosition =='a' ||answerPosition =='e' ||answerPosition =='i' ||answerPosition =='o' ||answerPosition =='u' ||answerPosition =='A' ||answerPosition =='I' ||answerPosition =='O' ||answerPosition =='U') { vowels += answerPosition + " "; } } System.out.println("The vowels are:" + vowels); input.close(); } }
has comment: http://stackoverflow.com/comment/41995232
downvote count: 1
has answer: http://stackoverflow.com/a/26700817
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41999598
type: Question
has comment: http://stackoverflow.com/comment/41995153
tagged with: for-loop
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26700815
accepted answer: http://stackoverflow.com/a/26700815
possible better answer: http://stackoverflow.com/a/26700817
favorite count: 0
has title: easier way to find vowels and print them? JAVA
score: 0

http://stackoverflow.com/comment/42227941
type: Comment
type: QuestionComment
has text: @user3002166: isolate your problem is a requirement to solve it. We can discuss this back and forth for hours if you wish, but again, I think that you will not get a decent solution until you first do the required work of isolation. I'm out of here until you comment back that you've created and posted your mcve.
comment on: http://stackoverflow.com/q/26830104
score: 0

http://stackoverflow.com/comment/42098968
type: AnswerComment
has text: Yeah, I see. I`ll find how to add dependencies for binaries and try if it will fix the problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26758036

http://stackoverflow.com/comment/42017249
has text: onclick a link the application open my browser
comment on: http://stackoverflow.com/a/26674647
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26755397
score: 1
linked to: http://stackoverflow.com/q/3958222
accepted answer: http://stackoverflow.com/a/26770374
favorite count: 0
has comment: http://stackoverflow.com/comment/42120491
type: AnsweredQuestion
has body: I have query like this. SELECT * FROM test.config WHERE loginname = 'login' AND SUBSTRING_INDEX(SUBSTRING_INDEX(`value`,',',-1),',',2) BETWEEN '2014-11-05 09:00:00' AND '2014-11-05 10:00:00'; value field consist of comma separated value like '1234,2014-11-05 00:00:00' How can I convert this in hibernate criteria? Any help? EDIT I tried to use sqlRestriction, but no query results. DetachedCriteria dc = DetachedCriteria.forClass(Config.class); dc.add(Restrictions.eq("loginname",loginname)); dc.add(Restrictions.sqlRestriction("substring_index(substring_index(`value`,',',-1),',',2) between ? and ?", new Object[]{startDate,endDate}, new Type[]{StandardBasicTypes.DATE,StandardBasicTypes.DATE}));
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26770374
has title: Split string in hibernate
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42094173
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/42151988
has text: When did 2 weeks become nearly a year?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26787835
score: 0

http://stackoverflow.com/comment/42160036
type: AnswerComment
has text: More to the point, all BigDecimal methods do the same, that mutate the original object. BigDecimals are immutable, and don't ever change.
score: 3
comment on: http://stackoverflow.com/a/26792253
type: Comment

http://stackoverflow.com/comment/42191471
type: AnswerComment
has text: I edited my post to use your PointsHolder class. From the looks of it, it should work... but I'm still getting the exception that it can't convert to the required type when trying to read the json file (even when using ArrayList instead). I think I'm doing something wrong with the setSerializer method.
type: Comment
comment on: http://stackoverflow.com/a/26807588
score: 0

http://stackoverflow.com/q/26722387
has answer: http://stackoverflow.com/a/26743475
score: 0
has comment: http://stackoverflow.com/comment/42037300
answer count: 2
has comment: http://stackoverflow.com/comment/42057215
has comment: http://stackoverflow.com/comment/42037324
has comment: http://stackoverflow.com/comment/42036779
tagged with: byte
has body: I'm transferring Byte arrays of different kinds of files(.png, .txt, etc..) My socket starts sending the data and client starts receiving it. For some reason .pngs doesen't look same as they do on the server side. (Sometimes it says image is unreadable, sometimes only some parts of image are shown.. etc)? I'm wondering how could I make it so that the sent data would actually be the same as the sent data? Any suggestions what I'm doing wrong? (Note! If .png file has alpha channel, image seems always to be completely unreadable.) Client side of the data transfer: try { sInput = new ObjectInputStream(socket.getInputStream()); Input = socket.getInputStream(); } catch (IOException eIO) { System.out.println("Exception creating new Input/output Streams: " + eIO); return false; } . . . LoadCache[] filedata = (LoadCache[]) sInput.readObject(); //This contains the path and size of file while(number &lt; filedata.length){ byte[] mybytearray = new byte[(int) LoadCache.getSize(filedata[number])]; String result = Reader.UpdateCache(LoadCache.getPath(filedata[number])); number++; if(result != "skip" &amp;&amp; result != "Stop"){ BufferedOutputStream Bos = new BufferedOutputStream(new FileOutputStream(result)); int BytesRead = Input.read(mybytearray, 0, mybytearray.length); Bos.write(mybytearray, 0, BytesRead); Bos.close(); } } Server side of the data transfer: Socket socket; ObjectInputStream sInput; ObjectOutputStream sOutput; OutputStream Output; BufferedInputStream buffIn; . . . try{ sOutput = new ObjectOutputStream(socket.getOutputStream()); sInput = new ObjectInputStream(socket.getInputStream()); Output = socket.getOutputStream(); } catch (Exception e){ System.out.println("Couldn't create Input/Output streams"); } . . . File[] Data = Reader.getFiles(Action.getString(Incomingdata.getAction(datain))); LoadCache LoadedCache[] = new LoadCache[Data.length]; for(int i = 0; i&lt;Data.length; i++){ Path filePath = Paths.get(Data[i].getPath()); Path relativePath = base.relativize(file…
has answer: http://stackoverflow.com/a/26724844
type: UnansweredQuestion
tagged with: sockets
has title: Java Transferring Byte arrays over socket corrupted data
has comment: http://stackoverflow.com/comment/42064780
has comment: http://stackoverflow.com/comment/42057257
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/42058263
type: Question

http://stackoverflow.com/comment/41992619
type: Comment
type: AnswerComment
has text: If you don't change `triangle` or `index` prior to the first recursive call - `minimumTotal(triangle, index)` - that call gets the exact same parameters as the previous level of the recursion, so the recursion can never end, regardless of whether or not you are removing the first row after that call.
score: 0
comment on: http://stackoverflow.com/a/26699281

http://stackoverflow.com/comment/41995389
score: 0
has text: What line produces the error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26700824

http://stackoverflow.com/q/26788260
tagged with: multithreading
answer count: 2
has answer: http://stackoverflow.com/a/32871785
has body: I'm currently learning about the Java Memory Model and I came about the different kinds of Actions. There are two of them which I don't fully understand: External Actions and Thread divergence actions Please explain those two action types and give examples for them and for their special properties regarding compiler-reordering and happens-before relation. Oh, and are native calls also external actions? I think they wouldn't define thread divergence actions if there was nothing special about them. So what makes them special so that they need to be defined as a special kind of action?
score: 4
tagged with: java
upvote count: 4
tagged with: java-memory-model
tagged with: native
accepted answer: http://stackoverflow.com/a/32871785
possible better answer: http://stackoverflow.com/a/26788346
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/26788346
has title: Examples for thread divergence actions and external actions in the Java Memory Model
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/42120576
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26770067
has text: One could argue about the kind of error. I think ajb is right, because the Parser performs return-statement checks on the AST and therefore it might be a semantical error. Nevertheless, this is/was the problem and it is fixed now =)
score: 0

http://stackoverflow.com/q/26736988
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
tagged with: documentation
has comment: http://stackoverflow.com/comment/42060867
has answer: http://stackoverflow.com/a/26751184
type: UnansweredQuestion
tagged with: artifactory
has title: Build JDocs without source
tagged with: maven
type: Question
has body: I have an artificatory server (http://www.jfrog.com/open-source/) which I use to deploy certain 3rd party libraries to. I have a specific 3rd party library which has been provided along with a doc directory containing the JDocs for said library. I would really like to compile the doc directory up into a jar so that I my team can drag down the JDocs (along with the 3rd party jar) from artifactory without having to distribute the doc directory independently. All of the tutorials I've googled for suggest that you have to have the source files to do this... which obviously, I don't have. The things I've seen for maven suggest I need the source/project. I've tried using javadoc -d .\docs -source .\java\classes\library.jar -subpackage com.foobar but it borks. I've tried using Eclipse to Export the JDocs as an aggregated jar, but this is either not possible or I'm missing some runes.
has comment: http://stackoverflow.com/comment/42063646

http://stackoverflow.com/comment/42148549
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26785815
has text: That's a pretty ambitious wish. I'd suggest searching the internet for java speech parsers and first trying to see if you can make a "just a speech parser" program work before hooking it into an attempt at a fully speech-operated browser.
score: 1

http://stackoverflow.com/a/26747539
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26747470
downvote count: 0
has body: check github , @krossovochkin Say to you here Looks like missing dependencies. As a quick test, you can download droid-VNC-server.apk file, rename it to droid-VNC-server.zip, unpack this file. In /lib folder you should find libandroidvncserver.so compiled lib for every supported architecture. You can add it to your project and try to build again. This worked for me for commit: ac9c26d3c12396750c969e8e97c5c78e756a1dce Another solution is to use commit: f95fa6bc44d4302acb2233d3c16f718d843ca33d So there is no such a problem at all for me. Hope it helps
type: Answer

http://stackoverflow.com/q/26789848
favorite count: 0
has answer: http://stackoverflow.com/a/26790064
accepted answer: http://stackoverflow.com/a/26790064
has title: Implementing the Controller part of MVC in Java Swing
linked to: http://stackoverflow.com/q/26517856
tagged with: model-view-controller
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
tagged with: swing
downvote count: 1
type: Question
has body: This question is around the standard practice for implementing the MVC architecture in Java - Swing particularly. I know this question has been asked before but I want to be a bit more specific around the use of the Controller. I've been separating my models, views, and controllers where: Data are processed within a model class Swing components are within a view class Event handling anonymous classes are also in the view class (user inputs) A controller class contains references to the model and view objects Back to the specific of the controller - I've been using class (static) variables to represent controllers for easy access by any part of my application. So my controller classes may look like this: public class Controller { public static ControllerA controllerA; public static ControllerB controllerB; } public class ControllerA { private JPanel panel1; private JPanel panel2; private DefaultListModel list; } ... Every time I need to do something I would call the controller like this: Controller.controllerA.doSomething This means that the bulk of my code are located within the controller. Often if I need to do something, the controller would have a method for it, and it often requires an equivalent method in the view or the model to accomplish the task. I find that this leads to code duplication. For example: Controller.controllerA.removeElement(); Will call the following method in the controller: protected void removeElement() { list.removeElement() } As my application grow, I'm seeing a lot of instances where the controller simply mirror the action required by the model or the view because it is the main access point to the view/model. So my questions are: Is it a good practice to use static variable for accessing controller objects? Is the code duplication between controller->model and controller->view a side effect of MVC? Am I doing this wrong? If so, how would you implement a controller within the MVC?
answer count: 1

http://stackoverflow.com/q/26794324
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26794675
has body: My question is how do I restrict user input to Y/N or y/n(in Java). Currently i'm using the equals() and plan to change them to equalsignorecase(), this should take care of the case part. However, this doesn't stop the user from entering other characters(ex: H or h). Currently when a character besides y or n is entered program proceeds straight to "thanks for playing message" and the end of the game. I am relatively new to programming, so please provide examples with suggestion, preferably a complete example. It really goes a long way with me. Additional, if you feel this section of code could be written in a better way, I am open to rewrites, but once again please provide a full example. I realize this question is a little broad for stackoverflow but I could really use the insight of more experienced programs. Thank you for your time. // creates instance of BufferedReader // prompts user to play the game again // places user input in a try // if user wants to play again, call startGame() // if user dosen't want to play again, keep asking anyways private void showPlayAgainMessage() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out.println("Do you want to play again? (y/n)"); try { String playAgain = br.readLine(); // Do you want to play again? Is y. if(playAgain.equals("y")) { startGame();//else prompt another question with if else } // Do you want to play again? Is n. else if(playAgain.equals("n")) { System.out.println(); System.out.println("Last chance. Play again? (y/n)"); playAgain = br.readLine(); // Last chance. Play again? Is y. if(playAgain.equals("y")) { startGame(); } // Last chance. Play again? Is n. else if(playAgain.equals("n")) { System.out.println(); System.out.println("How about Minesweeper? (y/n)"); playAgain = br.readLine(); // How about Minesweeper? Is y. if(playAgain.equals("y")) { System.out.println(); System.out.println("I really wish we had Minesweeper..."); System.out.println("Lots of…
tagged with: if-statement
tagged with: java
type: Question
tagged with: nested-if
has answer: http://stackoverflow.com/a/26794640
has title: Java, BufferedReader, restrict user input, y/n
tagged with: bufferedreader
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26794627

http://stackoverflow.com/a/43834364
answers question: http://stackoverflow.com/q/26693846
has body: Your error is just simple to correct. You didn't tell your code to increase or decrease (++ or --) you should set your variable to increase or decrease base in what you want it to do.
type: Answer
has comment: http://stackoverflow.com/comment/74706339
score: 0

http://stackoverflow.com/comment/42017756
type: QuestionComment
comment on: http://stackoverflow.com/q/26713504
score: 2
has text: I'm not aware of any built-in limits to the depth of subclassing - however the JVM will keel over and die with a `StackOverflowError` due to the sheer amount of chained constructor calls that end up on the stack if you take inheritance to the extreme. Your class heirarchy would need to be several hundred classes deep (depending on constructor complexity) for this to happen though. But as noted by others - this would be strongly indicative of a bad design.
type: Comment

http://stackoverflow.com/comment/42030244
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26719220
type: AnswerComment
has text: Perfect. One last question. How would i ignore the first line as it has headers?

http://stackoverflow.com/q/26831550
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: navigation-drawer
has body: I have the mainactivity that should be loaded first and on a drawer item selected should new activity/fragment be started, but for some reason the drawer item method is being invoked before the mainactivity oncreate even takes place and the drawer item for profile is selected... basically not sure why it keeps taking me straight to the profileactivity. Here is the main activity code: public class MainActivity extends FragmentActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { //Starter fragment private StarterFragment starterFragment; // Alert Dialog Manager AlertDialogManager alert = new AlertDialogManager(); /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTitle; //Session private SessionManager sessionM; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d(Constants.DEBUG, "IN MAIN ACTIVITY (LOADED)"); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); //set default page to open home page onNavigationDrawerItemSelected(1); } private void onSessionStateChange(Session session, SessionState state, Exception exception) { //user is authenticated if (state.isOpened()) { Log.i("Main", "Logged in..."); //user is not authenticated } else if (state.isClosed()) { sessionM.logoutUser(); Log.i("Main", "Logged out..."); } } @Override public void onNavigationDrawerItemSelected(int position) { //to switch between fragments Fragment fragment = null; switch (position) { case 0: …
tagged with: android-fragments
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42237433
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/23778131
has comment: http://stackoverflow.com/comment/42229932
tagged with: android
has title: The main activity OnCreate gets called after a method?

http://stackoverflow.com/comment/42157111
type: QuestionComment
comment on: http://stackoverflow.com/q/26790471
has text: What does "cathExeptions()" mean?
score: 0
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/26699413
tags question: http://stackoverflow.com/q/26820922
tags question: http://stackoverflow.com/q/26759060
tags question: http://stackoverflow.com/q/26679714
type: Tag
tags question: http://stackoverflow.com/q/26743376
tags question: http://stackoverflow.com/q/26706639
tags question: http://stackoverflow.com/q/26773254
tags question: http://stackoverflow.com/q/26816360
tags question: http://stackoverflow.com/q/26825693
tags question: http://stackoverflow.com/q/26806701
tags question: http://stackoverflow.com/q/26704144
tags question: http://stackoverflow.com/q/26695904
tags question: http://stackoverflow.com/q/26674422
tags question: http://stackoverflow.com/q/26698200

http://stackoverflow.com/q/26677367
tagged with: input
has answer: http://stackoverflow.com/a/26677492
tagged with: java
downvote count: 3
has title: How can I call a class in another class
tagged with: output
upvote count: 1
type: Question
score: -2
has answer: http://stackoverflow.com/a/26677422
tagged with: class
answer count: 3
has body: lets say I have a Main class which my main program runs with it. public calss Main{ public static void main(String[] args){ System.out.print("input Length "); a = in.nextInt(); System.out.print("input Height "); b = in.nextInt(); ... (The code that goes in between?) ... System.out.println("output"); } } How can I use another class and input it in side my first class lets say if its a simple calculation class like pubic class Math{ output = a*b } and have like this input and output: input Length 2 input Height 3 6 By the way don't vote down for me cause I'm noob! common why you do this? XD
favorite count: 0
has comment: http://stackoverflow.com/comment/41953768
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26677443

http://stackoverflow.com/a/26717882
score: 14
answers question: http://stackoverflow.com/q/26717733
has body: You are getting the default toString() from Object because you created your own class named Date which is hiding the imported Date from java.util.. You can rename your class or you can use the canonical name java.util.Date like public static void main(String args[]) { java.util.Date date = new java.util.Date(); System.out.println(date); } Output here is Mon Nov 03 10:57:45 EST 2014
downvote count: 2
type: Answer
upvote count: 16

http://stackoverflow.com/comment/42210162
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26820144
has text: What exception is being thrown if its not NPE?

http://stackoverflow.com/comment/42229276
type: Comment
has text: there's your issue. you need to add the new Purchase to the Purchase table (with PK P0003) then you can add the PurchaseDetails that points to it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26830945
score: 0

http://stackoverflow.com/q/26737435
has comment: http://stackoverflow.com/comment/42061027
linked to: http://stackoverflow.com/q/5621338
score: 0
answer count: 1
tagged with: layout-manager
has answer: http://stackoverflow.com/a/26737497
has title: Good Swing LayoutManager for Window Builder
type: UnansweredQuestion
has body: As to my experience in my Java Swing programming, I have only used absolute layout, in which I can position objects anywhere in frame using a Window Builder plugin for Eclipse. But the problem with that is, it's hard to maintain, and when the frame is re-sized the objects remain in their positions which is a not good. Is there a layout manager in Swing that uses absolute positioning (I'm using Window Builder) but when the frame is resized, the objects inside the frame go with the flow?
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
tagged with: java
type: Question

http://stackoverflow.com/a/26813219
answers question: http://stackoverflow.com/q/26813201
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: You can't change the return type of main. This, public static int main(String[] args) must be one of (per this worthwhile Wikipedia article on Entry point) public static void main(String[] args) public static void main(String... args) public static void main(String args[]) All of which are void, if you need to set a UNIX style return type, you can use System.exit(int); to quote the Javadoc that Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

http://stackoverflow.com/a/26679983
has comment: http://stackoverflow.com/comment/41964074
has comment: http://stackoverflow.com/comment/41967123
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26679163
type: Answer
answers question: http://stackoverflow.com/q/26679163
has comment: http://stackoverflow.com/comment/41963660
score: 2
has comment: http://stackoverflow.com/comment/41958846
downvote count: 0
has body: The suggestion to using a Timer would work better. If you want to do the threading manually, though, then something more like this would be safer and better: class Facebook implements Runnable { private final Object monitor = new Object(); public boolean running = false; public void startThread() { synchronized (monitor) { running = true; monitor.notifyAll(); } } public void stopThread() { synchronized (monitor) { running = false; } } @Override public void run() { while(true) { try { synchronized (monitor) { // Wait until somebody calls startThread() while (!running) { monitor.wait(); } } //HTTP Calls Thread.sleep(2000); } catch (InterruptedException ie) { break; } } } } Note in particular: You should generally implement Runnable instead of subclassing Thread, then use that Runnable to specify the work for a generic Thread. The work a thread performs is not the same thing as the thread itself, so this yields a better model. It's also more flexible if you want to be able to perform the same work by other means (e.g. a Timer). You need to use some form of synchronization whenever you want two threads to exchange data (such as the state of the running instance variable). There are classes, AtomicBoolean for example, that have such synchronization built in, but sometimes there are advantages to synchronizing manually. In the particular case that you want one thread to stop work until another thread instructs it to continue, you generally want to use Object.wait() and a corresponding Object.notify() or Object.notifyAll(), as demonstrated above. The waiting thread consumes zero CPU until it is signaled. Since you need to use manual synchronization with wait/notify anyway, there would be no additional advantage to be gained by using an AtomicBoolean. Edited to add: Since apparently there is some confusion about how to use this (or the original version, I guess), here's an example: class MyClass { static void main(String[] args) { FaceBook fb = new FaceBook(); Thread fbThre…

http://stackoverflow.com/q/26726720
score: 0
answer count: 2
has body: I have an ImageButton inside of a listviews children like so: &lt;ImageButton android:id="@+id/pick_up_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/feed_item_padding_left_right" android:background="@null" android:onClick="pickUpDropOff"/&gt; That calls the pickUpOrDropOff method like this: public void pickUpDropOff(View view) { ImageButton buttonToChange = (ImageButton) view.findViewById(R.id.pick_up_button); if (buttonToChange.getTag(R.bool.PICKED_UP_TAG).toString() == "false") { buttonToChange.setImageResource(R.drawable.triangle_full); buttonToChange.setTag(R.bool.PICKED_UP_TAG, "true"); ListItem itemToChange = parent } else if (buttonToChange.getTag(R.bool.PICKED_UP_TAG).toString() == "true") { buttonToChange.setImageResource(R.drawable.triangle_empty); buttonToChange.setTag(R.bool.PICKED_UP_TAG, "false"); } // do some other stuff } This does indeed change the image resource, but when the views get recycled the change in image resource doesn't persist, as my POJO atttribute for pickedUp has not been changed. How do I get the POJO in this case in order to change the attribute?
has comment: http://stackoverflow.com/comment/42042849
possible better answer: http://stackoverflow.com/a/26727739
has answer: http://stackoverflow.com/a/26727739
tagged with: android
has answer: http://stackoverflow.com/a/26747226
type: AnsweredQuestion
tagged with: java
has title: Android get POJO after button is clicked within listview item
type: Question
accepted answer: http://stackoverflow.com/a/26747226
has comment: http://stackoverflow.com/comment/42044951
tagged with: listview

http://stackoverflow.com/q/26676301
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26700283
type: Question
has body: I am using ez-vcard to parse some VCard files on Android. These VCard files are generated by Android's Default Contact App. Now the problem with these VCard files is that, these files contain data for 'PHOTO' property which was encoded by Android's Base64 class. So when I use Photo#getData() method, I am not getting the right 'decoded' data. So I was looking for some work around so as to get the 'encoded' data string for photo property. Any help/suggestions will be appreciated. Edit: I am pretty sure that Base64 class of Android is creating problems because when I write a VCard file using ez-vcard with a photo and try opening this file with Default Contacts App, it gives a VCard parse error but when I write photo string encoded by Android's Base64 class, everything works fine. To get the encoded photo data string, I also tried using VCard#getExtendedProperty("PHOTO") method but it returns null.
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26700283
tagged with: vcf-vcard
favorite count: 0
tagged with: android
type: AnsweredQuestion
has title: How to get 'encoded' photo data in ezvcard?
score: 1

http://stackoverflow.com/q/26800506
answer count: 1
has answer: http://stackoverflow.com/a/26816039
tagged with: java
has title: HTML structure varying on input
tagged with: jsoup
has comment: http://stackoverflow.com/comment/42202742
linked to: http://stackoverflow.com/q/26795112
downvote count: 0
accepted answer: http://stackoverflow.com/a/26816039
type: AnsweredQuestion
tagged with: android
tagged with: regex
score: 1
favorite count: 0
has body: I have a string which contains dynamic HTML. The HTML can contain static image, maps, texts, links, etc. You can take a look at this link. The answer to this question is working when I am having text and links (a href). But, if the html contains images or maps, its malfunctioning and the html is not getting generated as expected. The methods which I have created to do the job are: private void createHtmlWeb(){ String listOfElements = "null"; // normally found if // webTextcontains.maps.google.com Toast.makeText(getApplicationContext(), "" + mainEditText.getHeight(), Toast.LENGTH_SHORT).show(); ParseObject postObject = new ParseObject("Post"); Spannable s = mainEditText.getText(); String webText = Html.toHtml(s); webText = webText.replaceAll("(&lt;/?(?:b|i|u)&gt;)\\1+", "$1").replaceAll("&lt;/(b|i|u)&gt;&lt;\\1&gt;", ""); // Logic to add center tag before image // Document doc = Jsoup.parse(webText); // Elements imgs = doc.select("img"); // for (Element img : imgs) { // img.attr("src", "images/" + img.attr("src")); // or whatever // } // // doc.outerHtml(); // returns the modified HTML //Determine link and favourite types to add favourite a class around it. // Determine link and favourite types to add favourite a class around // it. if (webText.contains("a href")) { String favourite = "favourite"; // Parse it into jsoup Document doc = Jsoup.parse(webText); // Create an array to tackle every type individually as wrap can // affect whole body types otherwises. Element[] array = new Element[doc.select("a").size()]; for (int i = 0; i &lt; doc.select("a").size(); i++) { if (doc.select("a").get(i) != null) { array[i] = doc.select("a").get(i); } } for (int i = 0; i &lt; array.length; i++) { // we don't want to wrap link types. Common part links have is // http. Should update for somethng more secure. if (array[i].toString().contains("http") == false) { // wrapping inner href with a tag attributes Elements link = doc.select("a"); String linkHref = link.attr("href"); Log.e("l…
type: Question
upvote count: 1

http://stackoverflow.com/q/26750819
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/26750902
has comment: http://stackoverflow.com/comment/42085511
type: Question
has answer: http://stackoverflow.com/a/26751225
possible better answer: http://stackoverflow.com/a/26750917
has answer: http://stackoverflow.com/a/26751187
has answer: http://stackoverflow.com/a/26751105
has comment: http://stackoverflow.com/comment/42085711
has answer: http://stackoverflow.com/a/26750917
score: 0
has comment: http://stackoverflow.com/comment/42085891
accepted answer: http://stackoverflow.com/a/26750902
has comment: http://stackoverflow.com/comment/42085426
has title: How to accept null JTextField in java?
answer count: 5
tagged with: swing
has body: Actually I am working on Java Swing for front end and Mysql as a back end for my system. I have one Java swing form which contains some JTextField so in that some JTextField required to fill compulsory and some are optional. But when I have not entered any values in that optional JTextField it shows NumberFormatException. I have set null in my mysql database table to those optional fields but still its not working. Can you please help me with this? Thank you String value1=(String)cb.getSelectedItem(); String value2=t2.getText(); String value3=t3.getText(); String value4=t4.getText(); String value5=(String)cb5.getSelectedItem(); double value6=Double.parseDouble(t6.getText()); String value7=(String)cb7.getSelectedItem(); double value8=Double.parseDouble(t8.getText()); String value9=t9.getText(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/Priyanka","root","root"); ps=con.prepareStatement("insert into ReceiptsVoucher values(?,?,?,?,?,?,?,?,?);"); ps.setString(1,value1); ps.setString(2,value2); ps.setString(3,value3); ps.setString(4,value4); ps.setString(5,value5); ps.setDouble(6,value6); ps.setString(7,value7); ps.setDouble(8,value8); ps.setString(9,value9); int r=ps.executeUpdate(); if(r==0) JOptionPane.showMessageDialog(null,"Record not Inserted retry"," ",JOptionPane.ERROR_MESSAGE); else JOptionPane.showMessageDialog(null,"Record Inserted Sucessfully"," ",JOptionPane.INFORMATION_MESSAGE); ps.close(); con.close(); JComboxBox ie cb7 and JTextField t8 are optional fields String value1=(String)cb.getSelectedItem(); String value2=t2.getText(); String value3=t3.getText(); String value4=t4.getText(); String value5=(String)cb5.getSelectedItem(); double value6=Double.parseDouble(t6.getText()); String value7=(String)cb7.getSelectedItem(); String v8=t8.getText(); //double value8=Double.parseDouble(t8.getText()); String value9=t9.getText(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jd…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42085936

http://stackoverflow.com/comment/42009339
type: Comment
type: QuestionComment
has text: Your question title is misleading.. This isn't *shuffling*. You are *rearranging* the elements based on some criteria.
score: 0
comment on: http://stackoverflow.com/q/26708633

http://stackoverflow.com/a/26826661
has comment: http://stackoverflow.com/comment/42221566
type: Answer
has comment: http://stackoverflow.com/comment/42221572
has comment: http://stackoverflow.com/comment/42221931
has comment: http://stackoverflow.com/comment/42221976
has body: You can use Class&lt;?&gt; as the type argument for the second list - and then use Class.isInstance to perform the check for "instancehood": List&lt;Class&lt;?&gt;&gt; classes = new ArrayList&lt;&gt;(); classes.add(String.class); classes.add(int.class); classes.add(RandomClass.class); for (int i = 0; i &lt; list.size(); i++) { if (classes.get(i).isInstance(list.get(i))) { ... } }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26826640
downvote count: 1
has comment: http://stackoverflow.com/comment/42222347
answers question: http://stackoverflow.com/q/26826640
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42221447
has comment: http://stackoverflow.com/comment/42221603

http://stackoverflow.com/q/26805200
has body: I'm trying to create a Java program that will OCR many formats of images. Images cannot be read directly from file, because their bytes are to be send through network. I'm currently able to read raw bytes of image pixels using ImageIO. However I would like to support all the formats that are supported by ImageMagick, so read the image using JMagick and then give raw bytes to Tess4J. I'm not sure how I should approach this. I found this function can give me bytes: PixelPacket[] MagickImage.getColormap(); But I would have to write special method for transforming obtained the PixelPacket objects to consecutive bytes. I can do that, but maybe there's better way to do this? For example maybe there's some extremely raw file format (even more than http://en.wikipedia.org/wiki/BMP_file_format#mediaviewer/File:BMPfileFormat.png) that I could use for example in this method: byte[] imageToBlob(ImageInfo imageInfo) ? The imageInfo object will have to point to this raw format and then I can cut out the pixels information from the bytes array. Is this the proper way or I should use something simpler (faster/more robust)? Edit I found the format I had in mind is called PNM.
tagged with: imagemagick
accepted answer: http://stackoverflow.com/a/26810272
answer count: 1
tagged with: jmagick
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26810272
score: 0
type: Question
tagged with: tesseract
tagged with: java
has title: Feed tesseract (Tess4J) from ImageMagick (JMagick)
tagged with: tess4j

jakarta-ee
tags question: http://stackoverflow.com/q/26733020
tags question: http://stackoverflow.com/q/26758400
tags question: http://stackoverflow.com/q/26785755
type: Tag
tags question: http://stackoverflow.com/q/26821993
tags question: http://stackoverflow.com/q/26727475
tags question: http://stackoverflow.com/q/26781232
tags question: http://stackoverflow.com/q/26776748
tags question: http://stackoverflow.com/q/26760695
tags question: http://stackoverflow.com/q/26733141
tags question: http://stackoverflow.com/q/26737628
tags question: http://stackoverflow.com/q/26724919
tags question: http://stackoverflow.com/q/26830248
tags question: http://stackoverflow.com/q/26787231
tags question: http://stackoverflow.com/q/26743712
tags question: http://stackoverflow.com/q/26806494
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/26755267
tags question: http://stackoverflow.com/q/26737284
tags question: http://stackoverflow.com/q/26720466
tags question: http://stackoverflow.com/q/26682588
tags question: http://stackoverflow.com/q/26754062
tags question: http://stackoverflow.com/q/26713576
tags question: http://stackoverflow.com/q/26723197
tags question: http://stackoverflow.com/q/26790959
tags question: http://stackoverflow.com/q/26761255
tags question: http://stackoverflow.com/q/26816568
tags question: http://stackoverflow.com/q/26690910
tags question: http://stackoverflow.com/q/26773272
tags question: http://stackoverflow.com/q/26773784
tags question: http://stackoverflow.com/q/26775947
tags question: http://stackoverflow.com/q/26770041
tags question: http://stackoverflow.com/q/26674146
tags question: http://stackoverflow.com/q/26698239
tags question: http://stackoverflow.com/q/26688756
tags question: http://stackoverflow.com/q/26820393
tags question: http://stackoverflow.com/q/26781613
tags question: http://stackoverflow.com/q/26829844
tags question: http://stackoverflow.com/q/26743404
tags question: http://stackoverflow.com/q/26731093
tags question: http://stackoverflow.com/q/26831893
tags question: http://stackoverflow.com/q/26816496
tags question: http://stackoverflow.com/q/26797060
tags question: http://stackoverflow.com/q/26769891
tags question: http://stackoverflow.com/q/26819832
tags question: http://stackoverflow.com/q/26786290
tags question: http://stackoverflow.com/q/26742593
tags question: http://stackoverflow.com/q/26699543
tags question: http://stackoverflow.com/q/26694109
tags question: http://stackoverflow.com/q/26720277
tags question: http://stackoverflow.com/q/26743131
tags question: http://stackoverflow.com/q/26718277
tags question: http://stackoverflow.com/q/26693007
tags question: http://stackoverflow.com/q/26778706
tags question: http://stackoverflow.com/q/26793446

http://stackoverflow.com/a/26835276
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26755672
upvote count: 2
has body: Thymeleaf is the view layer, you still need the Model/Controller to be able to drive the manipulation of it. Without java code to enact and to activate the relevant logic for th:include and th:replace you won't be able to manage this at this stage.
downvote count: 0

http://stackoverflow.com/a/26680783
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26679641
answers question: http://stackoverflow.com/q/26679641
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41972917
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41960866
has body: If I understood your code correctly, you are making a game where the human player has to click as fast as possible on all of his shapes while the PC is randomly clicking on shapes as well. The first one to clear all of his shapes win. If that is correct, you probably want to adjust your SwingWorker to loop until the game is finished. Currently your loop exit the first time the end of the loop is reached due to the return statement Since you are not doing anything with the boolean return value of the SwingWorker, you might as well let it return void No need to call get in the done method. The moment that method is called, the SwingWorker has finished. You only seem interested in the intermediate results In the process method, you might want to loop over all values. Note that the process method is not called each time you publish something. The values you publish are grouped and passed in bulk to the process method when the EDT (Event Dispatch Thread) is available

http://stackoverflow.com/comment/42321959
type: Comment
has text: The same has been checked with HttpServletRequest. but nothing it changed.
comment on: http://stackoverflow.com/a/26841374
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42096294
comment on: http://stackoverflow.com/q/26757066
score: 0
type: Comment
type: QuestionComment
has text: did you install [FFSampledSP](http://www.tagtraum.com/ffsampledsp/) ?

http://stackoverflow.com/comment/42103091
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26757813
has text: Submit a simplified reproducable version of your code as the exception could be caused by a number of things.

http://stackoverflow.com/q/26776215
tagged with: postgresql
has title: Spring JdbcTemplate with DBCP BasicDataSource still closes connections
has body: I'm using postgres jdbc driver to connect to Amazon RedShift. Here are also BasicDataSource from DBCP 2.0.1 and JdbcTemplate from Spring 4. I use DataSourceTransactionManager with Transactional annotations. It looks like DataSource still keeps on creating new connections! // that is how dataSource is created BasicDataSource dataSource = new BasicDataSource() { public Connection getConnection() throws SQLException { Connection c = super.getConnection(); System.out.println("New connection: " + c); return c; } }; dataSource.setUsername(env.getProperty(USERNAME)); dataSource.setPassword(env.getProperty(PASSWORD)); dataSource.setDriverClassName(env.getProperty(DRIVER_CLASS)); dataSource.setUrl(env.getProperty(CONNECTION_URL)); and I see in console for each operation another Connection object (they have different hashcodes). If I switch to SingleConnectionDataSource all works as expected, with a single connection object. Before call to jdbcTemplate#execute I use TransactionSynchronizationManager.isActualTransactionActive to see that transactions are working (they are)... What could I miss then? Why transactions are closed? Or what more can I do to investigate the problem. The url also have tcpKeepAlive=true parameter... UPD thanks to Evgeniy, I've changed the code to see when connections are really created: BasicDataSource dataSource = new BasicDataSource() { protected ConnectionFactory createConnectionFactory() throws SQLException { final ConnectionFactory cf = super.createConnectionFactory(); return new ConnectionFactory() { public Connection createConnection() throws SQLException { Connection c = cf.createConnection(); System.out.println("New connection from factory: " + c); return c; } }; } }; //dataSource.setMaxIdle(0); Now I really see that only two connections were created (and if I add setMaxIdle(0) they are instead recreated before each query). So my suspicion was wrong and pool works as expected. Thanks a lot!
has comment: http://stackoverflow.com/comment/42132915
tagged with: spring-jdbc
type: AnsweredQuestion
upvote count: 2
tagged with: spring
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26776637
tagged with: java
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/26776637
favorite count: 0

http://stackoverflow.com/q/26686374
tagged with: android-custom-view
type: Question
has body: I know I could do as the warning directs me to; create 2- or 3-argument View constructor. However, the CustomView is from a 3rd party SDK which is final, so I feel like I must use this one to take full advantage of the SDK. Anyhow, there's no chance to extend final CustomView. Is there any workaround? On a side note, the view I'm trying to use is MetaioSurfaceView by Metaio. Below is the logcat message right after the crash: A/WTF(18270): Unable to start activity ComponentInfo{com.suzi.application/com.suzi.application.CustomActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.metaio.sdk.MetaioSurfaceView A/WTF(18270): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.suzi.application/com.suzi.application.CustomActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.metaio.sdk.MetaioSurfaceView A/WTF(18270): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) A/WTF(18270): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359) A/WTF(18270): at android.app.ActivityThread.access$700(ActivityThread.java:165) A/WTF(18270): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326) A/WTF(18270): at android.os.Handler.dispatchMessage(Handler.java:99) A/WTF(18270): at android.os.Looper.loop(Looper.java:176) A/WTF(18270): at android.app.ActivityThread.main(ActivityThread.java:5455) A/WTF(18270): at java.lang.reflect.Method.invokeNative(Native Method) A/WTF(18270): at java.lang.reflect.Method.invoke(Method.java:525) A/WTF(18270): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209) A/WTF(18270): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025) A/WTF(18270): at dalvik.system.NativeStart.main(Native Method)
has answer: http://stackoverflow.com/a/26686584
score: 4
answer count: 1
favorite count: 0
tagged with: android
upvote count: 4
has title: Custom view CustomView is not using the 2- or 3-argument View constructors
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26686584

http://stackoverflow.com/q/26705144
tagged with: jeditorpane
upvote count: 3
tagged with: mouselistener
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/26705732
has body: I want to add tooltips to hyperlinks in a (non-editable) JEditorPane. I found some hints on the web, but none of them worked for me. This is my current approach: jEditorPaneIsFollower.addMouseMotionListener(new java.awt.event.MouseMotionListener() { @Override public void mouseMoved(java.awt.event.MouseEvent evt) { int pos = jEditorPaneIsFollower.viewToModel(evt.getPoint()); if (pos &gt;= 0) { HTMLDocument hdoc = (HTMLDocument)jEditorPaneIsFollower.getDocument(); javax.swing.text.Element e = hdoc.getCharacterElement(pos); AttributeSet a = e.getAttributes(); String href = (String) a.getAttribute(javax.swing.text.html.HTML.Attribute.TITLE); if (href != null) { jEditorPaneIsFollower.setToolTipText(href); } else { jEditorPaneIsFollower.setToolTipText(null); } } else { jEditorPaneIsFollower.setToolTipText(null); } } @Override public void mouseDragged(java.awt.event.MouseEvent e) { // } }); The initialization of my editor pane: jEditorPaneIsFollower.setEditable(false); jEditorPaneIsFollower.setContentType("text/html"); jEditorPaneIsFollower.setDocument(new HTMLDocument()); jEditorPaneIsFollower.setEditorKit(new HTMLEditorKit()); The content of the editor pane is following: &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt; &lt;td width="1%" valign="top"&gt; &amp;#220;bergeordnet: &lt;/td&gt; &lt;td valign="top"&gt; &lt;a href="#cr_288" alt="DRGs als Prozesssteuerung" title="DRGs als Prozesssteuerung"&gt;288&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; From debugging, I see that pos always changes when I move the mouse over the editor pane, however, the character element e is always null. So my questions are: Do I need to set editor kit and document type to HTML when initializing the editor pane? How can I fetch the right element and access the title attribute to set it as tooltip when moving the mouse over the editor pane?
has answer: http://stackoverflow.com/a/26705785
tagged with: tooltip
downvote count: 0
possible better answer: http://stackoverflow.com/a/26705732
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/40453532
accepted answer: http://stackoverflow.com/a/26705785
has title: Retrieve title-attribute of hyperlink in JEditorPane on mouse hover
favorite count: 0
type: Question
tagged with: swing

http://stackoverflow.com/comment/42099427
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26736234
has text: Actually yes you are right, your answer was good enough ! But there's still something that doesn't work, it appears that it's not possible to add a drop listener to a label. The only method available is addDragDetectListener, but I'd rather prefer to add a listener for a drop operation, which should be more safe.
type: AnswerComment

http://stackoverflow.com/comment/42217281
has text: Do you have any attempt?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26824112
type: Comment

http://stackoverflow.com/q/26683441
has comment: http://stackoverflow.com/comment/45402955
has comment: http://stackoverflow.com/comment/41965858
linked to: http://stackoverflow.com/q/16107683
has answer: http://stackoverflow.com/a/26714510
downvote count: 0
has comment: http://stackoverflow.com/comment/41966265
linked to: http://stackoverflow.com/q/16159203
type: UnansweredQuestion
has title: Brian Goetz's improper publication
type: Question
score: 3
linked to: http://stackoverflow.com/q/26740095
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/41965785
tagged with: concurrency
has comment: http://stackoverflow.com/comment/45320752
answer count: 2
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/26683799
has body: The question has been posted before but no real example was provided that works. So Brian mentions that under certain conditions the AssertionError can occur in the following code: public class Holder { private int n; public Holder(int n) { this.n = n; } public void assertSanity() { if (n!=n) throw new AssertionError("This statement is false"); } } When holder is improperly published like this: class someClass { public Holder holder; public void initialize() { holder = new Holder(42); } } I understand that this would occur when the reference to holder is made visible before the instance variable of the object holder is made visible to another thread. So I made the following example to provoke this behavior and thus the AssertionError with the following class: public class Publish { public Holder holder; public void initialize() { holder = new Holder(42); } public static void main(String[] args) { Publish publish = new Publish(); Thread t1 = new Thread(new Runnable() { public void run() { for(int i = 0; i &lt; Integer.MAX_VALUE; i++) { publish.initialize(); } System.out.println("initialize thread finished"); } }); Thread t2 = new Thread(new Runnable() { public void run() { int nullPointerHits = 0; int assertionErrors = 0; while(t1.isAlive()) { try { publish.holder.assertSanity(); } catch(NullPointerException exc) { nullPointerHits++; } catch(AssertionError err) { assertionErrors ++; } } System.out.println("Nullpointerhits: " + nullPointerHits); System.out.println("Assertion errors: " + assertionErrors); } }); t1.start(); t2.start(); } } No matter how many times I run the code, the AssertionError never occurs. So for me there are several options: The jvm implementation (in my case Oracle's 1.8.0.20) enforces that the invariants set during construction of an object are visible to all threads. The book is wrong, which I would doubt as the author is Brian Goetz ... nuf said I'm doing something wrong in my code above So the questions I have: - Did someone ever provoke thi…

http://stackoverflow.com/q/26741595
linked to: http://stackoverflow.com/q/40471
has comment: http://stackoverflow.com/comment/42069658
has comment: http://stackoverflow.com/comment/42069530
accepted answer: http://stackoverflow.com/a/26741811
has title: Best way to save two depending Strings in Java and compare if new strings already exist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42069078
tagged with: java
has body: I need to save two depending Strings (action and parameter) into a file or a hashtable/map or an Array, depending what is the best solution for speed and memory. My Application iterates through a large amount of forms on a website and i want to skip if the combination (String action,String parameter) already was tested and therefore saved. I thing an Array would be too slow if I have more then thousands of different action and parameter tupels. I´m not experienced enough to chose the right method for this. I tried a hashtable but it does not work: Hashtable&lt;String, String&gt; ht = new Hashtable&lt;String, String&gt;(); if (ht.containsKey(action) &amp;&amp; ht.get(action).contains(parameter)) { System.out.println("Tupel already exists"); continue; } else ht.put(action, parameter);
has comment: http://stackoverflow.com/comment/42069136
type: Question
has answer: http://stackoverflow.com/a/26741811
score: 0
has comment: http://stackoverflow.com/comment/42069225
answer count: 1
has comment: http://stackoverflow.com/comment/42069475
tagged with: string
has comment: http://stackoverflow.com/comment/42069001

http://stackoverflow.com/q/26760279
score: -1
type: Question
tagged with: testing
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26762600
tagged with: encapsulation
tagged with: default
favorite count: 0
has comment: http://stackoverflow.com/comment/42101862
has answer: http://stackoverflow.com/a/26760362
has body: How do you test a default constructor in one class and then test it in a different class? This is the code for the Person class which has the default constructor. I'm not sure in the PersonTester class how to access this default constructor and how to test it - what I have so far for the second class is also below. Any help will be muchly appreciated, thanks :) class Person { // Data Members private String name; // The name of this person private int age; // The age of this person private char gender; // The gender of this person // Default constructor public Person() { name = "Not Given"; age = 0; gender = 'U'; } // Constructs a new Person with passed name, age, and gender parameters. public Person(String personName, int personAge, char personGender) { name = personName; age = personAge; gender = personGender; } // Returns the age of this person. public int getAge( ) { return age; } // Returns the gender of this person. public char getGender( ) { return gender; } // Returns the name of this person. public String getName( ) { return name; } // Sets the age of this person. public void setAge( int personAge ) { age = personAge; } // Sets the gender of this person. public void setGender( char personGender ) { gender = personGender; } // Sets the name of this person. public void setName( String personName ) { name = personName; } } // end class import java.util.Scanner; public class PersonTester { // Main method public static void main(String[] args){ // TEST THE DEFAULT CONSTRUCTOR FIRSTLY. // Create an instance of the Person class. Person person1 = new Person(); Scanner input = new Scanner(System.in); // Get the values from user for first instance of Person class. System.out.println("Person 1 Name: "); person1.setName(input.nextLine()); System.out.println("Person 1 Age: "); person1.setAge(input.nextInt()); System.out.println("Person 1 Gender: "); person1.setGender(input.next().charAt(0);); // Alternatively assign values to the Person class. // person1.setName("Not Giv…
tagged with: constructor
type: UnansweredQuestion
has title: How to test default constructor in a different class in Java
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/42177010
has text: @Cfx You can't do that. If you pass `T` to `A` like `A<T>`, `foo().bar()` -> `bar()` method is unknown on type `A` because type parameter was not `B` but `T` which extends `A<T>`. Try it. `bar()` is declared in class `B`, so that has to be passed to `A` if we want `bar()` to call on the return value of `foo()`.
comment on: http://stackoverflow.com/a/26800887
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26674705
score: -9
upvote count: 1
has comment: http://stackoverflow.com/comment/41948844
favorite count: 0
has answer: http://stackoverflow.com/a/26675028
answer count: 3
has title: Split an expression to float numbers
downvote count: 10
tagged with: regex
has comment: http://stackoverflow.com/comment/41948801
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41948850
has answer: http://stackoverflow.com/a/26674763
tagged with: java
has answer: http://stackoverflow.com/a/26674966
type: Question
has body: I have a string like this "2/-4+5.7*5*-7.9+3" I want to split it in an array such that the elements are the absolute value of floating numbers only [2,4,5.7,5,7.9,3]

http://stackoverflow.com/a/26692572
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41989961
accepted answer of: http://stackoverflow.com/q/26692480
answers question: http://stackoverflow.com/q/26692480
has body: Try using an expression, instead of a scriptlet: &lt;%= request.getSession().getAttribute("currentUser"); %&gt; Your scriplet will execute, but nothing is output. The result of an expression is automtically written to the output.
upvote count: 3

http://stackoverflow.com/comment/42079043
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26746572
type: Comment
has text: Thanks for your reply. Actually I am pressing the delete button in a page where the table exists already and the user get to select an element. After that he presses the button. I am indeed confused with event-driven programming.

http://stackoverflow.com/comment/42103534
type: QuestionComment
comment on: http://stackoverflow.com/q/26760999
score: 3
has text: define `doesn't work`. (typically, check the actual response from the server)
type: Comment

http://stackoverflow.com/q/26720785
answer count: 2
upvote count: 0
score: -1
has body: I am struggling with the below assignment: assignment q: using methods from the string class, write a program that will count the number of words which are separated by blanks in a string. For simplicity, use strings without punctuation or other white space characters(tabs, newlines etc). Use a JTextArea to allow the user to enter the text and allow the text area to scroll if necessary. when the user clicks a button to count the words , the total number of words counted is displayed in a textbox that cannot be modified by the user. now my problem is that i am not getting the counted number to display in the un-editable textbox. i also have the problem where the cusrsor is showing in the middle of the input screen instead of at the top. please can you point me in the right direction. import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; import java.util.*; public class WordCounter extends JFrame implements ActionListener { //Construct a panel for the fields and buttons JPanel fieldPanel = new JPanel(); JPanel buttonPanel = new JPanel(); //Construct labels and text boxes JTextField screen = new JTextField(1); JLabel wordCount = new JLabel(" Word Count = "); JTextField words = new JTextField(3); //Construct button JButton countButton = new JButton("Count Words"); public static void main(String[] args) { WordCounter f = new WordCounter(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(500,200); f.setTitle("Word Counter"); f.setResizable(false); f.setLocation(200,200); f.setVisible(true); } public static int getWordCount(String screen) { int count = 0; for (int i = 0; i &lt; screen.length(); i++) { if (screen.charAt(i) == ' ') { count++; } } return count; } public WordCounter() { Container c = getContentPane(); c.setLayout((new BorderLayout())); fieldPanel.setLayout(new GridLayout(1,1)); buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); //add rows to panels fieldPanel.add(screen); //add button to pane…
has title: using string methods to count words
has answer: http://stackoverflow.com/a/26721144
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26721102
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42031531

http://stackoverflow.com/comment/42083628
type: QuestionComment
has text: Alternately, you can implement the Runnable interface. It's not how you're using threads in this situation, so which (Runnable, or extending Thread as Peshal mentions) is preferable is unknown. Also you should avoid doing the cast '(Car)carThread'. There a number of ways to avoid this, but most come down to why you know all elements in cars are of type Car.
comment on: http://stackoverflow.com/q/26749665
score: 0
type: Comment

http://stackoverflow.com/q/26692112
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41986907
accepted answer: http://stackoverflow.com/a/26695374
has body: Background : Linux ROCKMAN 3.2.0-4-amd64 #1 SMP Debian 3.2.63-2 x86_64 GNU/Linux Apache Maven 2.2.1 (rdebian-8) Java version: 1.6.0_32 Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "3.2.0-4-amd64" arch: "amd64" Family: "unix" java version "1.6.0_32" OpenJDK Runtime Environment (IcedTea6 1.13.4) (6b32-1.13.4-1~deb7u1) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode) javac 1.6.0_32 What I have tried https://github.com/msgpack/msgpack-java/wiki/QuickStart 1. $ git clone git@github.com:msgpack/msgpack-java.git sarit@ROCKMAN:~/workspace/msgpack-java$ ls LICENCE.sbt-extras.txt msgpack-core NOTICE project sbt LICENSE.txt msgpack.org.md pom.xml README.md version.sbt I got everything right the same repository except "pom.xml". 2. Add pom.xml on my own version which is copy from link above. (I put space in front of angle bracket to display) &lt; dependencies> &lt; dependency> &lt; groupId>org.msgpack&lt; /groupId> &lt; artifactId>msgpack&lt; /artifactId> &lt; version>0.7.0-p1&lt; /version> &lt; /dependency> &lt; /dependencies> 3. mvn package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: unknown POM Location: /home/sarit/workspace/msgpack-java/pom.xml Reason: Not a v4.0.0 POM. for project unknown at /home/sarit/workspace/msgpack-java/pom.xml [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Not a v4.0.0 POM. for project unknown at /home/sarit/workspace/msgpack-java/pom.xml at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at o…
has title: Debian msgpack install error java maven
downvote count: 0
tagged with: msgpack
has comment: http://stackoverflow.com/comment/41986691
has answer: http://stackoverflow.com/a/26692293
type: AnsweredQuestion
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26692293
tagged with: compiler-errors
type: Question
has answer: http://stackoverflow.com/a/26695374
answer count: 2
tagged with: maven
tagged with: installation

http://stackoverflow.com/a/26754716
type: Answer
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26754311
answers question: http://stackoverflow.com/q/26754311
downvote count: 0
has body: Are You using classes from the jar under dominio/build/libs in the second project? If so, this should be a compile dependency. I'd also recommend setting a multimodule gradle project. Here are the docs.
upvote count: 2

http://stackoverflow.com/q/26816336
has body: I wrote a web crawler that opens many web pages. As you can see in the image below, some threads seem to be finished (white color), but what does it mean? Do I have some bug? Is there a leak of resources? And, how can I have an idea about where those threads are generated and why are they finished? Should I worry about them? VisualVM The problem is that if i keep it running for a day, i get thousands of that threads, so i'm worried about it.
has answer: http://stackoverflow.com/a/26816537
has answer: http://stackoverflow.com/a/26816521
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42203560
favorite count: 0
has title: Finished Threads: should i ignore them?
upvote count: 1
tagged with: visualvm
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/26814933
has comment: http://stackoverflow.com/comment/42202548
accepted answer of: http://stackoverflow.com/q/26797620
answers question: http://stackoverflow.com/q/26797620
type: Answer
score: 3
upvote count: 3
has body: The problem is with your read() method. You use jsonData.child inside loop that is always the first element. Try this instead: public PointsHolder read(Json json, JsonValue jsonData, Class type) { PointsHolder pointsHolder = new PointsHolder(); for (JsonValue child = jsonData.child; child != null; child = child.next.next) { Vector2 vector2 = new Vector2(); vector2.x = child.asFloat(); vector2.y = child.next.asFloat(); pointsHolder.splinePoints.add(vector2); } return pointsHolder; } I tested this code with the latest release and it works. UPDATE: I've tested code with the string [0,0, 1,1, 2,2]. If you want to deserialize something like { splinePoints: [0,0, 1,1, 2,2] } you have to wrap your PointsHolder with new class. Something like: public class PointsHolderWrapper { public PointsHolder splinePoints; }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42212877

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26777578
tags question: http://stackoverflow.com/q/26714086
type: Tag

http://stackoverflow.com/comment/42167525
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26796510
has text: @andylie And you don't need an additional for loop.
type: AnswerComment

http://stackoverflow.com/q/26768955
type: Question
has body: So I'm currently working on the GUI for one of my projects and I'm trying to set up a JavaFX ColorPicker to allow the user to set the fill color of a rectangle. The ColorPicker appears and allows the user to select one of the default colors, however whenever the user clicks on the "Custom Color" link that should open up the Custom Color pop-up dialog box, a NullPointerException is raised. I currently have it set up that when the user right clicks the rectangle, a ContextMenu appears with one MenuItem that contains the ColorPicker. ContextMenu contextMenu = new ContextMenu(); MenuItem changeColor = new MenuItem(); ColorPicker colorPicker = new ColorPicker(); contextMenu.getItems().add(changeColor); changeColor.setGraphic(colorPicker); for(int i = 0; i &lt; customColors.getChildren().size(); i++) { customColors.getChildren().get(i).setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;(){ @Override public void handle(MouseEvent e){ selectedRectangle.setStrokeWidth(1); selectedRectangle = (Rectangle)e.getSource(); ((Rectangle)e.getSource()).setStroke(Color.BLACK); ((Rectangle)e.getSource()).setStrokeWidth(4); ColorPaletteModel.getInstance().setSelectedIndex(16+customColors.getChildren().indexOf(e.getSource())); if(e.getButton() == MouseButton.SECONDARY){ contextMenu.show((Rectangle)e.getSource(),Side.TOP,0,0); } } }); This is the Exception thread that appears when you try to click the "Custom Colors" link: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at javafx.stage.Window$9.invalidated(Unknown Source) at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source) at javafx.beans.property.BooleanPropertyBase.set(Unknown Source) at javafx.stage.Window.setShowing(Unknown Source) at javafx.stage.Window.show(Unknown Source) at javafx.stage.Stage.show(Unknown Source) at com.sun.javafx.scene.control.skin.CustomColorDialog.show(Unknown Source) at com.sun.javafx.scene.control.skin.ColorPalette$1.handle(Unknown Source) at com.sun.javafx…
score: 4
has comment: http://stackoverflow.com/comment/42118863
upvote count: 4
has title: JavaFX ColorPicker won't bring up CustomColor pop-up dialog box
tagged with: user-interface
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42118876
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: javafx

http://stackoverflow.com/q/26752725
has answer: http://stackoverflow.com/a/26752742
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42088675
type: UnansweredQuestion
has body: What is the best way to concatenate two Strings in java. likely best performance and less memory usage. Please help me..!
duplicate of: http://stackoverflow.com/q/47605
downvote count: 4
upvote count: 0
linked to: http://stackoverflow.com/q/47605
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/42088725
type: Question
has comment: http://stackoverflow.com/comment/42090163
has title: Best way of concatenate String in java

http://stackoverflow.com/comment/42048073
type: Comment
comment on: http://stackoverflow.com/a/26729230
score: 0
type: AnswerComment
has text: So from what I've read there, whatever you do you need to start an in-memory node to connect to an existing grid? And configure it to be either client node or data node? Was trying to find if there is an API that allows this without having to start and additional node, but this will suffice for now.

http://stackoverflow.com/comment/42180367
type: Comment
has text: Spring is moaning that there aren't any `Ty` objects to autowire.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26743044

http://stackoverflow.com/comment/42230710
type: Comment
type: QuestionComment
has text: I'm creating JUnit HTML report using Ant. It contains all output created by System.out.println in the browser. I want to pass a link constructed from within a program.
comment on: http://stackoverflow.com/q/26832038
score: 0

http://stackoverflow.com/q/26787843
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I need help to create the correct pojo's from this database... https://www.dropbox.com/s/j2lfu44zpqfcxb4/dbr.PNG I have tried creating this classes... @Entity @Table(name="Municipio", catalog="elecciones2014", schema="") public class Municipio implements Serializable{ @EmbeddedId private MunicipioPk idMunicipio; @Basic(optional=false) @Column(name="nomb_municipio") private String nomb_municipio; } With this Embedded class @Embeddable class MunicipioPk implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Column(name="id_depto") String departamento; @Column(name="id_municipio") String idMunicipio; } The problem is when i want to reference to 'Municipio' from 'JRV' y don't know how to access to field 'id_municipio'. I had this code but it doesn't work @Entity @Table(name = "JRV", catalog = "elecciones2014", schema = "") public class Jrv { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id_jrv") private int id; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="id_municipio",referencedColumnName="idMunicipio") private Municipio municipio; @ManyToOne @JoinColumn(name="DUI",referencedColumnName="dui") private PadronElectoral dui; } can someone help me? how I have to do it? Thanks in advice!!
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has title: Composite keys with Hibernate
has answer: http://stackoverflow.com/a/26788524
accepted answer: http://stackoverflow.com/a/26788524
score: 2
downvote count: 0
tagged with: mysql

http://stackoverflow.com/a/26717832
upvote count: 20
score: 20
type: AcceptedAnswer
downvote count: 0
has body: Your class is a custom class that is producing the output given by Object.toString. Rename the class to something else other than Date so that java.util.Date is correctly imported
answers question: http://stackoverflow.com/q/26717733
type: Answer
accepted answer of: http://stackoverflow.com/q/26717733
has comment: http://stackoverflow.com/comment/65683846

http://stackoverflow.com/comment/41950688
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26675626
has text: Thanks for the info . This was busting my head .

http://stackoverflow.com/comment/42224417
type: Comment
comment on: http://stackoverflow.com/a/26828518
has text: `java.lang.String` predates `CharSequence` by many years.
score: 3
type: AnswerComment

http://stackoverflow.com/q/26824253
possible better answer: http://stackoverflow.com/a/26824351
has answer: http://stackoverflow.com/a/26824287
favorite count: 0
has answer: http://stackoverflow.com/a/26824351
has answer: http://stackoverflow.com/a/26824283
has answer: http://stackoverflow.com/a/26824301
has answer: http://stackoverflow.com/a/26824445
answer count: 14
has body: Bellow is an example I found on Tutorials Points, an example of a constructor. I got most of them, but I just don't get why you need a constructor and a method. public Puppy(String name){ System.out.println("Passed Name is :" + name ); } My question is, what stops you from doing this instead? public static void Puppy(String name){ System.out.println("Passed Name is: "+name); } Doesn't these two do the same thing once called? Here is the full program for reference: public class Puppy { int puppyAge; public Puppy(String name) { System.out.println("Passed Name is :" + name); } public void setAge(int age) { puppyAge = age; } public int getAge() { System.out.println("Puppy's age is :" + puppyAge); //what does this return do? since the puppyAge is already printed above. return puppyAge; } public static void main(String []args){ Puppy myPuppy = new Puppy("tommy"); myPuppy.setAge(2); myPuppy.getAge(); System.out.println("Variable Value :" + myPuppy.puppyAge); } }
has answer: http://stackoverflow.com/a/26824384
has answer: http://stackoverflow.com/a/26824286
has answer: http://stackoverflow.com/a/26824343
has answer: http://stackoverflow.com/a/26824369
tagged with: constructor
has answer: http://stackoverflow.com/a/26824306
has answer: http://stackoverflow.com/a/26824632
has title: Difference between constructors and methods
downvote count: 2
tagged with: methods
accepted answer: http://stackoverflow.com/a/26824301
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26824295
upvote count: 14
has answer: http://stackoverflow.com/a/26824299
tagged with: java
has comment: http://stackoverflow.com/comment/42217603
type: Question
score: 12
has answer: http://stackoverflow.com/a/26827829

http://stackoverflow.com/q/26708303
has answer: http://stackoverflow.com/a/26708618
tagged with: java
possible better answer: http://stackoverflow.com/a/26708315
has answer: http://stackoverflow.com/a/26708315
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26708618
score: 0
has title: How to compare input to txt file Strings stored in an array
answer count: 2
tagged with: text-files
has body: I have a txt file and I want to be able to compare input of a name to the names already on the file. I get a message "cannot find symbol" for the array that I have stored the txt file data in. I'm not sure if i am doing something wrong with storing the data in an array or what I need to do in order to get it be able to access the array from my for loop. I get the error at the aryLines in for(String name : aryLines) package binarysearch; import java.io.*; import java.util.Scanner; /** * * @author Timothy */ public class BinarySearch { public static void main(String[] args) throws IOException { String file_name = "C:/Users/Timothy/Documents/test.txt"; try { ReadFile file = new ReadFile(file_name); String[] aryLines = file.OpenFile(); /* for(int index = 0; index &lt; aryLines.length; index++) { System.out.println(aryLines[index]); } */ } catch(IOException error) { System.out.println(error.getMessage()); } String newName; Scanner in = new Scanner(System.in); System.out.println("Enter a name to compare to list: "); newName = in.nextLine(); for(String name : aryLines) { if(name.equalsIgnoreCase(newName)) { System.out.println("This name has already been added"); } else { WriteFile data = new WriteFile(file_name, true); data.writeToFile("/n" + newName); } } } } WriteFile class package binarysearch; import java.io.*; import java.util.Scanner; /** * * @author Timothy */ public class WriteFile { private String path; private boolean append_to_file = false; public WriteFile(String file_path) { path = file_path; } public WriteFile(String file_path, boolean append_value) { path = file_path; append_to_file = append_value; } public void writeToFile(String textLine) throws IOException { FileWriter write = new FileWriter(path, append_to_file); PrintWriter print_line = new PrintWriter(write); print_line.printf("%s" + "%n", textLine); print_line.close(); } } ReadFile Class package binarysearch; import java.io.*; /** * * @author Timothy */ public class ReadFile { private String path; pub…
type: AnsweredQuestion

http://stackoverflow.com/comment/42176181
has text: I want to resume activity from where app has gone into the background. weather it is the home activity or other activity
score: 0
comment on: http://stackoverflow.com/q/26800772
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42085936
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26750819
score: 0
has text: check the answer below

http://stackoverflow.com/comment/42232284
type: Comment
has text: Yeah, basically what this guy said :) Do your queries need to always return the most up to date stuff? I guess not since it will be cached eventually. What is the max time that the cache may differ from live data?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26825843

http://stackoverflow.com/comment/41996970
comment on: http://stackoverflow.com/a/26701271
type: Comment
has text: Btw. SI provide SOA paradigm. If you need only communicate with some.components rmi is good choice.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/42079200
comment on: http://stackoverflow.com/a/26746736
score: 1
has text: Hi I got confused with TableModel, JTable instances. The line "JTable table = new JTable(tableModel); " i took from internet blindly just to try out whether it works or not. Actually, your code solves the problem. Thanks a ton.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26777023
has body: Lets say you have a particular enum called Field: public enum Field { ALBUM, DESCRIPTION } And another enum called: public enum Operator { CONTAINS, EQUALS, LESS_THAN, GREATER_THAN } And you have a corresponding Java interface called Music public interface Music { String getAlbum(); String getDescription(); } Which the implementation looks liks this: public class MusicImpl implements Music { @Override public String getYear() { return Field.Year.toString(); } @Override public String getDescription() { return Field.DESCRIPTION.toString(); } @Override public Object getField(Field field) { Object myObject = field.getClass(); return myObject; } } How would you use this API to implement the following two methods? public class MyApp { @Override public List&lt;Music&gt; searchMusic(String query) { // What to put in this? } @Override public List&lt;Music&gt; filterMusic(Field field, Operator op, String query) { // What to put in? } }
tagged with: enums
has comment: http://stackoverflow.com/comment/42132446
tagged with: java
type: Question
has title: How to use enums to create generic API for Search and Filter of POJOs in Java?
has comment: http://stackoverflow.com/comment/42132277
has comment: http://stackoverflow.com/comment/42132254
score: 0
has comment: http://stackoverflow.com/comment/42132306
has comment: http://stackoverflow.com/comment/42132307
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26709201
has title: Can't create accounts in a java program
has comment: http://stackoverflow.com/comment/42013843
score: 0
has comment: http://stackoverflow.com/comment/42010593
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42010320
answer count: 0
tagged with: default-constructor
tagged with: java
has body: I have to write a program which creates 4 different accounts and outputs them using different constructors. I have no idea how to use the default constructor to make an account for certain users, because there are no parameters in the constructor and the instructions did not have a method to take the name. (This is also not based on user input, but pre-set). Any ideas would be helpful.
type: Question

http://stackoverflow.com/comment/42119729
type: AnswerComment
comment on: http://stackoverflow.com/a/26769630
type: Comment
has text: This might be a feasible way.
score: 0

http://stackoverflow.com/comment/41970686
score: 0
has text: on mediaplayer completion how to reset seekbar to starting position ?
type: Comment
comment on: http://stackoverflow.com/a/26686365
type: AnswerComment

http://stackoverflow.com/q/26752404
accepted answer: http://stackoverflow.com/a/26905933
score: 0
has body: I'm using a CountDownTimer. I'd like to play a sound at specific time just for advise . Well here is my code: @Override public void onTick(long l) { if((TimeUnit.MILLISECONDS.toSeconds(l) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(l))) == 10){ reproducirAviso(); } tiempo.setText(String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(l), TimeUnit.MILLISECONDS.toSeconds(l) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(l)))); } What is happening? The method "reproducirAviso()" is called several times and the sound is played choppy... What can I do to solve this problem? Many thanks in advance!!!
answer count: 1
has title: CountDownTimer onTick
tagged with: android
type: AnsweredQuestion
tagged with: countdowntimer
has answer: http://stackoverflow.com/a/26905933
type: Question
tagged with: audio
tagged with: java

http://stackoverflow.com/q/26810020
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/26810141
has title: Passing argument of type Double using Reflection
has comment: http://stackoverflow.com/comment/42192672
has comment: http://stackoverflow.com/comment/42192636
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42192640
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26810141
has comment: http://stackoverflow.com/comment/42192736
has body: I'm trying to use reflection in a situation where I need to pass in arguments that have a type Double. My code works perfectly when I call the function directly, but it fails when I do it via reflection with two doubles as its arguments. Here is the eror: java.lang.NoSuchMethodException: org.jinstagram.Instagram.searchMedia(java.lang.Double, java.lang.Double) Double lat = Double.parseDouble(methodArgument[0][0]); Double lng = Double.parseDouble(methodArgument[0][1]); Method m = instagram.getClass().getDeclaredMethod("searchMedia", Double.class, Double.class); Object o = (Object) m.invoke(instagram, lat, lng); Just for testing, I can call this successfully like this: Object o = instagram.searchMedia(lat, lng); so the problem must be somewhere in the use of reflection, right?
tagged with: reflection

http://stackoverflow.com/q/26826394
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42220935
has title: How to evaluate size of file in Java before creating it?
has answer: http://stackoverflow.com/a/26826440
score: -1
has comment: http://stackoverflow.com/comment/42221204
has comment: http://stackoverflow.com/comment/42220916
has comment: http://stackoverflow.com/comment/42221019
answer count: 2
has comment: http://stackoverflow.com/comment/42220965
has comment: http://stackoverflow.com/comment/42221172
upvote count: 0
has comment: http://stackoverflow.com/comment/42221072
has comment: http://stackoverflow.com/comment/42220957
favorite count: 0
has body: In my Java programm I need to create files and write in it something that i can get by Inputstream's read() method. How can I evaluate the size of file before creating it?
has comment: http://stackoverflow.com/comment/42220910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42220966
tagged with: size
has answer: http://stackoverflow.com/a/26826430
has comment: http://stackoverflow.com/comment/42220923
has comment: http://stackoverflow.com/comment/42220904
tagged with: java
tagged with: file
tagged with: inputstream

http://stackoverflow.com/comment/42001292
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26703928
has text: There isn't one target match, there are four. Read the source code (and the OP).
score: 0

http://stackoverflow.com/comment/42202465
comment on: http://stackoverflow.com/a/26815565
type: AnswerComment
score: 0
type: Comment
has text: @Mat Looks like GCC 4.9.0 got a better optimizer. I'm using 4.8.1, which does some loop transformation, but not this.

http://stackoverflow.com/a/26705637
has comment: http://stackoverflow.com/comment/42004621
score: 0
has comment: http://stackoverflow.com/comment/42005565
type: Answer
has comment: http://stackoverflow.com/comment/42004403
has comment: http://stackoverflow.com/comment/42004321
has comment: http://stackoverflow.com/comment/42005916
has comment: http://stackoverflow.com/comment/42005659
has comment: http://stackoverflow.com/comment/42004455
has comment: http://stackoverflow.com/comment/42004282
answers question: http://stackoverflow.com/q/26705580
has body: I believe the easiest approach for also sorting by score is to add a second class that implements Comparator&lt;Student&gt; like static class StudentScoreComparator implements Comparator&lt;Student&gt; { @Override public int compare(Student o1, Student o2) { return (Integer.valueOf(o1.getScores())).compareTo(o2.getScores()); } } Then you can pass an instance of that Comparator to the sort methods, and sort by score. Edit Then I would add a toString() to Student like @Override public String toString() { return String.format("%s %s %d", firstName, lastName, scores); } Edit 2 I think your main() was supposed to look like, public static void main(String[] args) { System.out.println("Welcome to the Student Scores Application."); Scanner input = new Scanner (System.in); System.out.println("Enter number of students: "); int numStudents = input.nextInt(); List&lt;Student&gt; students = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; numStudents; i++) { System.out.println("Enter Student Last Name: "); String lastName = input.nextLine(); System.out.println("Enter Student First Name: "); String firstName = input.nextLine(); System.out.println("Enter Student Score: "); int score = input.nextInt(); students.add(new Student(lastName, firstName, score)); } Collections.sort(students); System.out.println("Students in alphabetical order"); for (Student s : students) { System.out.println(s); } Collections.sort(students, new StudentScoreComparator()); System.out.println("Students by score"); for (Student s : students) { System.out.println(s); } }

listview
tags question: http://stackoverflow.com/q/26791871
tags question: http://stackoverflow.com/q/26685069
tags question: http://stackoverflow.com/q/26825373
tags question: http://stackoverflow.com/q/26794595
tag name: listview
tags question: http://stackoverflow.com/q/26783965
tags question: http://stackoverflow.com/q/26802491
tags question: http://stackoverflow.com/q/26740610
tags question: http://stackoverflow.com/q/26695923
tags question: http://stackoverflow.com/q/26700897
tags question: http://stackoverflow.com/q/26682230
tags question: http://stackoverflow.com/q/26821501
tags question: http://stackoverflow.com/q/26831043
tags question: http://stackoverflow.com/q/26682013
tags question: http://stackoverflow.com/q/26830305
tags question: http://stackoverflow.com/q/26677697
tags question: http://stackoverflow.com/q/26701709
tags question: http://stackoverflow.com/q/26726720
tags question: http://stackoverflow.com/q/26749480
tags question: http://stackoverflow.com/q/26751103
tags question: http://stackoverflow.com/q/26814614
tags question: http://stackoverflow.com/q/26684034
type: Tag
tags question: http://stackoverflow.com/q/26825021

http://stackoverflow.com/comment/42231372
type: QuestionComment
has text: Hannes i don't know the kind of jvm it uses. @owlstead excuse me "you should not do it at the front end" How can i do it?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26832008

http://stackoverflow.com/comment/42017463
has text: Show us exception trace
comment on: http://stackoverflow.com/q/26713428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42130132
has text: What problems are you currently observing?
comment on: http://stackoverflow.com/q/26773844
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26754146
has comment: http://stackoverflow.com/comment/42091398
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26754743
tagged with: multithreading
type: Question
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/42091324
has comment: http://stackoverflow.com/comment/42091304
has comment: http://stackoverflow.com/comment/42091385
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26754743
has title: Java Threads not working correctly with JTextArea
tagged with: string
favorite count: 0
has body: In Java, I am creating a login/register program at the moment (hoping to expand it in the future) but have run into a problem. I am trying to make text appear across the screen in an animated type writer styled fashion. When I run the class's main method, the text appears just fine, when I run it in a keylistener, it fails and waits for text to appear, THEN updates the frame so I can see it. Source Code Below: Login.class public class Login implements KeyListener { int BACK_WIDTH = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width; int BACK_HEIGHT = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height; JFrame back_frame = new JFrame(); LoginTerminal login = new LoginTerminal(); public Login() { back_frame.setSize(BACK_WIDTH, BACK_HEIGHT); back_frame.setLocation(0, 0); back_frame.getContentPane().setBackground(Color.BLACK); back_frame.setUndecorated(true); //back_frame.setVisible(true); back_frame.addKeyListener(this); login.addKeyListener(this); login.setLocationRelativeTo(null); login.setVisible(true); login.field.addKeyListener(this); login.slowPrint("Please login to continue...\n" + "Type 'help' for more information.\n"); } public void keyPressed(KeyEvent e) { int i = e.getKeyCode(); if(i == KeyEvent.VK_ESCAPE) { System.exit(0); } if(i == KeyEvent.VK_ENTER) { login.slowPrint("\nCommands\n" + "-----------\n" + "register\n" + "login\n"); } } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} } LoginTerminal.class public class LoginTerminal implements KeyListener { CustomFrame frame = new CustomFrame(Types.TERMINAL); JTextArea log = new JTextArea(); public JTextField field = new JTextField(); public void setVisible(boolean bool) { frame.setVisible(bool); } public void addKeyListener(KeyListener listener) { frame.addKeyListener(listener); } public void slowPrint(String str) { for(int i = 0; i &lt; str.length(); i++) { log.append("" + str.charAt(i)); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace();…

servlets
tags question: http://stackoverflow.com/q/26818006
tags question: http://stackoverflow.com/q/26718042
tags question: http://stackoverflow.com/q/26683831
tags question: http://stackoverflow.com/q/26813220
tags question: http://stackoverflow.com/q/26712661
tags question: http://stackoverflow.com/q/26801038
tags question: http://stackoverflow.com/q/26757481
tags question: http://stackoverflow.com/q/26748341
tags question: http://stackoverflow.com/q/26802337
tags question: http://stackoverflow.com/q/26735814
tags question: http://stackoverflow.com/q/26770791
tags question: http://stackoverflow.com/q/26692480
tags question: http://stackoverflow.com/q/26820700
tags question: http://stackoverflow.com/q/26735147
tags question: http://stackoverflow.com/q/26801958
tags question: http://stackoverflow.com/q/26773709
tags question: http://stackoverflow.com/q/26798485
tags question: http://stackoverflow.com/q/26769641
tags question: http://stackoverflow.com/q/26708782
tags question: http://stackoverflow.com/q/26719177
tags question: http://stackoverflow.com/q/26770991
tags question: http://stackoverflow.com/q/26767782
tags question: http://stackoverflow.com/q/26698454
tags question: http://stackoverflow.com/q/26820393
tags question: http://stackoverflow.com/q/26739223
tags question: http://stackoverflow.com/q/26773975
tags question: http://stackoverflow.com/q/26680217
tags question: http://stackoverflow.com/q/26702873
tags question: http://stackoverflow.com/q/26770380
tags question: http://stackoverflow.com/q/26687552
tags question: http://stackoverflow.com/q/26755318
tags question: http://stackoverflow.com/q/26714751
tags question: http://stackoverflow.com/q/26787201
tags question: http://stackoverflow.com/q/26782254
tags question: http://stackoverflow.com/q/26817059
tags question: http://stackoverflow.com/q/26771104
tags question: http://stackoverflow.com/q/26676951
tags question: http://stackoverflow.com/q/26736521
tags question: http://stackoverflow.com/q/26752721
tags question: http://stackoverflow.com/q/26719754
tags question: http://stackoverflow.com/q/26763039
tags question: http://stackoverflow.com/q/26745525
tags question: http://stackoverflow.com/q/26749661
tags question: http://stackoverflow.com/q/26745644
tags question: http://stackoverflow.com/q/26673956
tags question: http://stackoverflow.com/q/26794908
tags question: http://stackoverflow.com/q/26793446
tags question: http://stackoverflow.com/q/26795429
tags question: http://stackoverflow.com/q/26732973
tags question: http://stackoverflow.com/q/26740414
tags question: http://stackoverflow.com/q/26725806
tags question: http://stackoverflow.com/q/26691399
tags question: http://stackoverflow.com/q/26713270
tags question: http://stackoverflow.com/q/26721810
tags question: http://stackoverflow.com/q/26751307
tags question: http://stackoverflow.com/q/26699606
tags question: http://stackoverflow.com/q/26708130
tags question: http://stackoverflow.com/q/26749793
tag name: servlets
tags question: http://stackoverflow.com/q/26699019
tags question: http://stackoverflow.com/q/26709627
type: Tag
tags question: http://stackoverflow.com/q/26774369
tags question: http://stackoverflow.com/q/26768208
tags question: http://stackoverflow.com/q/26714735
tags question: http://stackoverflow.com/q/26782063
tags question: http://stackoverflow.com/q/26757591
tags question: http://stackoverflow.com/q/26717662
tags question: http://stackoverflow.com/q/26693496
tags question: http://stackoverflow.com/q/26727400
tags question: http://stackoverflow.com/q/26795838
tags question: http://stackoverflow.com/q/26673072
tags question: http://stackoverflow.com/q/26684970
tags question: http://stackoverflow.com/q/26706987
tags question: http://stackoverflow.com/q/26796457
tags question: http://stackoverflow.com/q/26699090
tags question: http://stackoverflow.com/q/26693073
tags question: http://stackoverflow.com/q/26718165
tags question: http://stackoverflow.com/q/26752362

http://stackoverflow.com/comment/72210219
comment on: http://stackoverflow.com/q/26675048
type: Comment
type: QuestionComment
has text: URL.getFile() *does not* convert a URL into a valid file path. It merely returns the path portion of the URL. (In the days of Java 1.0, most URLs referred to physical files; that is why the method is named getFile.)
score: 0

http://stackoverflow.com/comment/42128287
type: QuestionComment
score: 1
has text: Your `settings` object should probably be of type `JsonNode` which is part of Jackson and then your deserialization should work fine.
comment on: http://stackoverflow.com/q/26767769
type: Comment

http://stackoverflow.com/a/53946876
type: Answer
has comment: http://stackoverflow.com/comment/139442338
answers question: http://stackoverflow.com/q/26729016
has comment: http://stackoverflow.com/comment/139442335
score: 0
has comment: http://stackoverflow.com/comment/111142630
has comment: http://stackoverflow.com/comment/111142581
has body: 1st you need to run Nutch as a server by downloading and extract Nutch and then by giving the command, bin/nutch startserver After that you can use a REST client like RestTemplate in Java and call required APIs. Following is the documentation for all the REST APIs provided by Nutch. https://cwiki.apache.org/confluence/display/NUTCH/Nutch+1.X+RESTAPI+RunningJobsTutorial

http://stackoverflow.com/comment/42189043
type: QuestionComment
comment on: http://stackoverflow.com/q/26807986
score: 0
type: Comment
has text: do you mean empty like "..."="" or is it empty like "..." contains only spaces?

http://stackoverflow.com/comment/42015600
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26711910
has text: Please see the public Key I got from Java code and the public key in the public.cert file. Just check first few characters, you can understand both are different.
score: 0

http://stackoverflow.com/comment/42148812
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26785191
has text: That's what I originally thought, but for some reason it won't allow me to. For your sake I updated op with the top of the AppConfig class to give you a better understanding of whats going on
type: AnswerComment

http://stackoverflow.com/comment/129584641
comment on: http://stackoverflow.com/a/32923234
score: 0
has text: Interesting, have you implemented another subclass of Page? Because as far as I have seen the TotalPage Property of PageImpl always returns the number of elements passed in the collection seem not right for me and would be simple to solve as I think
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26723766
type: Answer
score: 2
downvote count: 0
has body: 1) Download and copy your font (yourfont.ttf) file in the assets folder of your project 2) In your Activity/Fragment use the following code to load the font Typeface yourfont = Typeface.createFromAsset(getAssets(), "fonts/yourfont.ttf"); 3) Find your TextView(or any other view on which you want to set this font) and use the setTypeface method of the View. eg. TextView textview1 = (TextView) findViewById(R.id.exampletextview); textview1.setTypeface(yourfont); This of course comes with a drawback, that if there are a lot of views you want to apply the font to you would have manually setTypeface for each of the view. In that case you can make a custom view by extending the Textview class. Something like the code below : public class MyTextView extends TextView { public MyTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public MyTextView(Context context) { super(context); init(); } public void init() { Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/yourfont.ttf"); setTypeface(tf ,1); } } and use this in xml as &lt;com.yourpackagename.MyTextView /&gt;
answers question: http://stackoverflow.com/q/26722716
upvote count: 2

http://stackoverflow.com/a/41055677
score: 7
has body: On compileSdkVersoin 25, you could do this: styles.xml
answers question: http://stackoverflow.com/q/26788464
type: Answer
downvote count: 2
upvote count: 9

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/26799171
tags question: http://stackoverflow.com/q/26830100
tags question: http://stackoverflow.com/q/26716029
tag name: android-actionbar
tags question: http://stackoverflow.com/q/26760393

http://stackoverflow.com/comment/42109799
comment on: http://stackoverflow.com/a/26761304
has text: thank u for the answer, I edited the post. If I use threads, then how could I change waiting time in setTimeForState method?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26724443
has comment: http://stackoverflow.com/comment/42038709
has comment: http://stackoverflow.com/comment/42117494
favorite count: 0
has comment: http://stackoverflow.com/comment/42038723
tagged with: memory-model
has comment: http://stackoverflow.com/comment/42038560
has comment: http://stackoverflow.com/comment/42118303
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42131284
has comment: http://stackoverflow.com/comment/42131953
has comment: http://stackoverflow.com/comment/42097649
has comment: http://stackoverflow.com/comment/42038385
has comment: http://stackoverflow.com/comment/42038494
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42038681
downvote count: 0
has body: I have a question regarding the Java Memory Model. Given the following example: action 1 action 2 synchronized(monitorObject) { //acquire action 3 } //release action 4 acquire and release can be any synchronizes-with edge (lock, unlock, start thread, join thread, detect thread interruption, volatile-write, volatile-read, etc.) Is it guaranteed that action 3 can't be moved before the acquire and can't be moved after the release? And is it guaranteed that action 2 can't be moved after the acquire (neither before nor after the release) and that action 4 can't be moved before the release (neither before nor after the acquire)? So are synchronizes-with edges "bidirectional barriers" for the compiler's re-ordering actions? EDIT 1 I am concerned about this because if synchronizes-with edges were not bidirectional re-ordering barriers, the compiler could simply create a deadlock by moving lock acquires into others. Or are bidirectional re-ordering barriers not even necessary to prevent this because lock acquires can't be pushed into others because that would change the synchronization order? EDIT 2 The actions 1, 2, 3 and 4 are "inter-thread actions" as defined by the JMM. EDIT 3 Here's an example that shows how reordering might cause a deadlock: x and y are shared variables and syncA and syncB may be acquired by any other thread. But with the following code, there is no deadlock possible. /* 1 */ synchronized(syncA) { /* 2 */ x = 1; /* 3 */ } /* 4 */ y = 0; /* 5 */ synchronized(syncB) { /* 6 */ y = 1; /* 7 */ } If, however, the acquire of syncA is reordered into the syncB block this might cause a deadlock: y = 0; synchronized(syncB) { y = 1; synchronized(syncA) { x = 1; } } I think this is not a legal compiler transformation, because it would change the synchronization order. Am I right with this assumption? What part of the Java Memory Model (JMM) allows/disallows this?
tagged with: java
has answer: http://stackoverflow.com/a/26786714
has comment: http://stackoverflow.com/comment/42100910
accepted answer: http://stackoverflow.com/a/26786714
has comment: http://stackoverflow.com/comment/42038607
type: Question
linked to: http://stackoverflow.com/q/19215948
tagged with: java-memory-model
has title: Are synchronizes-with edegs compiler re-ordering barriers in both directions?
has comment: http://stackoverflow.com/comment/42117918
has comment: http://stackoverflow.com/comment/42050563
has comment: http://stackoverflow.com/comment/42038472
score: 10
tagged with: compiler-optimization
has comment: http://stackoverflow.com/comment/42038572
has comment: http://stackoverflow.com/comment/42038443
upvote count: 10
answer count: 1

http://stackoverflow.com/comment/42177814
score: 0
type: AnswerComment
type: Comment
has text: Maven sorts out everything in the src/main/resources folder, and therefor by inharitance, the META-INF folder. Adding META-INF might be correct, but I also had to change my "configuration.xml" to "META-INF/configuration.xml", and it still would not work...
comment on: http://stackoverflow.com/a/26801543

http://stackoverflow.com/comment/42218415
has text: "boost results based on the previous search terms" note that there may very different searches that user might have provided for example iphone and TV. boosting TV when the user types in iphone may not be appropriate.
type: QuestionComment
comment on: http://stackoverflow.com/q/26819705
score: 0
type: Comment

http://stackoverflow.com/q/26805019
answer count: 1
favorite count: 0
tagged with: ftp
has body: I am using apache.commons.net library for ftp download. In this documentation, it states To ensure correct operation with all servers, always specify the appropriate file type after connecting to the server. It does provide FTPClient.setFileType function to set File Type. But how do I know if the FTP server use ASCII or Binary? Is there a function to get the FTP server File Type? Or we just try different file types and see which one works? THanks
has title: Apache Commons Net get FTP server's File Type
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26805110
type: Question
tagged with: apache-commons-net
downvote count: 0
accepted answer: http://stackoverflow.com/a/26805110

http://stackoverflow.com/comment/41981282
has text: Yes, you run programs in eclipse "run as", then the configuration is done or you can run Java programs from the editor (class with the main method) with alt + shift + x, j. And later you have a green button with a white arrow and there you can select the configuration and run it.
type: Comment
comment on: http://stackoverflow.com/a/26692417
score: 0
type: AnswerComment

http://stackoverflow.com/a/26783075
has comment: http://stackoverflow.com/comment/42248757
has comment: http://stackoverflow.com/comment/42166245
has comment: http://stackoverflow.com/comment/42143996
answers question: http://stackoverflow.com/q/26783000
score: 5
downvote count: 0
has body: Let's dig a bit into how the enhanced for loop works on the background. for (String s : list) { .. } is actually translated to: for (Iterator&lt;String&gt; iter = list.iterator(); iter.hasNext();) { String s = iter.next(); .. s = "QQQ"; } As you can see, passing a new reference to the s variable, just changes it for the scope of the loop, which doesn't have any effect on the list entry. If you need to modify the current element that's being handled by the iterator, working with ListIterator makes it very easy: for (ListIterator&lt;String&gt; iter = list.listIterator(); iter.hasNext();) { String s = iter.next(); .. iter.set("QQQ"); } Note that before iter.set(...), we need to call iter.next().
has comment: http://stackoverflow.com/comment/42147781
has comment: http://stackoverflow.com/comment/42173275
type: Answer
upvote count: 5

http://stackoverflow.com/a/26767954
answers question: http://stackoverflow.com/q/26767782
has body: If someplace in a servlet an invocation of out.println(...) writes to the response object, then out must be a reference to the response object's OutputStream, or a wrapper stream and it. If System.out sends output someplace else (as normally it would do) then it is a reference to a different OutputStream. A servlet method's (or any other method's) local variable named out is completely unrelated to System.out, barring you initializing the one as a reference to the other.
type: Answer
has comment: http://stackoverflow.com/comment/42116902
score: 0
has comment: http://stackoverflow.com/comment/42117308

http://stackoverflow.com/comment/42149152
score: 0
type: Comment
has text: Compiling the class doesn't automatically add it to the classloader. You'll need to do that yourself.
type: QuestionComment
comment on: http://stackoverflow.com/q/26786172

http://stackoverflow.com/q/26715148
type: AnsweredQuestion
has body: I have large number of various XML documents I need to ingest into MongoDB using Groovy. Now I have problem that there isn't any generic way to convert any XML into Object based on some simple rules, at least I can't find any. What I would like to do, take any random XML, and create object which will contain timestamps, integers, strings as well maps, basically it would be all decomposed based on the XML structure. For example, to do it in PHP, is to convert it into JSon, and from JSon into Object. Now I would like to add some converters that for certain elements in XML I would run little routine to e.g. convert timestamps, and I would like to also map certain values as integers, intervals and so on. I looked on XStream but it requires me to create Object definition for each XML, otherwise it throws "unresolvable" exception. Is there better way than to do it manually? In Groovy iterating thru XML is not really very fast, I would prefer to use some Java library to do it, even if it's quite of dynamic style operation. Analogue tool for logfiles is called LogStash. It can have embedded JRuby evaled code in config to convert certain fields of logfiles like timestamps and ingest them into elastic search as object documents.
tagged with: java
has comment: http://stackoverflow.com/comment/42026265
has answer: http://stackoverflow.com/a/26721315
type: Question
tagged with: mongodb
tagged with: xstream
has comment: http://stackoverflow.com/comment/42023813
answer count: 1
has title: How to convert XML to Object in Groovy and insert into MongoDB collection?
tagged with: groovy
accepted answer: http://stackoverflow.com/a/26721315
tagged with: http://stackoverflow.com/tag/xml
score: 0

http://stackoverflow.com/a/26726753
answers question: http://stackoverflow.com/q/26726615
score: 0
type: Answer
has body: You should first declare a new pickNumbers object pickNumbers myPickNumbers = new pickNumbers(); Then you can call the pickNumbers() method but you have to include a parameter of type int e.g float[] myFloats = myPickNumbers.pickNumbers(5)

apache
tags question: http://stackoverflow.com/q/26737284
tag name: apache
tags question: http://stackoverflow.com/q/26700632
tags question: http://stackoverflow.com/q/26819605
tags question: http://stackoverflow.com/q/26707676
tags question: http://stackoverflow.com/q/26830987
tags question: http://stackoverflow.com/q/26770366
tags question: http://stackoverflow.com/q/26719946
tags question: http://stackoverflow.com/q/26710658
tags question: http://stackoverflow.com/q/26792813
tags question: http://stackoverflow.com/q/26769412
tags question: http://stackoverflow.com/q/26794633
tags question: http://stackoverflow.com/q/26718956
tags question: http://stackoverflow.com/q/26727423
tags question: http://stackoverflow.com/q/26801672
tags question: http://stackoverflow.com/q/26783615
tags question: http://stackoverflow.com/q/26790072
tags question: http://stackoverflow.com/q/26673056
tags question: http://stackoverflow.com/q/26755693
type: Tag
tags question: http://stackoverflow.com/q/26784169
tags question: http://stackoverflow.com/q/26730051
tags question: http://stackoverflow.com/q/26749661
tags question: http://stackoverflow.com/q/26819626
tags question: http://stackoverflow.com/q/26772188
tags question: http://stackoverflow.com/q/26805261
tags question: http://stackoverflow.com/q/26777139
tags question: http://stackoverflow.com/q/26769498
tags question: http://stackoverflow.com/q/26761717
tags question: http://stackoverflow.com/q/26829424
tags question: http://stackoverflow.com/q/26680184

http://stackoverflow.com/comment/42128320
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26774388
has text: Good news. But in the future don't pass the parameters to fragment's constructor :)

http://stackoverflow.com/comment/42026699
comment on: http://stackoverflow.com/a/26717279
score: 0
type: AnswerComment
has text: That seems highly unlikely, unless you have a very strange setup. Java 8 (JDK 1.8.0) comes with JavaFX 8 already included. Can you do `System.out.println(System.getProperty("javafx.version"));` to confirm that. If you are really using JavaFX 2.0 you need to fix your project setup.
type: Comment

http://stackoverflow.com/comment/66240926
has text: How do you do that on Fedora? (Seems like maybe you could answer your own question now: http://stackoverflow.com/questions/27475902/fedora-21-javafx-not-creating-mediaplayer )
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/31055232
type: Comment

http://stackoverflow.com/comment/42208190
type: QuestionComment
has text: @Monty Give a minute, I'll write you an "anwer" that will give you a guideline on how to achieve your goal. But it won't contain the whole code.
comment on: http://stackoverflow.com/q/26818478
score: 0
type: Comment

http://stackoverflow.com/comment/42236685
comment on: http://stackoverflow.com/a/26822139
has text: I edited my answer. The `.add` method should work, have a look at the examples in the edit. Hope it helps!
score: 0
type: AnswerComment
type: Comment

web.xml
tags question: http://stackoverflow.com/q/26718042
tag name: web.xml
type: Tag
tags question: http://stackoverflow.com/q/26694109
tags question: http://stackoverflow.com/q/26769641
tags question: http://stackoverflow.com/q/26755318
tags question: http://stackoverflow.com/q/26764928
tags question: http://stackoverflow.com/q/26789165

http://stackoverflow.com/q/26701056
has answer: http://stackoverflow.com/a/26701206
has answer: http://stackoverflow.com/a/26701079
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41995717
tagged with: java
has comment: http://stackoverflow.com/comment/41995969
has body: I have a two-dimensional boolean array 'poorSignal' and need to write a method that returns a grid, where if a point on the array is true an X is displayed, if false a O is displayed. Here is my code: public String display() { for(int i = 0; i &lt; mapSize; i++) { for(int j = 0; j &lt; mapSize; j++) { if(poorSignal[i][j] = true) { return "O "; } else { return "X "; } } return "\n"; } } When I compile, it gives me 'missing return statement' on the very last line of the method. I am also unsure if the 'return "\n" will work to add a new line when printing the array. It's a question for an assignment, so I can't print it directly or just print the boolean values - it must be a method that produces the grid.
has comment: http://stackoverflow.com/comment/41995735
type: Question
answer count: 3
accepted answer: http://stackoverflow.com/a/26701079
tagged with: arrays
has comment: http://stackoverflow.com/comment/41995690
has comment: http://stackoverflow.com/comment/41995919
has comment: http://stackoverflow.com/comment/41995707
has comment: http://stackoverflow.com/comment/41995702
score: 0
has title: Missing return statement with for loop
possible better answer: http://stackoverflow.com/a/26701104
has comment: http://stackoverflow.com/comment/41995760
has answer: http://stackoverflow.com/a/26701104
has comment: http://stackoverflow.com/comment/41995867

http://stackoverflow.com/comment/42106579
score: 0
comment on: http://stackoverflow.com/q/26762608
type: Comment
type: QuestionComment
has text: One way would be to create a new String from the resulting three, and make all the characters in lower case except the first one. Then print this String.

http://stackoverflow.com/comment/42065423
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26739608
score: 1
has text: @Kevin: Sorry I wouldn't go for the Singleton here as a.) there is no use/need and b.) the testability of your design is reduced by the singleton. Suppose you want to introduce a World Mock-Object for Unit Tests. You can't just replace the real World Object with a Mock because it's hardwired in your Bug class. That's where inversion of control comes into play (http://en.wikipedia.org/wiki/Inversion_of_control). If your Bug objects get a World Object set from outside than you can easily create different implementations for World that your Bugs can use.

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

http://stackoverflow.com/comment/42078264
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26746435
has text: Please post a small compilable runnable program that we can test, and [mcve](http://stackoverflow.com/help/mcve). Uncompilable snippets are usually worthless. You're asking "why isn't my code working?", well please let us find out.
type: QuestionComment

http://stackoverflow.com/q/26772523
has comment: http://stackoverflow.com/comment/42124925
has title: rsyslog taking huge memory
has body: I am using rsyslog to send messages to remote machines over TCP. A java service is writing to a logger in syslog named local4. The memory sage starts from 1MB and grows till 4-5GB. I am not sure how to debug this issue and figure out what in Rsyslog is taking so much memory and how it can be reduced. Below is my rsyslog.conf: $ModLoad imuxsock # provides support for local system logging $ModLoad imklog # provides kernel logging support $ModLoad imudp $UDPServerRun 514 $KLogPermitNonKernelFacility on $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat $RepeatedMsgReduction on $FileOwner syslog $FileGroup adm $FileCreateMode 0640 $DirCreateMode 0755 $Umask 0022 $PrivDropToUser syslog $PrivDropToGroup syslog auth,authpriv.* /var/log/auth.log *.*;auth,authpriv.none,local4.none -/var/log/syslog mail.* -/var/log/mail.log $template RTFormat,"%msg%\n" $WorkDirectory /var/lib/rsyslog # where to place spool files $ActionQueueFileName fwdRuleRTLogs1 # unique name prefix for spool files $ActionQueueMaxDiskSpace 1g # 4gb space limit (use as much as possible) $ActionQueueSaveOnShutdown on # save messages to disk on shutdown $ActionQueueType LinkedList # run asynchronously $ActionResumeRetryCount -1 # infinite retries if host is down $MaxMessageSize 5k local4.* @@internal-elb.amazonaws.com:5149;RTFormat Any help would be great.
has answer: http://stackoverflow.com/a/28834196
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42125831
tagged with: java
tagged with: rsyslog
type: Question
has comment: http://stackoverflow.com/comment/42125954
score: 0
answer count: 1

http://stackoverflow.com/a/26762188
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 2
has body: The problem is that the error occurs when the class is loaded, so you'd either have to use a "starter app" which starts the actual application in a separate process or dynamically load the application after the Java version has been checked. I didn't test it but what might work is something like this: public static void main(String args[]) { if( javaVersionOk ) { Class.forName("actual.mainclass.name").getMethod("actual.main.method.name").invoke(); } } The idea is to access the class via its name and thus make the runtime load and initialize it at that time. I'm not sure, however, if you can delay class loading like that in all cases so you'd have to go on from there. And btw, IIRC there already are applications/libraries that provide this kind of functionality, I just don't rember their names. So a search might be worth your while. Edit: you might want to have a look at appstart if not for using it then for inspiration. Another launcher would be Apache Commons Launcher. Alternatives: Alternatively you could just provide a launch script for each platform you want to support , call java -version and check the returned version before launching the application. Another alternative would be to use JNLP/WebStart locally, which allows you to specify a minimum version and which AFAIK even provides for download/upgrade functionality.
accepted answer of: http://stackoverflow.com/q/26762014
upvote count: 2
answers question: http://stackoverflow.com/q/26762014

http://stackoverflow.com/a/26724973
answers question: http://stackoverflow.com/q/26724632
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42039737
has comment: http://stackoverflow.com/comment/42039754
has comment: http://stackoverflow.com/comment/42039633
has comment: http://stackoverflow.com/comment/42039563
has body: You're missing an .account.contactsync in your component name: ComponentName cName = new ComponentName("com.myapp", "com.myapp.account.contactsync.ContactsSyncAdapterService"); And you'd need to use startService() instead of startActivity() - startActivity() only starts activities.

http://stackoverflow.com/comment/41998854
type: AnswerComment
score: 0
type: Comment
has text: Oh! I just noticed: "/Sprite_Sheet.png". The leading slash means it will look at the very root of your filesystem.
comment on: http://stackoverflow.com/a/26702620

http://stackoverflow.com/a/26730435
type: AcceptedAnswer
type: Answer
has body: Well, it seems that Pair is a class that you have defined, since it is not one of the standard Hadoop Writable classes. The problem is that you do not import it, as Jon Skeet mentions in his comment. However, keep in mind, that since you are using it as a reduce output value, it should also be a class that implements the Writable interface.
answers question: http://stackoverflow.com/q/26719946
accepted answer of: http://stackoverflow.com/q/26719946
score: 0

http://stackoverflow.com/a/26789016
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26757276
score: 5
type: Answer
answers question: http://stackoverflow.com/q/26757276
has body: I think is better using channelSftp.get(String src, OutputStream dst); it is more easy and the method implementation controls the server streams for you. Hope this helps.
upvote count: 5

http://stackoverflow.com/comment/42120865
type: QuestionComment
comment on: http://stackoverflow.com/q/26770030
score: 0
has text: It wont let me insert code, but anyways I get how to do that guys, seriously! I don't need tutorials about inheritance and Swing and GUI's I understand how to do these things. My only issue is doing this in ONE class, I don't know how. How to use user input with drawing images, all in one class. This baffles me.
type: Comment

http://stackoverflow.com/q/26826486
possible better answer: http://stackoverflow.com/a/26826512
downvote count: 0
has answer: http://stackoverflow.com/a/26826500
favorite count: 0
has answer: http://stackoverflow.com/a/26826510
has comment: http://stackoverflow.com/comment/42221109
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26826583
score: 1
tagged with: java
has title: How to use the boolean contains(CharSequence s) method in Java?
upvote count: 1
accepted answer: http://stackoverflow.com/a/26826583
type: Question
has answer: http://stackoverflow.com/a/26826512
has body: How do I pass my desired sequence ('admin') to contains method? class containstest { public static void main( String [] args) { System.out.println("Enter string"); Scanner S = new Scanner (System.in); String s = S.next(); char A = 'admin' ; boolean flag; flag = s.contains(CharSequence A); if (flag == true) { System.out.println("Admin mode"); } else { system.out.println("customermode"); } } }

http://stackoverflow.com/a/26675160
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26674973
upvote count: 1
has comment: http://stackoverflow.com/comment/41949811
answers question: http://stackoverflow.com/q/26674973
type: AcceptedAnswer
downvote count: 0
has body: You cant do this the way you have done it. The main reason for this is that you are defining your onClickListener in your onCreateView checking the values of stringat integers. Implement your onClickListener and inside check stringat values as follows. kerko.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getActivity(),("stringu= "+Stringat.int1+" stringu2="+Stringat.int2+""),Toast.LENGTH_SHORT).show(); if(Stringat.int1 == 1 &amp;&amp; Stringat.int2 == 1) linjaText.setText("Linja 5"); } }); linjaeDuhur.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getActivity(),("stringu= "+Stringat.int1+" stringu2="+Stringat.int2+""),Toast.LENGTH_SHORT).show(); if(Stringat.int1 == 1 &amp;&amp; Stringat.int2 == 1) { Intent i = new Intent (getActivity(), Linja.class); startActivity(i); } } }); Please tell me if I did not answer your question, your var names are somekind weird :D Hope it helps

http://stackoverflow.com/q/26737904
downvote count: 0
has answer: http://stackoverflow.com/a/26738107
favorite count: 0
has comment: http://stackoverflow.com/comment/42070447
has comment: http://stackoverflow.com/comment/42063325
type: AnsweredQuestion
score: 1
has title: Thread synchronized block with Class itself
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26738107
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42063278
has body: I thought that following usage is to create a synchronized-block because ThreadMyClass.class is unique. But When I have created a heavy traffic with multiple Threads trying to access get() method, I have found out that many inconsistent states were created. So why threads are not synchronized with ThreadMyClass.class instance? public ThreadMyClass { public Object get(){ synchronized (ThreadMyClass.class) { //get object return } } } public static final Object lock = new Object(); When I have changed ThreadMyClass.class with lock object , everything is working fine. updated: here is my full code portion instance creation block is invoked more than one time. public static XmppInterface getInstance() throws XMPPException { if (instance == null) { synchronized (XmppInterface.class) { if (instance == null) { //create an instance } } } return instance; }
has comment: http://stackoverflow.com/comment/42062104
answer count: 1

http://stackoverflow.com/comment/42021754
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26715406
type: Comment
has text: The converter itself doesn't know what to do with the file, only the code after the call knows. I can drop it into a temp file and return an FileInputStream of the file but that's inefficient.

http://stackoverflow.com/comment/42124777
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26754743
has text: Okay, trying using `((Timer)e.getSource()).stop();` instead ;) (inside the `ActionListener`)
type: AnswerComment

http://stackoverflow.com/comment/41957531
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26679200
has text: I assume you mean that your `while`-loop is not terminating. Did you debug it? In which situations does it happen?
score: 0

http://stackoverflow.com/comment/42159272
has text: "Such a name must not contain any of the ASCII characters . ; [ / < > : [...] but may contain characters that must not appear in an identifier in the Java programming language (JLS §3.8)". Wow, this sentence was the one I was looking for!
score: 0
comment on: http://stackoverflow.com/a/26791466
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26796580
upvote count: 1
has title: jquery autcomplete from server side spring mvc
has answer: http://stackoverflow.com/a/26796868
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26797291
tagged with: spring
has body: //this is my jsp page, i need autocomplete for text box name=empid. &lt;div class="topcorner" align="right" &gt; &lt;form action="search.htm" method="POST"&gt; EmpId : &lt;input type="text" name="empid" id="EmpId"&gt; Start Date :&lt;input type="text" name="stDate" /&gt; End Date :&lt;input type="text" name="enDate" /&gt; &lt;br&gt; &lt;input type="submit" value="Search" name="submit" &gt;&lt;br&gt; &lt;/form&gt; //My controller method is below @RequestMapping(value= "/getEmpid", method = RequestMethod.GET ) public @ResponseBody List&lt;UserAttendance&gt; autoComplete(@RequestParam("term") String empId, @RequestParam("extra") String extra) { List&lt;UserAttendance&gt; getEmp = adminService.autoComplete(empId); return getEmp; } //service implementation method is public List&lt;UserAttendance&gt; autoComplete(String empId) { List&lt;UserAttendance&gt; getEmpid = adminDao.autoComplete(empId); for(UserAttendance emp : getEmpid ) { if(emp.getEmpId().contains(empId)){ getEmpid.add(emp); } } return getEmpid; } //Dao implementation method is @Override public List&lt;UserAttendance&gt; autoComplete(String empId) { // TODO Auto-generated method stub String sql = "SELECT EMP_ID FROM attendance WHERE EMP_ID LIKE '%?%'"; List&lt;UserAttendance&gt; getEmp = getSimpleJdbcTemplate().query(sql, ParameterizedBeanPropertyRowMapper.newInstance(UserAttendance.class), empId); return getEmp; } i am fresher to java spring. I have searched lot of js but not get proper one. Can any one help me a good jquery method pls.
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: jquery
favorite count: 0

http://stackoverflow.com/comment/41963496
type: Comment
has text: what is database column type for votersName, age,state and votersId? Check it again.
score: 0
comment on: http://stackoverflow.com/q/26682265
type: QuestionComment

http://stackoverflow.com/comment/42040893
type: Comment
comment on: http://stackoverflow.com/q/26725497
score: 0
type: QuestionComment
has text: so show us the entire html including the text you want to find

http://stackoverflow.com/comment/41954728
score: 0
has text: I am sorry that I don't say clearly.the character 7 is at index 4.The character in index 4 may be 8 or 9. Then I get the substring of the protocol which length of the substring is the value of index 4.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26673885

http://stackoverflow.com/comment/42024992
type: QuestionComment
has text: this is a pretty standard request, you should easily be able to find stuff in the internet. Did you try something yet?
comment on: http://stackoverflow.com/q/26717422
score: 4
type: Comment

http://stackoverflow.com/q/26774063
has comment: http://stackoverflow.com/comment/42127340
answer count: 1
has answer: http://stackoverflow.com/a/26774388
score: 0
tagged with: android
has title: Please help me with Instance
type: UnansweredQuestion
has body: I have two buttons "start hotel1" and "start hotel2". when you click on them, I create a fragment in which ViewPager: public class PagerContainer extends Fragment { static final int PAGE_COUNT = 2; private String hotel; public PagerContainer(String hotel) { this.hotel = hotel; } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.pager_container, null); ViewPager pager = (ViewPager) v.findViewById(R.id.pager); PagerAdapter pagerAdapter = new MyFragmentPagerAdapter(getActivity().getSupportFragmentManager()); pager.setAdapter(pagerAdapter); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { Log.d("LOG", "onPageSelected, position = " + position); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageScrollStateChanged(int state) { } }); return v; } private class MyFragmentPagerAdapter extends FragmentPagerAdapter { public MyFragmentPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return CalendarView.newInstance(position,hotel); } @Override public int getCount() { return PAGE_COUNT; } @Override public CharSequence getPageTitle(int position) { return "title"; } } } I load it in another fragment that takes different parameters, depending on the button: public class CalendarView extends Fragment { static final String ARGUMENT_PAGE_NUMBER = "arg_page_number"; static final String ARGUMENT_HOTEL = "arg_hotel"; private int pageNumber; private String hotel; static CalendarView newInstance(int page,String hotel) { Log.d("myLOG","newInstance"); CalendarView calendarView = new CalendarView(); Bundle arguments = new Bundle(); arguments.putInt(ARGUMENT_PAGE_NUMBER, page); arguments.putString(ARGUMENT_HOTEL, hotel); calendarView.setArguments(arguments); return calendarView; } public View onCreateView(Layout…
tagged with: java
type: Question

http://stackoverflow.com/comment/42211197
comment on: http://stackoverflow.com/a/26819835
type: Comment
has text: Thanks @tom my last 2 points are clear but is String.replace('g','G') on left hand side of assignment operator is different from one on the right hand side? is it not one object in a string pool?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42218046
comment on: http://stackoverflow.com/a/26824499
has text: Somehow " type `/*` and then `enter`" isn't doing anything more than literally " typing `/*` and then `enter`". I'm used to editingon Vim though so I have been typing `/**/` and `enter` in the middle of it for last couple of days when I started so may it be possible that Eclipse took note of it and changed its behaviour? Is it programmed to do stuff like that? Thank you for the customization link, it might be of help.
type: Comment
score: 0
type: AnswerComment

spring-boot
tags question: http://stackoverflow.com/q/26744060
tags question: http://stackoverflow.com/q/26743299
tags question: http://stackoverflow.com/q/26794198
tags question: http://stackoverflow.com/q/26677912
type: Tag
tags question: http://stackoverflow.com/q/26762820
tags question: http://stackoverflow.com/q/26780994
tags question: http://stackoverflow.com/q/26678208
tags question: http://stackoverflow.com/q/26790116
tags question: http://stackoverflow.com/q/26776227
tags question: http://stackoverflow.com/q/26761845
tags question: http://stackoverflow.com/q/26684419
tags question: http://stackoverflow.com/q/26828971
tags question: http://stackoverflow.com/q/26735605
tags question: http://stackoverflow.com/q/26790321
tags question: http://stackoverflow.com/q/26794334
tags question: http://stackoverflow.com/q/26703295
tag name: spring-boot
tags question: http://stackoverflow.com/q/26798843
tags question: http://stackoverflow.com/q/26727812
tags question: http://stackoverflow.com/q/26779486
tags question: http://stackoverflow.com/q/26819189
tags question: http://stackoverflow.com/q/26690778
tags question: http://stackoverflow.com/q/26698071
tags question: http://stackoverflow.com/q/26715130
tags question: http://stackoverflow.com/q/26820539
tags question: http://stackoverflow.com/q/26764532

http://stackoverflow.com/a/26787869
has comment: http://stackoverflow.com/comment/42196103
score: 0
has body: Have you tried the fakeClass source modification? fakeClass <include name="script-templates.java"/>
has comment: http://stackoverflow.com/comment/42197067
has comment: http://stackoverflow.com/comment/42313098
answers question: http://stackoverflow.com/q/26787825
has comment: http://stackoverflow.com/comment/42277048
type: Answer

http://stackoverflow.com/comment/42111946
has text: Hmmm, there is no file that defines what keys apply to what extensions?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26765397
score: 0

http://stackoverflow.com/comment/42146613
has text: Right, you don't have an array node, you have an object node.
score: 0
comment on: http://stackoverflow.com/q/26784730
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26828962
has body: Just add a JPA AttributeConverter that stores the "operator" field as a String or Integer. That way it doesn't matter one iota whether this other type (which isn't an Entity) doesn't have any properties of its own. You converter is then responsible for deciding what is persisted, and how it is retrieved.
score: 0
answers question: http://stackoverflow.com/q/26828270
type: Answer

http://stackoverflow.com/comment/42230872
score: 0
comment on: http://stackoverflow.com/q/26831971
has text: @john thankyou but i have. a doubt that if keyPress function holds a key then how the program executes the next line
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42153283
comment on: http://stackoverflow.com/a/26788083
score: 0
type: AnswerComment
type: Comment
has text: Whoops, after double checking everything you are right. Thanks.

http://stackoverflow.com/comment/42108014
comment on: http://stackoverflow.com/q/26748915
score: 0
type: QuestionComment
type: Comment
has text: Unfortunate that you cut of the error message. But I guess the 'illegal entry' is an unresolved dependency? I am almost certain gradle STS tooling only gives this message for that particular case. Still it would help if you gave the whole message. What that particular entry is pointing to me also help you figure out fix it. You have to determine where this dependency comes from and why its unresolved.

http://stackoverflow.com/a/26823416
type: Answer
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: You can't use two constructors simultaneously on a single object. In your code: Student sam = new Student(12, "Alpha High School", "Biology"); creates a new Student object and assigns its reference to the variable sam. On your next line: sam = new Student(154324, "Sam Bay", 3.56); This creates another Student object, separate from the first, and reassigns sam to refer to it instead. In the process, you end up orphaning the original Student and leave it open to garbage collection. What you really want to do is either pass all data required for by a Student through a single constructor, or provide getters/setters (e.g. setGradeLevel(int level)) and a layer of exceptions that prevent methods from accessing a Student object until all fields are filled. The first option is generally more sound. For example, a complete constructor would look something like this (formatted for readability): public Student(int id, int gradeLevel, String name, String school, String major, double gpa) { // fill your fields in here }
accepted answer of: http://stackoverflow.com/q/26823324
answers question: http://stackoverflow.com/q/26823324

http://stackoverflow.com/q/26751103
downvote count: 0
tagged with: simpleadapter
possible better answer: http://stackoverflow.com/a/26752658
favorite count: 0
accepted answer: http://stackoverflow.com/a/26751128
has answer: http://stackoverflow.com/a/26752658
tagged with: onactivityresult
tagged with: android
has body: I have a DialogFragment class with a custom xml layout. In onCreateView() I get reference to a button. You click it to choose file. When it's clicked two things happen: 1) It uses a layout inflater to add another xml layout into the current one 2) It initializes three variables to their values ListView, ListArray, SimpleAdapter, and these are member variables declared at the top of the class. 3) Then it calls getActivity().startActivityForResult() Problem: The three variables described above are set to null when I come back into this activity to the dialogfragment. Here is a detailed version of what's happening: //before calling startActivityForResult() I/NULLTEST SIMPLEADAPTER﹕ android.widget.SimpleAdapter@64cf1348 I/NULLTEST ATTACHMENTSLISTVIEW﹕ android.widget.ListView{64d1c2e0 VFED.VC. ......I. 0,0-0,0 #7f090014 app:id/attachmentsListView} I/NULLTEST ATTACHMENTSLISTARRAY﹕ [{a_date_added=Added: Nov 1, a_name=My test file 0}, {a_date_added=Added: Nov 2, a_name=My test file 1}, {a_date_added=Added: Nov 3, a_name=My test file 2}] // Inside onActivityResult() I/NULLTEST SIMPLEADAPTER ONRESULT﹕ null I/NULLTEST ATTACHMENTSLISTVIEW ONRESULT﹕ null I/NULLTEST ATTACHMENTSLISTARRAY ONRESULT﹕ [] This whole code is being called inside a DialogFragment. As you can see above before calling startActivityForResult() the three variables SimpleAdapter, ListView, and ArrayList are set to some value. They are all member variables thus can be called anywhere in this class. Inside onCreateView() method of DialogFragment I get reference to a button part of the dialog and attach a setOnClickListener() to the button. When this button is clicked, the three variables described above are initialized to their values and I use Log.i to log the values. The button onClick() also calls the getActivity().startActivityForResult(); to allow me to choose a file thus opening a completely different Activity. I choose the file and the onActivityResult() method of the host Activity is called which for my …
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26751128
has title: values are set to null after onActivityResult
tagged with: java
tagged with: listview
answer count: 2

http://stackoverflow.com/comment/42143657
score: 0
has text: guys stop being mean that's how it's written in the bloody test paper so i need to understand it the way it is -_-
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26783093

http://stackoverflow.com/q/26806058
tagged with: java
answer count: 2
tagged with: jaxb
upvote count: 1
has answer: http://stackoverflow.com/a/30211992
has title: Jaxb unmarshal as a singleton?
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/30211992
score: 1
favorite count: 0
has body: I have an application that loads some parameters from an xml file: JAXBContext jc = JAXBContext.newInstance(MyParams.class); Unmarshaller u = jc.createUnmarshaller(); MyParams obj = (MyParams) u.unmarshal(inputStream); I would like to make MyParams Singleton, is it possible? How?
possible better answer: http://stackoverflow.com/a/26807170
type: Question
has answer: http://stackoverflow.com/a/26807170
linked to: http://stackoverflow.com/q/26439184

http://stackoverflow.com/comment/41981884
type: AnswerComment
has text: Again, not exactly what the OP wants.
score: 0
comment on: http://stackoverflow.com/a/26693173
type: Comment

http://stackoverflow.com/comment/42144138
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26783388
has text: You have my request backwards, I want to know how to run Jetty without MAVEN

http://stackoverflow.com/a/26772800
accepted answer of: http://stackoverflow.com/q/26772689
has body: stored procedure should return error code if some operation fails but if stored procedure itself fail than catching SQLException is only choice.
answers question: http://stackoverflow.com/q/26772689
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/a/26685765
score: 1
answers question: http://stackoverflow.com/q/26685725
has comment: http://stackoverflow.com/comment/41969845
upvote count: 1
type: Answer
has body: You're on the right track -- one search term you might want to add is "canonical." I believe the ICU project is the most robust open source software that's handled this. Take special interest in the normalization components, particularly the implementations of NFKC_Casefold, which handle the German ß example among many others.
downvote count: 0

http://stackoverflow.com/a/26747718
has comment: http://stackoverflow.com/comment/42080524
downvote count: 0
answers question: http://stackoverflow.com/q/26747610
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42080454
has comment: http://stackoverflow.com/comment/42080409
has comment: http://stackoverflow.com/comment/42080445
type: Answer
has comment: http://stackoverflow.com/comment/42080458
has body: A possible solution is to wrap the label text in HTML tags and allow the underlying layout manager the ability to resize it, for example... import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Test100 { public static void main(String[] args) { new Test100(); } public Test100() { 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 { private JLabel label; private JTextField textField; public TestPane() { label = new JLabel(" Hello fellow stack-overflowers, I want to format this output "); textField = new JTextField(10); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; add(label); gbc.gridx = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; add(textField, gbc); } } } This example goes out of it's way to pressure the label to split, you might need to play around with the values a little...

http://stackoverflow.com/a/26725591
has body: I'm guessing you get a NullPointerException because pizza01 is not initialized. Initialize it with some default values and then set its attributes as in your first snippet.
answers question: http://stackoverflow.com/q/26725556
score: 0
type: Answer

http://stackoverflow.com/comment/42021471
has text: semicolon at the end of the sql may cause the problem
type: Comment
comment on: http://stackoverflow.com/q/26715287
score: 3
type: QuestionComment

http://stackoverflow.com/a/26788857
downvote count: 0
has body: The correct UTF-8 encoded form of the String "1234567890" is simply the codes of its characters because all are encoded using 1 byte (their codes are less than 127): [49, 50, 51, 52, 53, 54, 55, 56, 57, 48] Note: Arrays.toString(byte[]) uses the decimal representation of the bytes to construct the String representation of the array. If you look closer, the Objective-c result is exactly the same, it's just printed in hexadecimal radix: &lt;31323334 3536373839 30&gt; 0x31 = 49 0x32 = 50 ... 0x30 = 48 By the way String.getBytes() qutoing from the javadoc: Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array. So the platform's default encoding is used, so the result may change from platform-to-platform, so it's always recommended to state in which encoding you want the result, e.g.: byte[] xKey = Key.getBytes(StandardCharsets.UTF_8);
type: Answer
answers question: http://stackoverflow.com/q/26788728
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26788728
type: AcceptedAnswer

http://stackoverflow.com/q/26788245
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
score: 0
has answer: http://stackoverflow.com/a/26805379
answer count: 1
tagged with: tomcat
has body: I have a web service asynchronously with Jersey + Spring and use Tomcat 7. I have set server.xml in tomcat like: <Connector port="8080" address="localhost" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> I have in my beam.xml 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:context="http://www.springframework.org/schema/context" xmlns:ldap="http://www.springframework.org/schema/ldap" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd"> <context:property-placeholder location="/config/application.properties" /> ... And in my StudentJDBCTemplate i have: import org.apache.tomcat.jdbc.pool.DataSource; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.DefaultTransactionDefinition; public class StudentJDBCTemplate implements StudenteDAO { private DataSource dataSource; private JdbcTemplate jdbcTemplateObject; private PlatformTransactionManager transactionManager; private int p_id; private int c_id; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; this.jdbcTemplateObject = new JdbcTemplate(dataSource); } public void setTransactionManager( PlatformTrans…
has title: Unable to create initial connections of pool Async Jersey+Spring+Tomcat
tagged with: jdbc
tagged with: spring
accepted answer: http://stackoverflow.com/a/26805379

http://stackoverflow.com/q/26755943
answer count: 1
accepted answer: http://stackoverflow.com/a/26756662
tagged with: java
has comment: http://stackoverflow.com/comment/47056430
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/48044969
score: 6
favorite count: 0
has title: MariaDB fails to work after being idle for a period
type: Question
has answer: http://stackoverflow.com/a/26756662
tagged with: mariadb
has body: On my webapp, I often get the following exception: java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished it usually happens after a long period of time the system is idle. A restart to the tomcat solves the issue temporarily. I've recently moved to RHEL7 on my production server (running tomcat7 and mariaDB 5.5). This error hadn't not happened on the old server (ran RHEL5 with mySQL). I updated the java database drivers from mysql drivers that were used on the old server, to the latest stable mariadb connector: mariadb-java-client-1.1.7.jar. Any ideas how to fix the problem or a workaround? Here is the full log of this exception: Lexicon Message: Content.getData Error trying to excute: SELECT * FROM prefixes where prefix ='l' java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136) at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106) at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:338) at snaq.db.CachedStatement.execute(CachedStatement.java:339) at mila.lexicon.dbUtils.Connected.getData(Connected.java:257) at mila.lexicon.dbUtils.Prefixes.get(Prefixes.java:29) at mila.lexicon.analyse.Data.getPrefixes(Data.java:446) at mila.HMM.HMM2Morph.handlePrefixProperNameAnalysis(HMM2Morph.java:1196) at mila.HMM.HMM2Morph.parseXML(HMM2Morph.java:1791) at mila.HMM.HMM2Morph.process(HMM2Morph.java:2337) at org.apache.jsp.processAnalyzerXML_jsp._jspService(processAnalyzerXML_jsp.java:187) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspS…
has comment: http://stackoverflow.com/comment/42096449
has comment: http://stackoverflow.com/comment/46998862
tagged with: tomcat7
upvote count: 7
downvote count: 1

http://stackoverflow.com/a/26774443
type: Answer
score: 2
downvote count: 0
has body: It's inside one of the Maven distribution jars, namely in $MAVEN_HOME/lib/maven-core-X.X.X.jar. Inside META-INF/plexus/components.xml file. Here's why: Once upon a time (in Maven 2) until specified implicitly, plugins always used the latest version. The decision was based on two assumptions: the plugins are always getting better, so you want to get the latest one, and, since the plugin jars aren't part of your product (not even of it's production classpath), it's ok for it to sometimes break. Later they realized that that was a really bad idea, since it makes your build not reproducible. So, it was fixed by nailing down the versions of plugins to the latest release version of the plugin available to the date of Maven release. So, the good practice is to create a parent pom.xml with &lt;pluginManagement&gt; part and nail down the versions of all the plugins that are in use there.
upvote count: 2
has comment: http://stackoverflow.com/comment/42128107
answers question: http://stackoverflow.com/q/26774325

http://stackoverflow.com/q/26673958
has title: Configuration in ehcache.xml is not used on created JCache instances
has comment: http://stackoverflow.com/comment/41956293
has comment: http://stackoverflow.com/comment/41952540
downvote count: 0
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: ehcache
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41952612
has comment: http://stackoverflow.com/comment/41948876
has comment: http://stackoverflow.com/comment/41955666
answer count: 0
has body: I'm trying to use EHCache implementation of JCache (JSR 107), I provide the following configuration file under src\main\resources\ehcache.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true"&gt; &lt;!-- see http://www.ehcache.org/ehcache.xml --&gt; &lt;defaultCache maxEntriesLocalHeap="200000" eternal="false" timeToIdleSeconds="1200" timeToLiveSeconds="1200"&gt; &lt;persistence strategy="localTempSwap"/&gt; &lt;/defaultCache&gt; &lt;/ehcache&gt; Here is how I create the cache: String providerName = "org.ehcache.jcache.JCacheCachingProvider"; CachingProvider cachingProvider = Caching.getCachingProvider(providerName); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration&lt;ComposedKey, Object&gt; config = new MutableConfiguration&lt;ComposedKey, Object&gt;() .setTypes(ComposedKey.class, Object.class) .setExpiryPolicyFactory(FactoryBuilder.factoryOf(new AccessedExpiryPolicy(new Duration(TimeUnit.MINUTES, 30)))) .setReadThrough(false) .setWriteThrough(false) .addCacheEntryListenerConfiguration( new MutableCacheEntryListenerConfiguration&lt;ComposedKey, Object&gt;(new CacheListenerManagerJSR107Factory(), null, true, true)); ; Cache&lt;ComposedKey, Object&gt; cache = cacheManager.createCache("cache", config); But it seems that the created cache does not use the provided configuration (i.e. under ehcache.xml) as when debugging here is the attributes of the ehcache instance: [ name = orACJ2rF-1 status = STATUS_ALIVE eternal = false overflowToDisk = false maxEntriesLocalHeap = 1000 maxEntriesLocalDisk = 0 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 0 timeToIdleSeconds = 0 persistence = none diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: org.ehcache.jcache.JCacheListenerAdapter ; orderedCacheEventListeners: maxBytesLocalHeap = 0 overflowToOffHeap = false ma…
tagged with: java
upvote count: 1
tagged with: jcache
tagged with: caching
type: Question

http://stackoverflow.com/comment/41996209
comment on: http://stackoverflow.com/q/26700775
type: Comment
score: 0
has text: i just want to instantiate class using string type as we do in core java and how do i achieve it using bean configuration file.
type: QuestionComment

http://stackoverflow.com/comment/41968791
score: 0
comment on: http://stackoverflow.com/a/26681251
has text: I should also point out that using `Model.equals` to compare two RDF models will not always give the expected result: if your RDF model contains blank nodes, this will fail, despite the models being essentially identical. You should be using [ModelUtil.equals](http://rdf4j.org/sesame/2.7/apidocs/index.html?org/openrdf/model/util/ModelUtil.html) instead.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42217600
comment on: http://stackoverflow.com/q/26824262
score: 0
type: Comment
type: QuestionComment
has text: Did you read the docs on [`Cipher`](https://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html)? The javadocs should be helpful.

http://stackoverflow.com/a/26706359
has comment: http://stackoverflow.com/comment/42005652
upvote count: 2
answers question: http://stackoverflow.com/q/26706205
has body: One of the following is probably your problem: are you deleting in the right directory? I notice you specify not an absolute path, but a relative path that doesn't imply you're specifying a relative path on purpose. You may be deleting something in another directory. Close the file F, you are leaving the handle open and I'm not sure the consequences. How are you verifying "it's still there"? ls and not cat or nano or anything right? And other debugging: does opening the RF matter? (It shouldn't). Does it actually matter that it's a hidden file? What file are you actually deleting? does this happen in different directories? does this happen if you lock read/write access to the file in question with chmod? If you block reads what fails, if you block writes what fails? I strongly suspect this will elucidate your problem.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42007058

http://stackoverflow.com/a/26748983
type: Answer
answers question: http://stackoverflow.com/q/26748842
score: 0
has body: I suggest you start with an Employee POJO to store the weekly hours and employee number like static class Employee implements Comparable&lt;Employee&gt; { int num; double hours; public Employee(int num, double hours) { this.num = num; this.hours = hours; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public double getHours() { return hours; } public void setHours(double hours) { this.hours = hours; } @Override public String toString() { return String.format("Employee #%d - Hours %.1f", num, hours); } @Override public int compareTo(Employee o) { int c = Double.valueOf(this.hours).compareTo(o.hours); if (c != 0) { return -c; } return Integer.valueOf(this.num).compareTo(o.num); } } Then you can implement your sumRow with a for-each and something like public static double sumRow(double[] m) { double total = 0; for (double val : m) { total += val; } return total; } And finally, I think your main() could then use Arrays.sort(Object[]) like public static void main(String[] args) { double[][] employeeWorkHours = { { 2, 4, 3, 4, 5, 8, 8 }, { 7, 3, 4, 3, 3, 4, 4 }, { 3, 3, 4, 3, 3, 2, 2 }, { 9, 3, 4, 7, 3, 4, 1 }, { 3, 5, 4, 3, 6, 3, 8 }, { 3, 4, 4, 6, 3, 4, 4 }, { 3, 7, 4, 8, 3, 8, 4 }, { 6, 3, 5, 9, 2, 7, 9 } }; Employee[] totals = new Employee[employeeWorkHours.length]; for (int i = 0; i &lt; employeeWorkHours.length; i++) { totals[i] = new Employee(i, sumRow(employeeWorkHours[i])); } Arrays.sort(totals); for (Employee e : totals) { System.out.println(e); } } And I get what I think is the correct output, Employee #7 - Hours 41.0 Employee #6 - Hours 37.0 Employee #0 - Hours 34.0 Employee #4 - Hours 32.0 Employee #3 - Hours 31.0 Employee #1 - Hours 28.0 Employee #5 - Hours 28.0 Employee #2 - Hours 20.0

http://stackoverflow.com/comment/42059813
has text: I think the confusion is that a war is designed to be a collection of servlets and their dependent jars and template pages, but a jar is designed to be a discrete application or library. You might be able to do what you want with the maven-shade-plugin (build an "uber-jar")
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26732452

http://stackoverflow.com/q/26708178
has body: I am using singleton bean to read data from log file store it in Mysql DB, @Schedule(minute = "*/15", hour = "*", persistent = false) @SuppressWarnings("empty-statement") if it reads single log file works fine but more than one file it throws below mentioned exception at the line of ps = mycon.prepareStatement(Query) Exception appeared in server: 2014-11-03 14:35:20,101 ERROR [STDERR] (pool-15-thread-1) org.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction: 0:ffffc0a80ac1:126a:54572251:184 status: ActionStatus.ABORTED > cannot proceed STATUS_ROLLEDBACK; - nested throwable: (javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 0:ffffc0a80ac1:126a:54572251:184 status: ActionStatus.ABORTED > cannot proceed STATUS_ROLLEDBACK) 2014-11-03 14:35:20,102 ERROR [STDERR] (pool-15-thread-1) at org.jboss.resource.adapter.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:165) 2014-11-03 14:35:20,102 ERROR [STDERR] (pool-15-thread-1) at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:843) 2014-11-03 14:35:20,103 ERROR [STDERR] (pool-15-thread-1) at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:858) 2014-11-03 14:35:20,103 ERROR [STDERR] (pool-15-thread-1) at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:835) 2014-11-03 14:35:20,103 ERROR [STDERR] (pool-15-thread-1) at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:250) 2014-11-03 14:35:20,104 ERROR [STDERR] (pool-15-thread-1) at com.pms.single.PmsLogInsert.avgRespTimeRead(PmsLogInsert.java:1058) 2014-11-03 14:35:20,104 ERROR [STDERR] (pool-15-thread-1) at com.pms.single.PmsLogInsert.createIndex(PmsLogInsert.java:438) 2014-11-03 14:35:20,129 ERROR [STDERR] (pool-15-thread-1) Caused by: javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 0:ffffc0a80ac1…
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: singleton
answer count: 0
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has title: Singleton timer throws timer exception
tagged with: jboss

http://stackoverflow.com/comment/42226783
has text: Your EDIT2 is what I'm doing originally in my question. Isn't it?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26829337

http://stackoverflow.com/a/26714883
answers question: http://stackoverflow.com/q/26714801
score: 0
has body: This might be what you are looking for: rangeStyle.setCustomFormat("0.00%"); See: http://www.smartxls.com/java/formatting.htm#vformat-number In this example, they are applying some formatting to a chart. It seems like it matters from what area you obtain your rangeStyle Object. For instance, you can call it as rangeStyle = workBook.getRangeStyle(1, 1, 2, 2);//get format from range B2:C3. The formatting you set applies to selection within the sheet, or the parameters passed to getRangeStyle() (defaults to whole stylesheet without parameters, otherwise a cell range). Perhaps you can select the part of your chart instead of the original datacells, and then apply the formatting as before?
type: Answer
has comment: http://stackoverflow.com/comment/42022693
has comment: http://stackoverflow.com/comment/42022275
has comment: http://stackoverflow.com/comment/42020262

http://stackoverflow.com/comment/42224440
has text: @FilipBartuzi read about polymorphism, encapsulation, object-oriented design. Fields are not polymorphic in Java.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26828405

http://stackoverflow.com/a/26768554
has body: First you can declare an ArrayList of Strings: ArrayList&lt;String&gt; receipts = new ArrayList&lt;&gt;(); Then add the value of the receipt variable: receipts.add(receipt); At the end you can print all elements of ArrayList for (String s : receipts) System.out.println(s);
score: 0
has comment: http://stackoverflow.com/comment/42126580
type: Answer
has comment: http://stackoverflow.com/comment/42127460
answers question: http://stackoverflow.com/q/26768195

http://stackoverflow.com/q/26769406
accepted answer: http://stackoverflow.com/a/26769443
tagged with: window-decoration
downvote count: 0
answer count: 1
has title: Java - Set size of decorated JFrame
linked to: http://stackoverflow.com/q/6592468
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42119567
tagged with: jframe
tagged with: size
has comment: http://stackoverflow.com/comment/42119277
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42119431
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26769443
has body: I've got a problem with the size of a JFrame: I want to show content in the Jframe. The content will have the size 640 x 480. But I can not use the method JFrame.setSize(640, 480); because I also want to show the decoration of the window. My first thought was: Add a panel with the preferred dimension and than use pack();. But this also doesn't work - I only get a really small window. I think the solution to my problem could be similar to this: String JFrame Size How do I make a JFrame a certain size not including the border Here is my code: import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Fenster extends JFrame { JPanel panel; Dimension dim; Fenster(){ dim = new Dimension(640, 480); panel = new JPanel(); panel.setSize(dim); panel.setMinimumSize(dim); panel.setMaximumSize(dim); panel.setPreferredSize(dim); panel.setBounds(0, 0, 640, 480); panel.setDoubleBuffered(true); JLabel label = new JLabel("bla"); panel.add(label); this.setLayout(null); this.getContentPane().add(panel); this.setLocationRelativeTo(null); this.setResizable(false); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); this.setVisible(true); } }

http://stackoverflow.com/q/26826077
type: Question
tagged with: selenium-webdriver
tagged with: selenium-chromedriver
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26828244
has title: How to choose cssSelector value in Chrome browser using chrome Developer Tool(F12)?
tagged with: java
type: UnansweredQuestion
has body: How to choose cssSelector() from Chrome browser using Chrome Developer Tools? Can you show an example for the below code? WebElement searchBox = driver.findElement(By.cssSelector("selector")); searchBox.click(); How to chose the value for the SELECTOR field from the Chrome Developer Tool?-F12 in Chrome. Please explain with an example Thanks
tagged with: css-selectors
tagged with: javascript
has answer: http://stackoverflow.com/a/26830931

http://stackoverflow.com/a/26686115
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: root's home folder is not under "/home". Change this /home/root/java/jdk1.7.0_67/bin:/home/root/java/jdk1.7.0_67/bin to /root/java/jdk1.7.0_67/bin Also, /home/root/bin should probably be /root/bin For similar reasons. When writing a script you can use $HOME which will expand to wherever the user's home directory happens to be. So, PATH="$HOME/bin:$HOME/java/jdk1.7.0_67/bin" Edit I would not recommend that you link to java in $HOME/bin. Let's set a JAVA_HOME and move that to the front of the PATH like export JAVA_HOME=$HOME/java/jdk1.7.0_67 export PATH="$JAVA_HOME/bin:$HOME/bin:$PATH"
answers question: http://stackoverflow.com/q/26686084

http://stackoverflow.com/comment/42067467
type: QuestionComment
has text: why not use a Map<Class,List<?>>, insert each instance to the appropriate list according to the runtime type
score: 0
comment on: http://stackoverflow.com/q/26740746
type: Comment

http://stackoverflow.com/comment/42143835
has text: I expected this kind of answer. This is not what I am asking, see the edit
comment on: http://stackoverflow.com/a/26783040
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26725075
tagged with: cloneable
has body: public class Stav implements Cloneable{ private int[] pole; public Stav(int[] pole){ this.pole = pole; } public Stav(Stav a){ this.pole = a.pole; } public void move(boolean left){ int empty = findEmpty(); if(left){ this.pole[empty] = this.pole[empty - 1]; this.pole[empty - 1] = 0; } else{ this.pole[empty] = this.pole[empty + 1]; this.pole[empty + 1] = 0; } } and Jednotka pom = fronta.remove(); Stav nStav = new Stav(pom.getStav().getPole()); Stav pomStav = new Stav(nStav); and when i call pomStav.move(false); the value of nStav will change same as pomStav... somebody can help me with this? I have some more metods in code but its so long so I didnt copy here like findEmpty etc.
has comment: http://stackoverflow.com/comment/42039498
has answer: http://stackoverflow.com/a/26725160
score: 0
has title: Java copy constructor and clone doesnt work
answer count: 3
tagged with: copy-constructor
has answer: http://stackoverflow.com/a/26725165
has answer: http://stackoverflow.com/a/26725185
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/42039488
type: Question
has comment: http://stackoverflow.com/comment/42039508

http://stackoverflow.com/comment/41977113
comment on: http://stackoverflow.com/a/26690058
type: AnswerComment
score: 0
type: Comment
has text: Well the thing is I might get a 404 while not being able to find a user and an article. But I want different error messages. Also this isn't just about http error codes... Trying to delete a user or an article would also result in different codes for different cases

http://stackoverflow.com/q/26697526
type: UnansweredQuestion
has body: I'm looking to display a hit and miss in my java project. Basically, I enter a number and the program either hits or misses. If it hits, it displays a y, and if it misses an x. From what I've tested in the code, it works, giving the output saying "Hit" or "Try again", but it just doesn't display the x's or y's. public static void displayRiver(int [] river, boolean showShip) { System.out.println(); System.out.print("|"); for (int val : river) { switch (val) { case -1: // No Ship System.out.print("x"); break; case 0: // Unknown System.out.print(" "); break; case 1: // Ship Found System.out.print("Y"); break; }//switch System.out.print("|"); }//for } public static void main (String [] args) { int userInput; int length = promptForInt("Enter the length of the river"); int riverLength[] = new int[length]; boolean showShip = false; displayRiver(riverLength, showShip); int randomShipLocation = new Random().nextInt(length); int val; while(! showShip) { val = promptForInt("\n" + "Guess again. "); displayRiver(riverLength, showShip); if(userInput == randomShipLocation) { System.out.println("\n" +" BOOM!"); showShip = true; displayRiver(riverLength, showShip); } else if(userInput != randomShipLocation) System.out.print(val); } }
has title: Displaying Hit and Miss in Array Java
tagged with: java
has comment: http://stackoverflow.com/comment/41989496
type: Question
score: 0
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/26697576
has comment: http://stackoverflow.com/comment/41989454

http://stackoverflow.com/q/26701005
has comment: http://stackoverflow.com/comment/41995879
has comment: http://stackoverflow.com/comment/41996349
has body: I am working with the JavaFX Shape subclasses, and I have run into what I believe is a rather strange issue. My goal is to extend several of these shape subclasses (i.e. Rectangle, Circle) in order to add my own attributes to these objects. For example, the extension of the Rectangle subclass would look like this: public class MyRectangle extends javafx.scene.shape.Rectangle implements SpecialInterface { private SpecialAttributes specialAttributes; // ... // Constructors, getters and setters here // ... } Where the SpecialInterface can be used to specify the methods related to the new attributes that will be added to MyRectangle and MyCircle, in this case: public interface SpecialInterface { public SpecialAttributes getSpecialAttributes(); public void setSpecialAttributes(); } However, when I try to create service classes that reference these subclasses of Rectangle and Circle, it seems as though I cannot do so generically. Essentially, the problem arises when I need to utilize attributes and methods from both the Shape subclasses and the SpecialInterface interface: public class ManipulationService{ public ManipulationService(&lt;Undefined&gt; myExtendedShape) { // object from JavaFX Node, inherited by JavaFX Shapes (Circle, Rectangle, etc) myExtendedShape.onRotate(new EventHandler&lt;&gt;(){ // ... }); // a method from MyRectangle or MyCircle myExtendedShape.getSpecialAttributes(); } // ... } The issue here is that I cannot create a superclass for my extended shapes that would replace &lt;Undefined&gt; above. Specifically, if I create a superclass, I cannot extend the specific shapes that I want to extend in my subclasses due to a lack of multiple inheritance. If I replace &lt;Undefined&gt; with Shape, though, I then lose access to the methods in SpecialInterface. I'm sure that this sort of multiple-inheritance problem has been solved before, but I cannot find the solution. I appreciate any and all suggestions on how to handle this situation.
has title: Getting Around Bad Design Practices: Java Multiple Inheritance
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26701128
accepted answer: http://stackoverflow.com/a/26701128
tagged with: java
tagged with: javafx
type: Question
tagged with: inheritance
score: 0
has comment: http://stackoverflow.com/comment/41995732
answer count: 1
has comment: http://stackoverflow.com/comment/41995942

http://stackoverflow.com/q/26708843
linked to: http://stackoverflow.com/q/513832
favorite count: 0
has title: Array matching with if method in java
has comment: http://stackoverflow.com/comment/42009817
accepted answer: http://stackoverflow.com/a/26709279
possible better answer: http://stackoverflow.com/a/26708853
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26708953
upvote count: 1
has answer: http://stackoverflow.com/a/26709279
downvote count: 1
type: Question
has body: How to match a string of array by if method. Means i take some value in a string array and take user input and then input match that string array is right or wrong if right give a value or wrong give other value.And I want to take input use it in loop. I have such a code and i do it without loop can match but can not use loop. public class third { public static void main(String[] args) { Scanner user_input = new Scanner(System.in); System.out.println("Enter a name:\n"); String first_name; first_name=user_input.next(); String last_name; last_name=user_input.next(); if(first_name.matches("Elory")) { System.out.println("MR. " + first_name + " " + last_name); } else if(first_name.matches("Fred")) { System.out.println("MR. "+ first_name+" "+last_name); } else if(first_name.matches("Graham")) { System.out.println("MR. "+ first_name+" "+last_name); } else if(first_name.matches("Amy")) { System.out.println("MS. "+ first_name+" "+last_name); } else if(first_name.matches("Buffy")) { System.out.println("MS. "+ first_name+" "+last_name); } else if(first_name.matches("Cathy")) { System.out.println("MS. "+ first_name+" "+last_name); } else { System.out.println(first_name+" "+last_name); } } }
has answer: http://stackoverflow.com/a/26708853
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26709091
score: 0
has comment: http://stackoverflow.com/comment/42009690

http://stackoverflow.com/q/26762569
favorite count: 0
upvote count: 1
tagged with: maven
answer count: 1
has body: Using SonarQube 4.1.1 on Maven based Java project. I have a few rules that I want to exclude on specific Java files. Here are my use cases:- Exclude a set of issues That set of issues must be excluded only when the files have some regular expression. I do not want to blanket exclude the issues - i.e. I intend to catch these issues in other files. I do not want blanket exclude the files i.e. I intend to catch other issues on these files. I don't see any option as to how to accomplish this using Exclusions on the SonarQube Dashboard. Question: What are my options to address my use cases other than (obviously) exclude these on a case by case basis ?
tagged with: java
accepted answer: http://stackoverflow.com/a/26775458
tagged with: sonarqube
has title: How to exclude specific SonarQube issues by file contents
downvote count: 0
score: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26775458

http://stackoverflow.com/a/26788975
downvote count: 3
has body: you can try Hexagonal Architecture, it consist in put your business logic in the middle and access it via rest, soap, smtp, etc. and in your Rest files you just need to expose the path and call a class with all the things you need to do like a DAO, or something else. if the service refer to the same, you can leave in a single class, or separate depending of the propose of the services. For your problem you can create a DTO (Data Transfer Object) with simple data that you need, like account number, books, description, and you can override the toString() to give a proper response or convert the data in a json reponse. you can check http://alistair.cockburn.us/Hexagonal+architecture , i think is the best practice for that
has comment: http://stackoverflow.com/comment/42154398
score: -1
type: Answer
answers question: http://stackoverflow.com/q/26788608
upvote count: 2

http://stackoverflow.com/comment/42296960
type: Comment
score: 1
has text: The mvn dependency:tree showed up only one guava version. Please see my update in the post
type: AnswerComment
comment on: http://stackoverflow.com/a/26816639

http://stackoverflow.com/comment/42299466
has text: I did not actually convert the string representing a hexadecimal number to an actual hex number. What a stupid mistake. Thanks!
comment on: http://stackoverflow.com/a/26825064
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26799280
has body: Try this List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (String[] array : myArray) { list.addAll(Arrays.asList(array)); } System.out.println(list.contains(mychar));
type: Answer
answers question: http://stackoverflow.com/q/26799115
score: 0

http://stackoverflow.com/q/26781025
has answer: http://stackoverflow.com/a/26796067
has answer: http://stackoverflow.com/a/26781291
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Groovy - String to Time
type: Question
tagged with: java
answer count: 2
tagged with: groovy
downvote count: 0
tagged with: string
favorite count: 0
tagged with: type-conversion
has body: I have a String like this: String timeString = "2230" And I want to convert it into Time type. I have tried to use this def bookingTime = new Date().parse("2230") But it doesn't work. Any ideas? Thank you for the help!
tagged with: time

http://stackoverflow.com/a/26828609
has comment: http://stackoverflow.com/comment/42225494
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42225201
answers question: http://stackoverflow.com/q/26827968
has body: Try set a listener to FocusChanger and force the request focus with the inputMethodCall. mText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { editText.post(new Runnable() { @Override public void run() { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mText, InputMethodManager.SHOW_IMPLICIT); } }); } }); mText.requestFocus(); Check if your manifest is stateHidden instead stateAlwaysHidden

http://stackoverflow.com/comment/42153058
score: 0
has text: At a minimum, you should upgrade to the latest 2.0.x release (2.0.6) to get bug fixes, but it __would__ be in your best interest to move to something much more recent.
comment on: http://stackoverflow.com/a/26784664
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26699718
has comment: http://stackoverflow.com/comment/42027552
score: 1
answers question: http://stackoverflow.com/q/26699413
has comment: http://stackoverflow.com/comment/42035654
has comment: http://stackoverflow.com/comment/41993470
has body: First define a TimerTask class MyTimerTask extends TimerTask { JLabel currentDateTime; public MyTimerTask(JLabel aLabel) { this.currentDateTime = aLabel; } @Override public void run() { SwingUtilities.invokeLater( new Runnable() { public void run() { // You can do anything you want with 'aLabel' DateFormat dateandtime = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date date = new Date(); currentDateTime.setText(dateandtime.format(date)); } }); } } Then, you need to create a java.util.Timer in startup of your application or UI. For example your main() method. ... Timer timer = new Timer(); timer.schedule(new MyTimerTask(label), 0, 1000); ...
upvote count: 2
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/42005433

jackson
tags question: http://stackoverflow.com/q/26752881
tags question: http://stackoverflow.com/q/26725278
tags question: http://stackoverflow.com/q/26762195
tags question: http://stackoverflow.com/q/26783408
tags question: http://stackoverflow.com/q/26700517
tags question: http://stackoverflow.com/q/26759967
tags question: http://stackoverflow.com/q/26716020
tags question: http://stackoverflow.com/q/26827343
tags question: http://stackoverflow.com/q/26675778
tags question: http://stackoverflow.com/q/26818492
type: Tag
tags question: http://stackoverflow.com/q/26739560
tags question: http://stackoverflow.com/q/26703618
tags question: http://stackoverflow.com/q/26698434
tags question: http://stackoverflow.com/q/26822561
tags question: http://stackoverflow.com/q/26760299
tag name: jackson
tags question: http://stackoverflow.com/q/26803026
tags question: http://stackoverflow.com/q/26744885
tags question: http://stackoverflow.com/q/26804330
tags question: http://stackoverflow.com/q/26775106
tags question: http://stackoverflow.com/q/26766256
tags question: http://stackoverflow.com/q/26676405
tags question: http://stackoverflow.com/q/26767158
tags question: http://stackoverflow.com/q/26689104
tags question: http://stackoverflow.com/q/26776955
tags question: http://stackoverflow.com/q/26740749
tags question: http://stackoverflow.com/q/26830035
tags question: http://stackoverflow.com/q/26767769
tags question: http://stackoverflow.com/q/26699227
tags question: http://stackoverflow.com/q/26675461

http://stackoverflow.com/comment/42004979
has text: Don't forget to import that class: `import package.of.classA.ClassA;`
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26706030

http://stackoverflow.com/q/26756496
accepted answer: http://stackoverflow.com/a/26780070
answer count: 1
has comment: http://stackoverflow.com/comment/42136895
has comment: http://stackoverflow.com/comment/42095121
linked to: http://stackoverflow.com/q/8194408
has body: I have a project where we call a GET method from Java Script : the method called is below : public @ResponseBody Map run( @RequestParam Map map, HttpServletRequest request, HttpServletResponse response) throws Exception { } Now I am writing a Micro service to do the work which is done inside the above method . And the requirement is this method will call the micro-service .The only thing I am stuck with is passing the (HttpServletRequest request, HttpServletResponse response) to the method in micro-service I am calling as they have some data in there which will be used. My method definition in micro-service looks like : @POST @Path("/myPostCall") public String myPostCall(Map map,HttpServletRequest request, HttpServletResponse response) throws Exception{ } Now I am trying to call this by RestTemplate abc = new RestTemplate(); abc.postForObject("http://localhost:8008/report/run", report1, String.class); It gives me 422 error . But If I remove the request,response parameters in micro-service method . it runs good . But I need them too . Because they have data in it . Is there something out of my understanding .
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26780070
tagged with: resttemplate
has comment: http://stackoverflow.com/comment/42138210
type: Question
has comment: http://stackoverflow.com/comment/42137495
has comment: http://stackoverflow.com/comment/42138550
has comment: http://stackoverflow.com/comment/42138457
has comment: http://stackoverflow.com/comment/42138337
tagged with: post
has title: How to send a post request with multiple parameters
score: 0

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/26713813
tags question: http://stackoverflow.com/q/26763208

http://stackoverflow.com/a/26809261
downvote count: 0
has comment: http://stackoverflow.com/comment/124331941
type: AcceptedAnswer
has body: As [M. Deinum] mentioned in a comment on my original post, the solution is to set: spring.jpa.properties.javax.persistence.validation.mode=none In the application.properties file. Additionally, this behaviour is described here (its easy to miss because no example is provided).
score: 57
accepted answer of: http://stackoverflow.com/q/26764532
type: Answer
answers question: http://stackoverflow.com/q/26764532
upvote count: 57
has comment: http://stackoverflow.com/comment/122677351

http://stackoverflow.com/a/26683803
type: Answer
has comment: http://stackoverflow.com/comment/41966277
has body: use acctNum=kbd.next(); and pwd=kbd.next(); instead of nextLine!
answers question: http://stackoverflow.com/q/26683732
score: 0

http://stackoverflow.com/comment/42207099
has text: Tell me, what kind of number is *Washington,George*?
score: 1
comment on: http://stackoverflow.com/q/26818570
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42000380
has text: shouldn't checkbox_years_of checked.setChecked(true) be checkbox_years_of.setChecked(true) ? (there you're calling setChecked to checked wich is a boolean variable)
type: QuestionComment
comment on: http://stackoverflow.com/q/26703526
score: 0
type: Comment

http://stackoverflow.com/q/26729618
has answer: http://stackoverflow.com/a/26730676
favorite count: 0
upvote count: 5
tagged with: apache-poi
linked to: http://stackoverflow.com/q/18635107
has body: I need to unprotect a protected xlsx file.e.g Book1.xlsx Below code runs fine for the first time, Reads Book1.xlsx, decrypt it and again write it to the same filename. public static void unprotectXLSXSheet(String fileName, String password) { try{ POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(fileName)); EncryptionInfo info = new EncryptionInfo(fs); Decryptor d = Decryptor.getInstance(info); d.verifyPassword(password); InputStream is = d.getDataStream(fs); System.out.println(is.available()); XSSFWorkbook wb = new XSSFWorkbook(OPCPackage.open(is)); FileOutputStream fileOut; fileOut = new FileOutputStream(fileName); wb.write(fileOut); fileOut.flush(); fileOut.close(); }catch(FileNotFoundException ex){ ex.printStackTrace(); }catch(IOException ex){ ex.printStackTrace(); But when the same code tries to access the newly created unprotected Book1.xlsx(or anyother unprotected xlsx file) it fails and showing Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF) at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:131) at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:104) at org.apache.poi.poifs.filesystem.POIFSFileSystem.&lt;init&gt;(POIFSFileSystem.java:138) at com.wolseley.Excel.TestMainDummy.unprotectXLSXSheet(TestMainDummy.java:113) at com.wolseley.Excel.TestMainDummy.main(TestMainDummy.java:52) i need help in reading xlsx file and also unlock it using password, as done above.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26730956
downvote count: 0
tagged with: java
has title: Read xlsx file using POIFSFileSystem
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26730956
score: 5
possible better answer: http://stackoverflow.com/a/26730676

http://stackoverflow.com/comment/42205060
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26817059
has text: I just want to know that how can I call more than 1 servlet from same JSP file?

http://stackoverflow.com/q/26782442
accepted answer: http://stackoverflow.com/a/26782671
has body: I'm building a maze game where the player has to navigate a maze with enemies chasing after him. I'm wondering what would be the best way to implement an Enemy class with "Zombie" and "Vampire" subclasses. At the moment both classes are practically identical, except for their color. The movement strategies are the same however this could potentially change in the future. Also I want to allow extensibility in the sense that if a client wants to add more enemies with different movement strategies than they would be able to do so without changing the existing code base. I was looking at different ways to do it: Just use an Enemy class that takes in a string in it's constructor and decides what color to make that "Enemy" depending whether "Zombie" or "Vampire" was passed in. However this doesn't allow for different movement strategies and there will be a build up of conditional branches if many other enemies are added. Abstract Enemy class with abstract method move() and getColor(), this allows each class to define its own movement strategy and hold a reference to it's color. However isn't this a bit overkill if enemies will likely only differ in color. Enemy movement will all be the same in my implementation but showcasing potential for extensibility is always a plus.
tagged with: subclass
has comment: http://stackoverflow.com/comment/42143073
has comment: http://stackoverflow.com/comment/42142301
answer count: 4
score: 2
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/26782840
has title: Different implementations for abstract class in Java
downvote count: 1
has comment: http://stackoverflow.com/comment/42142216
tagged with: superclass
type: Question
has comment: http://stackoverflow.com/comment/42142108
has comment: http://stackoverflow.com/comment/42142321
tagged with: java
has answer: http://stackoverflow.com/a/26783152
has comment: http://stackoverflow.com/comment/42142493
has comment: http://stackoverflow.com/comment/42142370
has answer: http://stackoverflow.com/a/26782894
possible better answer: http://stackoverflow.com/a/26782840
tagged with: inheritance
favorite count: 0
tagged with: abstract-class
has answer: http://stackoverflow.com/a/26782671

http://stackoverflow.com/comment/42182651
has text: The only suggestion I have is with regards to naming conventions. "Flying" is a bad choice for an interface name. Typically, an interface name implies some kind of quality that certain object types might display, while other related object might not. "Flyable" is a more "correct" naming convention for an interface. Additionally, "flying" is a verb, and verb imply action. Methods denote the behavior (actions) of a class or interface. Therefore, "flying" is more appropriate for a method than for a class or interface.
comment on: http://stackoverflow.com/q/26804592
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/26762045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42119624
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26768385
accepted answer: http://stackoverflow.com/a/26768385
downvote count: 0
has comment: http://stackoverflow.com/comment/42118879
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42127547
tagged with: hex
has body: I searched a lot but I haven't found a good solution how to solve this. I have an app which has to decrypt a long hex string with AES 256. In order to test it, I created a test method which encrypts a long text into a hex and then convert it back and decrypt it. If I run this method, I always get the following error: Given final block not properly padded. I receive this error in the decryption method. The test method looks like so: @Test public void testEncAndDecRequestWithHexString() throws UnsupportedEncodingException { CryptoHelper cryptoHelper = new CryptoHelper("AES256"); String paramStr = "ABCB28BCEE5947B8AECE3386871EC0DF&amp;{D5CA99D2-506B-4864-8971-E87821D6B105}&amp;7523429"; //encrypt the param string byte[] paramByteEnc = cryptoHelper.encryptBytesToBytes(paramStr.getBytes("ASCII"), PARAM_KEY, PARAM_IV); //convert it to hex String encryptedHexStr = cryptoHelper.byteArrayToHexStr(paramByteEnc); //convert it back to a byte array byte[] encryptedHexBytes = cryptoHelper.hexStrToByteArray(encryptedHexStr); // decrypt it byte[] paramByteDecrypted = cryptoHelper.decryptBytesToBytes(encryptedHexBytes, encryptedHexBytes.length, PARAM_KEY, PARAM_IV); String decryptedStr = new String(paramByteDecrypted); assertEquals("ABCB28BCEE5947B8AECE3386871EC0DF&amp;{D5CA99D2-506B-4864-8971-E87821D6B105}&amp;7523429", decryptedStr); } The CryptHelper class has following methods: @Override public byte[] encryptBytesToBytes(byte[] plainData, byte[] key, byte[] iv) { try { initCipher(Cipher.ENCRYPT_MODE, key, iv); return aesCipher.doFinal(plainData); } catch (IllegalBlockSizeException | BadPaddingException e) { log.severe(e.getMessage()); } return null; } @Override public byte[] decryptBytesToBytes(byte[] encryptedBytes, int length, byte[] key, byte[] iv) { try { initCipher(Cipher.DECRYPT_MODE, key, iv); return aesCipher.doFinal(encryptedBytes, 0, length); } catch (IllegalBlockSizeException | BadPaddingException e) { e.printStackTrace(); } return null; } private void initCipher(int …
has title: Encrypt and decrypt with hex string
tagged with: encryption
has comment: http://stackoverflow.com/comment/42106173
has comment: http://stackoverflow.com/comment/42106467
tagged with: aes

http://stackoverflow.com/comment/41981501
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26692692
has text: Ok, but i don't have angle so it wouldn't work for me.
type: Comment

http://stackoverflow.com/comment/42023967
type: Comment
comment on: http://stackoverflow.com/q/26716677
score: 2
has text: I think folks could argue about whether or not it is a bug. This isn't always the case but for this particular case, I think being consistent with Java probably makes more sense than changing this.
type: QuestionComment

http://stackoverflow.com/comment/42220501
type: AnswerComment
score: 0
type: Comment
has text: if i use S.nextline(); it doesnot wait for the input at all :/
comment on: http://stackoverflow.com/a/26826071

http://stackoverflow.com/comment/42207935
comment on: http://stackoverflow.com/q/26819015
type: Comment
has text: I don't really understand the question. You want a map, and this method returns one. Wht do you want to optimize? Why do you think anything should be optimized. As an indication, all the instructions could be compared, in terms of time needed to execute them, as making a step, except for the call to menuDao.getMenuItemById(), which probably goes to a database, and could be compared to going to the moon and coming back. So, if something needs to be optimized, it's the database query. Everything else is negligible.
type: QuestionComment
score: 1

http://stackoverflow.com/a/26776578
accepted answer of: http://stackoverflow.com/q/26776207
answers question: http://stackoverflow.com/q/26776207
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: A Vaadin container "contains" only the item currently filtered, ordered and so on. .getVisibleItemsIds() refers to actually VISIBLE, like with eyes, rows: is and old legacy method and you should avoit it if your really intent is to know which rows are really seeable. You get null/empty because on your test you never attach your Table, hence is not really "visible" or has zero-size. So back on your problem the solution is just .getItemIds() and you'll get all the ids of the items in the container already filtered and ordered. Cheers

opengl
tags question: http://stackoverflow.com/q/26685006
tags question: http://stackoverflow.com/q/26744249
tags question: http://stackoverflow.com/q/26767516
tags question: http://stackoverflow.com/q/26743193
tags question: http://stackoverflow.com/q/26749044
tags question: http://stackoverflow.com/q/26783708
type: Tag
tags question: http://stackoverflow.com/q/26696126
tags question: http://stackoverflow.com/q/26791041
tags question: http://stackoverflow.com/q/26795007
tags question: http://stackoverflow.com/q/26772109
tags question: http://stackoverflow.com/q/26770817
tags question: http://stackoverflow.com/q/26754725
tags question: http://stackoverflow.com/q/26695010
tags question: http://stackoverflow.com/q/26827523
tag name: opengl
tags question: http://stackoverflow.com/q/26733301

http://stackoverflow.com/comment/42016842
comment on: http://stackoverflow.com/a/26693534
score: 0
type: AnswerComment
has text: Thanks. Didn't knew that.
type: Comment

http://stackoverflow.com/comment/42202278
type: QuestionComment
comment on: http://stackoverflow.com/q/26815471
has text: Isn't there a bunch of integer overflow with this? Are they treated the same by both the JVM and native asm?
score: 0
type: Comment

http://stackoverflow.com/a/26853384
has comment: http://stackoverflow.com/comment/42396075
has comment: http://stackoverflow.com/comment/42364573
type: Answer
has comment: http://stackoverflow.com/comment/42359528
has comment: http://stackoverflow.com/comment/42396136
score: 2
has comment: http://stackoverflow.com/comment/42396923
downvote count: 0
has comment: http://stackoverflow.com/comment/42280740
has body: As Yangfan mentioned, it's important that you make sure BYOIProvider.refresh() returns the token, not null. It is called internally by the CognitoCachingCredentialsProvider, and that token is used. Ideally, what is to happen is the communication with your server would take place in the BYOIProvider class, as the method calls from that class are used in the CognitoCachingCredentialsProvider. That update call is important. It's what goes through and triggers the appropriate handling of identity changes (which could be what's causing your issue) and updating the token. It really needs to be called and have the appropriate token and identityId when doing so. If your getCredentials() call is used at all of the appropriate times, it could be enough to ensure that it returns the token, however if you were to move some of that code communicating with the server to inside the refresh call (above update) and update the return, it would handle itself. If that doesn't resolve your issue, could you post your stacktrace? Edit: Alright, I see another possibility. AWSAbstractCognitoIdentityProvider actually keeps track of identityId and token - those are what are internally used in the credentials provider. It's possible this means the credentials provider isn't getting the identityId and token you're setting. These are accessible through getters and setters. Additionally, in the docs for setLogins()/withLogins(), it says you should manually call refresh on the credentials provider after adding logins to the provider, as your identity id may have changed. The identity id of a user very much will change after they go from unauthenticated to authenticated. Edit2: When an identity changes, a few things happen - one of which is the datasets, which are stored locally in a database, need to be removed from being linked to the old identity id and added to the new one. That action is triggered upon an identity changed listener being activated. Identity changed listeners are registered to t…
has comment: http://stackoverflow.com/comment/42301780
has comment: http://stackoverflow.com/comment/42395320
upvote count: 2
has comment: http://stackoverflow.com/comment/42384979
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26826546
answers question: http://stackoverflow.com/q/26826546
has comment: http://stackoverflow.com/comment/42395692
has comment: http://stackoverflow.com/comment/42381570

http://stackoverflow.com/comment/42235995
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26832157
has text: Fixed. I wasn't resetting RomanFragment after using it. Thanks @Taekahn!
score: 0

http://stackoverflow.com/q/26783093
has answer: http://stackoverflow.com/a/26783502
has comment: http://stackoverflow.com/comment/42143487
favorite count: 0
has comment: http://stackoverflow.com/comment/42143261
score: -3
has comment: http://stackoverflow.com/comment/42143657
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26783466
accepted answer: http://stackoverflow.com/a/26783466
upvote count: 1
has comment: http://stackoverflow.com/comment/42143965
possible better answer: http://stackoverflow.com/a/26783502
tagged with: switch-statement
has title: decrement switch statement output
type: Question
has body: basically the output says i = 11, though each time I try to trace it the answer comes up 9 with me. I've been playing with the code a little to see where the extra 2 comes from. Its in the case 3/4, but I can't find any increment state for i though it becomes 4 at that point. Can anyone help and explain this to me? public class out2 { public static void main(String args[]) { int i = 0, j = 7; boolean f = true; while (i &lt;= 4) { switch (--j) { case 1: case 2: i = f ? i + 7 : i + 1; break; case 3: case 4: i = !f ? j++ : j--; break; case 5: case 6: i = (i == j) ? i - 1 : i + 1; } } System.out.println("j=" + j + "\ni=" + i); } }
downvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/42143956
tagged with: decrement

http://stackoverflow.com/comment/42079400
score: 0
type: Comment
type: QuestionComment
has text: Have you tried anything? Can we see it?
comment on: http://stackoverflow.com/q/26747167

http://stackoverflow.com/comment/42000947
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26703778
has text: out of curiosity. DO you have the JAVA_HOME set and pointing to the main sdk directory? (not the bin, the one above)

http://stackoverflow.com/q/26814372
tagged with: concurrency
has title: Program Threads hanging when using a semaphore
downvote count: 0
has body: I have an issue setting up a critical section with a semaphore between 2 threads. I am using a semaphore to acquire(send) in my Customer thread and release in my teller thread. However when I run my program it is always hanging and I don't know why. I have tried several things and i am not sure what the issue was. I am trying to use the deposit semaphore to set up a critical section with the customer thread and teller thread. import java.util.concurrent.Semaphore; public class Threads { // private int customerNumber = 0; private static Semaphore deposit = new Semaphore (0, true); public static void main(String[] args) { final int customerThreads = 5; final int tellerThreads = 2; final int loanThreads = 1; Customer thr[] = new Customer[customerThreads]; // make 5 customer threads Thread cThread[] = new Thread[customerThreads]; // made 5 threads for (int i= 0; i &lt; customerThreads; i++) { thr[i]= new Customer(i); cThread[i] = new Thread(thr [i]); cThread[i].start(); } for ( int i = 0; i &lt; customerThreads; i++ ) { try { cThread[i].join (); System.out.println("Customer"+i + "joined from main"); } catch (InterruptedException e) { } } Teller thr1[] = new Teller[tellerThreads]; Thread tThread[] = new Thread[tellerThreads]; for (int b = 0; b&lt; tellerThreads; b++) { thr1[b] = new Teller(b); tThread[b]= new Thread(thr1 [b]); tThread[b].start(); } LoanOfficer thr2[] = new LoanOfficer[loanThreads]; Thread lThread[] = new Thread[loanThreads]; for(int c = 0; c&lt; loanThreads; c++) { thr2[c] = new LoanOfficer(c); lThread[c] = new Thread(thr2 [c]); lThread[c].start(); } // TODO code application logic here } static class Customer implements Runnable { private int customerNumber = 0; private int balance = 0; Customer(int cn) { this.customerNumber = cn; balance = 1000; System.out.println("Customer"+ customerNumber + "created"); } public void run() { try { Thread.sleep(200); deposit.acquire(); } catch(InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTra…
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26814464
type: Question
answer count: 1
tagged with: semaphore
tagged with: java
tagged with: multithreading
tagged with: thread-safety
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/42213217
has text: Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and calculates the other two values. Also include methods named setRadius() and getRadius(). The setRadius() method not only sets the radius but also calculates the other two values.
comment on: http://stackoverflow.com/q/26821736
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41977054
type: AnswerComment
type: Comment
score: 0
has text: I really don't think you do, not at this level at least. Any HTTP service that you are consuming should use standard error codes (or have some standard to tell you why the request failed). So in the `switch` example in my answer and using your comment as a template, you would map out `409` to your `ConflictException`, `404` to your `NotFoundException` as the status code:exception mapping. When you call something that gives a 4xx/5xx - regardless of what it is, you'll get a standard exception back.
comment on: http://stackoverflow.com/a/26690058

http://stackoverflow.com/q/26775431
tagged with: spring-security
has body: Please find my below configuration to integrating Spring Security v3.2.5 with Web Logic Server v7. I tried to find in couple of places to figure out how integrate but no luck. When i run my application with below configuration i get " No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken". If we look at the configuration have mentioned "preAuthenticatedAuthenticationProvider" as a authentication provider to authentication manager, for preAuthenticatedAuthenticationProvider have also mentioned "preAuthenticatedUserDetailsService". Can anyone help me in getting this resolved. &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"&gt; &lt;!-- web sphere configuration start --&gt; &lt;http auto-config="false" use-expressions="true"&gt; &lt;intercept-url pattern="/welcome*" access="permitAll" /&gt; &lt;form-login login-page="/login" default-target-url="/welcome" authentication-failure-url="/loginfailed" /&gt; &lt;custom-filter before="PRE_AUTH_FILTER" ref="webspherePreAuthFilter" /&gt; &lt;logout logout-success-url="/logout" delete-cookies="JSESSIONID" /&gt; &lt;session-management invalid-session-url="/logout"&gt; &lt;concurrency-control max-sessions="1" error-if-maximum-exceeded="true" expired-url="/sessionexpired" /&gt; &lt;/session-management&gt; &lt;/http&gt; &lt;beans:bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy"&gt; &lt;filter-chain-map path-type="ant"&gt; &lt;!-- &lt;filter-chain pattern="/**" filters="sif,webspherePreAuthFilter,logoutFilter,etf,fsi" /&gt; --&gt; &lt;filter-chain pattern="/welcome*" filt…
has answer: http://stackoverflow.com/a/26804731
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
score: 0
tagged with: weblogic
has title: Can't Integrate Spring Security and Web Logic 7
answer count: 1

http://stackoverflow.com/q/26794520
tagged with: jquery
tagged with: ajax
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42164144
accepted answer: http://stackoverflow.com/a/26798276
has comment: http://stackoverflow.com/comment/42164230
score: 0
has body: i am newbie to spring.My requirement is to replace the current page content with another page content in spring ajax call. Below is my code: a1.jsp admin ajaxcheck.jsp <c:out value="${model}"/> Spring Controller: @RequestMapping(value="CheckAjax") @ResponseBody public ModelAndView myAjax(){ logger.info("i am executing"); return new ModelAndView("ajaxcheck","model","success"); } The console displays success Object {view: null, model: Object, empty: false, viewName: "ajaxcheck", reference: true…}empty: falsemodel: ObjectmodelMap: Objectreference: trueview: nullviewName: "ajaxcheck"proto: Object i already acheive this in my struts2 project.But i am struggle how to do this in spring? Any help will be greatly appreciated!!!
has answer: http://stackoverflow.com/a/26798276
has title: Failed to replace the current page div content with another page div content in spring ajax call
answer count: 1

http://stackoverflow.com/comment/42146640
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26784730
has text: Right. So if I specify the string for the field I want I still get null

http://stackoverflow.com/comment/42173450
has text: Thanks for the answer. But still I get a 406 (Not Acceptable) error in my console... Is there a problem with the dataType="JSON"??? Thanks in advance...
comment on: http://stackoverflow.com/a/26799212
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26786466
has comment: http://stackoverflow.com/comment/42155121
has body: A plea for when you post questions that involve exceptions: Can you always indicate which line in the code is generating the exception? The stack trace tells us it is line 136 but there's no way to know which line is 136 from the code snippet you posted. I'm going to just make a guess from the message about the cast that the line generating the exception is actually table = treeTableView.getRoot().getValue(); (and not the line with the explicit cast). If you have a TreeTableView&lt;BillingTable&gt;, then it's root is a TreeItem&lt;BillingTable&gt;. So treeTableView.getRoot() returns a TreeItem&lt;BillingTable&gt; and calling getValue() on that returns a BillingTable, which is presumably the type of table (else it wouldn't compile). The error message shows that at runtime evaluating treeTableView.getRoot().getValue() is actually returning an object of type BillingTableRow, instead of the expected billing table. The only way this could have happened is if you used a raw type somewhere along the initialization. Parametrized types are basically not remembered at runtime ("type erasure"), so the type checks are all compiler checks. If you use raw types, the compiler will allow you to place the wrong type of object in a TreeItem, or the wrong type of TreeItem in a TreeTableView. So somewhere in your initialization process you did something along the lines of TreeTableView&lt;BillingTable&gt; treeTableView = new TreeTableView&lt;&gt;(); TreeItem root = new TreeItem(someBillingTableRow); treeTableView.setRoot(root); Or you did TreeTableView treeTableView = new TreeTableView(); TreeItem&lt;BillingTableRow&gt; root = new TreeItem&lt;&gt;(someBillingTableRow); treeTableView.setRoot(root); This is wrong because, in both cases, you are setting the root of the tree table view to a tree item which has a BillingTableRow as it's value, instead of a BillingTable. If you provide types for everything correctly, then you avoid these issues (by which I mean you'll get a compiler error in…
has comment: http://stackoverflow.com/comment/42156571
has comment: http://stackoverflow.com/comment/42172219
has comment: http://stackoverflow.com/comment/42184129
score: 0
has comment: http://stackoverflow.com/comment/42157866
has comment: http://stackoverflow.com/comment/42155497
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26774255
answers question: http://stackoverflow.com/q/26774255
has comment: http://stackoverflow.com/comment/42156740
type: Answer
has comment: http://stackoverflow.com/comment/42155433

http://stackoverflow.com/comment/42231326
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26832366
score: 7
has text: "Exponentially" is not a synonym for "quickly".

http://stackoverflow.com/q/26673765
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: formatting
has answer: http://stackoverflow.com/a/26674011
has comment: http://stackoverflow.com/comment/41947465
type: Question
has comment: http://stackoverflow.com/comment/41953488
answer count: 2
accepted answer: http://stackoverflow.com/a/26674011
possible better answer: http://stackoverflow.com/a/26674255
has answer: http://stackoverflow.com/a/26674255
tagged with: datetime
has body: I am getting ParseException when following piece of code is executed: double toMilliseconds(double ds2) throws ParseException { long durinsec; DateFormat formatter; Date convertedDate; String d2 = String.valueOf(ds2); System.out.println(d2+"string date"); formatter = new SimpleDateFormat("yyyyMMddHHmmSS"); convertedDate = formatter.parse(d2); System.out.println(convertedDate+"convertedDate"); durinsec = convertedDate.getTime()/1000; System.out.println("Date from yyyyMMdd String in Java : " +durinsec ); return durinsec; } Please help on what's wrong. I am getting input from the Java Text Field in yyyyMMddHHmmss format.
tagged with: swing
has title: ParseException on trying to convert date to milliseconds
has comment: http://stackoverflow.com/comment/41947424

http://stackoverflow.com/comment/42201938
comment on: http://stackoverflow.com/q/26815471
score: 14
type: Comment
type: QuestionComment
has text: That's not C, that's C++. How are you compiling (what compiler flags)?

http://stackoverflow.com/a/26730597
has comment: http://stackoverflow.com/comment/42051887
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42052018
downvote count: 0
answers question: http://stackoverflow.com/q/26730137
has comment: http://stackoverflow.com/comment/42058374
upvote count: 8
has comment: http://stackoverflow.com/comment/42058511
accepted answer of: http://stackoverflow.com/q/26730137
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/81650219
has body: If you try to remove a row using an iterator while iterating, you "confuse" the iterator. Do it like this: List&lt;Row&gt; toRemove = new ArrayList&lt;Row&gt;() while (rowIterator.hasNext()) { Row row = rowIterator.next(); // throws ConcurrentModificationException if (row_count == 0) { col_count = row.getLastCellNum(); //Do something } else { if (row.getCell(1).equals("XYZ")) { toRemove.add(row); } } row_count++; } // loop the list and call sheet.removeRow() on every entry ... See also http://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html

http://stackoverflow.com/comment/42011706
type: Comment
has text: Thanks for your answer StanislavL. I will check this out.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26676330

http://stackoverflow.com/a/26699202
has body: Java doesn't allow commas, but it allows underscores for the same purpose: int integer = 100_000; integer = 100_000_000; If you want to output it with commas, you have to use number formatting, as explained in other answers.
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26699172

http://stackoverflow.com/comment/42063174
type: QuestionComment
type: Comment
score: 0
has text: I found the linux-arm folder in the unzip jar file, and the `.so` to link. But how can I make a new jar from the unzip folder? I've try to use the `jar cmf` command, but It dosn't work.
comment on: http://stackoverflow.com/q/26735739

http://stackoverflow.com/a/26780424
answers question: http://stackoverflow.com/q/26780153
has body: Do not blame Tomcat nor your webapp. They give what the browser asked for. According to Wikipedia the file favicon.ico is used by browsers to associate an icon to a site. On first connection, the browser gets the file and then caches it until you clear the cache. And you can configure some browsers to clear the cache when the browser is closed.
type: Answer
score: 0

http://stackoverflow.com/comment/42183178
has text: I think I understand what OP is trying to say here but I suspect we have a case of the [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26804940
score: 2

http://stackoverflow.com/comment/41958580
has text: By timer i mean any method he can use to calculate the time, not the Timer class specifically
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26679520
type: AnswerComment

http://stackoverflow.com/comment/42137797
type: QuestionComment
type: Comment
has text: Incorrect syntax? Nope... (https://api.stackexchange.com/2.2/questions/26703618?&site=stackoverflow), http://www.json.org/
comment on: http://stackoverflow.com/q/26703618
score: 0

http://stackoverflow.com/q/26765155
answer count: 1
tagged with: jvm
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26768329
tagged with: java
type: Question
tagged with: neural-network
has title: neuroph when creating neural network nothing happens when clicking finish
score: 0
has body: I can create simple small NN but when i upload a lot of images to train on (992 images) and go through all the other steps I click finish, the load bar works for a second and then nothing happens. The files don't get created and the finish screen doesn't go away. I can also then click on Finish again and nothing happens. I am using this as a tutorial: http://neuroph.sourceforge.net/image_recognition.html I am running this on a Windows machine (Windows 7); Is there something else i should be doing? Should i increase the Java heap size for JVM (btw how to increase the heap size in windows 7?) Edit 1: Added more memory with: -Xms128m -Xmx3072m still didn't help!

http://stackoverflow.com/q/26806589
tagged with: tostring
type: AnsweredQuestion
has title: Java ArrayList / RMI
downvote count: 0
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/26806804
type: Question
upvote count: 6
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/26806819
accepted answer: http://stackoverflow.com/a/26806819
has answer: http://stackoverflow.com/a/26807108
has body: I've built a simple item class; class itemInfo{ int auctionID; int startPrice; int buyoutPrice; } I've created an ArrayList; ArrayList&lt;itemInfo&gt; itemSet = new ArrayList&lt;itemInfo&gt;(); I also have a method here that allows a user to create an item (the method is incomplete, I've only tried implementing choice == 1 so far!); public void auctionChoice(){ System.out.println("---- What would you like to do? ----\n"); System.out.println("1: List an item for auction\n"); System.out.println("2: Bid on an existing item\n"); System.out.println("3: Remove an item from the auction\n"); if(scanner.next().equals("1")){ itemInfo createdItem = new itemInfo(); System.out.println("----Enter the auctionID----"); createdItem.auctionID = scanner.nextInt(); System.out.println("----Enter the item startPrice----"); createdItem.startPrice = scanner.nextInt(); System.out.println("----Enter the buyoutPrice----"); createdItem.buyoutPrice = scanner.nextInt(); System.out.println("Auction ID:" +createdItem.auctionID+ "\nstartPrice:" +createdItem.startPrice+ "\nbuyoutPrice:" +createdItem.buyoutPrice); itemSet.add(createdItem); } } What I am stuck on is building a method that will allow the user to view a list of current item auctions, basically a way to print out the itemSet ArrayList. I have looked into using toString() but I am unsure of how to get it to return more than one value, i.e auctionID, startPrice, buyoutPrice. Ideally I would like the user to select a choice such as "view current auctions" and then the method to print the entire ArrayList in a format such as "Auction ID: **** Start Price: **** Buyout Price: ****" with obviously the **** being the number the user inputted.
favorite count: 0
possible better answer: http://stackoverflow.com/a/26807108
score: 6

http://stackoverflow.com/a/66960985
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26716213
score: 1
has body: The glassfish container depends on its version, seems to have overridden your default JDK Keystore file to its own path. If other java apps in this machine work fine, the only issue is glassfish can't work, try this System.clearProperty("javax.net.ssl.trustStore"); //add in servlet init() This should run once when the servlet starts up, it will override glassfish Keystore with system default Keystore, which should work fine. If your servlet doesn't have an init, add this into your startup servlet class: @Override public void init() throws ServletException { super.init(); System.clearProperty("javax.net.ssl.trustStore"); } If your JDK needs to work with this property, you need to set it in a different manner. Why? Run this code in a normal environment (without any containers, just compile and run.) Then run it inside of your servlet, with your Web App(Instead of system println, You can print the result on a sample webpage.) System.out.println(System.getProperty("javax.net.ssl.trustStore")); You can see that with/without glassfish, results come out quite differently. Result with glassfish: /Users/jianqing/GlassFish_Server/glassfish/domains/domain1/config/cacerts.jks Result without glassfish: null Everything works fine again when it's set to null.
downvote count: 0

http://stackoverflow.com/a/26739427
has comment: http://stackoverflow.com/comment/42064983
accepted answer of: http://stackoverflow.com/q/26738862
upvote count: 1
has body: Try these 1 ) Instead of barcode = data.getExtras try barcode = data.getStringExtra("barcode") 2) Instead of initiating barcode String barcode; Try doing this in your onActivityResult, String barcode = data.getExtras().getString("barcode"); 3 ) Instead of putting data directly into intent, use a bundle. Bundle b = new Bundle(); b.putString ("barcode", rawResult.getContent()); Intent i = new intent(); i.putExtras (b); In your onActivityResult Bundle b = getIntent.getExtras(); String s = b.getString("barcode"); Then use s where you need it.
has comment: http://stackoverflow.com/comment/42066239
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42065611
answers question: http://stackoverflow.com/q/26738862
has comment: http://stackoverflow.com/comment/42065779
has comment: http://stackoverflow.com/comment/42064916
type: Answer
has comment: http://stackoverflow.com/comment/42066383
has comment: http://stackoverflow.com/comment/42066323
has comment: http://stackoverflow.com/comment/42066506
downvote count: 0
has comment: http://stackoverflow.com/comment/42067984
has comment: http://stackoverflow.com/comment/42065392
has comment: http://stackoverflow.com/comment/42067138
score: 1

http://stackoverflow.com/q/26803620
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
tagged with: jquery
tagged with: ajax
score: 0
has title: Delete image with Ajax from database mysql (using Spring MVC+Hibernate)
has body: I am trying to delete an image from my gallery without refresh the page. The solution is use Ajax but i don't known how because i am newbie with ajax. This is the code used for delete image from my database and this is implemented in my DAOImpl: @Override public void eliminaImage(int id_foto) { Image imageDaEliminare; Criteria crit = sessionFactory.getCurrentSession().createCriteria(Image.class); crit.add(Restrictions.eq("id_foto", id_foto)); imageDaEliminare = (Image) crit.uniqueResult(); Session session = sessionFactory.getCurrentSession(); session.delete(imageDaEliminare); session.flush(); } This my controller that are used for show gallery and delete image from it: @RequestMapping(value = "/homeUtente", method = RequestMethod.GET) public ModelAndView getIndex(){ ModelAndView mav = new ModelAndView(); mav.addObject("galleria", usersService.getAllFoto()); return mav; } @RequestMapping(value="/homeUtente", method = RequestMethod.POST) public ModelAndView eliminaImage(HttpServletRequest request,@RequestParam("id_foto") int id_foto) { usersService.eliminaImage(id_foto); ModelAndView mav = new ModelAndView(); mav.addObject("galleria", usersService.getAllFoto()); return mav; } And this is my view page: <c:forEach var="gallery" items="${galleria}"> </c:forEach> Finally i tried to write this ajax code for delete image but i don't know how hide the deleted image: $('.elimina').each(function(){ $.ajax({ url:"homeUtente", type:'post', data:{id:'this.id_foto'}, success:function(result){ //TO IMPLEMENT! } error:function(err){ } }));
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26804119
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26803779

http://stackoverflow.com/comment/42109117
comment on: http://stackoverflow.com/a/26764055
type: Comment
score: 2
type: AnswerComment
has text: The key thing to point out is that this worked in earlier versions of JavaFX but was changed in JavaFX 8. See [this](http://stackoverflow.com/a/23109125/577417) post for more details.

http://stackoverflow.com/comment/42186648
comment on: http://stackoverflow.com/a/26806813
score: 0
type: AnswerComment
has text: You beat me to it :) At least I got a reference to joda.org in there.
type: Comment

http://stackoverflow.com/comment/42245293
has text: Hi Serge, Find my spring project web.xml attached with the same query. Still i'm failing to get the proper symbols! Thanks for ur reply.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26782063

http://stackoverflow.com/comment/42156692
has text: I can uninstall eclipse, but how do i do that for java runtime, and jdk? Thats what i though something was missing bc it wouldn't find it (path). I had mavericks earlier and everything worked fine, i upgraded it from the app store and then it gave me this error
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26790216
type: Comment

http://stackoverflow.com/comment/42182311
score: 1
type: Comment
has text: How can we know? It depends on what you are trying to do.
type: QuestionComment
comment on: http://stackoverflow.com/q/26804592

http://stackoverflow.com/q/26690157
tagged with: groovy
has comment: http://stackoverflow.com/comment/41977329
has comment: http://stackoverflow.com/comment/41992284
has comment: http://stackoverflow.com/comment/41993049
type: UnansweredQuestion
has body: I've written the following build script: apply plugin: 'java' apply plugin: 'maven' project.group = 'API' repositories{ maven{ url 'C:/Documents and Settings/Admin/bundaven' } } dependencies{ compile 'API:API:1.0' } uploadArchives{ repositories{ mavenDeployer{ repository(url: "C:/Documents and Settings/Admin/bundaven") } } } But when I was runnig that the following error was thrown: Could not publish configuration 'archives' Error deploying artifact 'API:upload_archive:jar': Error deploying artifact : Unsupported Protocol: 'C': Cannot find wagon which supports the requested prot ocol: C Couln you possibly help me to fix that error?
answer count: 0
tagged with: gradle
type: Question
has title: Upload archive into a maven repository fail
tagged with: java
score: 0

http://stackoverflow.com/q/26737401
has title: Equivalent of LINQ in Java 8
tagged with: java
has answer: http://stackoverflow.com/a/26737493
type: Question
answer count: 2
tagged with: .net
accepted answer: http://stackoverflow.com/a/26737493
tagged with: linq
linked to: http://stackoverflow.com/q/1217228
has body: Is there an equivalent to LINQ in java 8? Did lambda expression fill this role?
downvote count: 0
has answer: http://stackoverflow.com/a/26737421
duplicate of: http://stackoverflow.com/q/1217228
favorite count: 0
score: 6
possible better answer: http://stackoverflow.com/a/26737421
tagged with: lambda
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/q/26811771
answer count: 2
has comment: http://stackoverflow.com/comment/42195906
has title: Why System.out.println() doesn't print the string
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26811809
type: Question
linked to: http://stackoverflow.com/q/21585536
has answer: http://stackoverflow.com/a/26811807
has body: public class Main { public static void main(String[] args) { String str1 = new String("Haseeb"); String str2 = new String("Haseeb"); System.out.println("str1==str2" + str1==str2 ); } } output is "false" I am expecting "str1==str2 false"
has comment: http://stackoverflow.com/comment/42196158
score: 0

http://stackoverflow.com/comment/42032022
comment on: http://stackoverflow.com/q/26720992
score: 5
type: Comment
type: QuestionComment
has text: Good job for posting this with a short, compilable example.

http://stackoverflow.com/q/26791441
has answer: http://stackoverflow.com/a/26825421
has answer: http://stackoverflow.com/a/26791826
has answer: http://stackoverflow.com/a/26882682
has comment: http://stackoverflow.com/comment/42189719
has comment: http://stackoverflow.com/comment/42225895
has answer: http://stackoverflow.com/a/26791459
has answer: http://stackoverflow.com/a/26879640
has comment: http://stackoverflow.com/comment/42199067
has answer: http://stackoverflow.com/a/26835963
has comment: http://stackoverflow.com/comment/42308402
has answer: http://stackoverflow.com/a/26791498
tagged with: java
has answer: http://stackoverflow.com/a/26791760
has answer: http://stackoverflow.com/a/26921745
tagged with: replace
upvote count: 166
has answer: http://stackoverflow.com/a/26796725
has answer: http://stackoverflow.com/a/26821761
linked to: http://stackoverflow.com/q/5034442
tagged with: string
has answer: http://stackoverflow.com/a/26819171
has answer: http://stackoverflow.com/a/26877910
has body: Let's say that I have the following code: String word1 = "bar"; String word2 = "foo"; String story = "Once upon a time, there was a foo and a bar." story = story.replace("foo", word1); story = story.replace("bar", word2); After this code runs, the value of story will be "Once upon a time, there was a foo and a foo." A similar issue occurs if I replaced them in the opposite order: String word1 = "bar"; String word2 = "foo"; String story = "Once upon a time, there was a foo and a bar." story = story.replace("bar", word2); story = story.replace("foo", word1); The value of story will be "Once upon a time, there was a bar and a bar." My goal is to turn story into "Once upon a time, there was a bar and a foo." How could I accomplish that?
has answer: http://stackoverflow.com/a/26791724
has comment: http://stackoverflow.com/comment/42161922
has comment: http://stackoverflow.com/comment/42192223
has answer: http://stackoverflow.com/a/26876298
has answer: http://stackoverflow.com/a/27044111
has comment: http://stackoverflow.com/comment/42217165
has answer: http://stackoverflow.com/a/26850191
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26886202
accepted answer: http://stackoverflow.com/a/26791724
has answer: http://stackoverflow.com/a/26909273
has answer: http://stackoverflow.com/a/26826286
has comment: http://stackoverflow.com/comment/42198174
has comment: http://stackoverflow.com/comment/42211561
has answer: http://stackoverflow.com/a/26792111
has comment: http://stackoverflow.com/comment/42166797
favorite count: 0
has answer: http://stackoverflow.com/a/26791582
score: 164
type: Question
answer count: 25
has answer: http://stackoverflow.com/a/26888875
has answer: http://stackoverflow.com/a/26841632
downvote count: 2
has title: How can I replace two strings in a way that one does not end up replacing the other?
has answer: http://stackoverflow.com/a/26791670
possible better answer: http://stackoverflow.com/a/26791459

http://stackoverflow.com/q/26805083
has comment: http://stackoverflow.com/comment/42183267
has title: Encoding apostrophes in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26805193
accepted answer: http://stackoverflow.com/a/26805193
tagged with: java
type: Question
has body: I have a String containing an RSS feed. My problem is that there is an encoding problem with the apostrophes. Here's what my String contains : 67â€™s and Wolves trade defencemen The Ottawaâ€™s 67â€™s and Sudbury Wolves swapped defencemen in a trade on Tuesday, with the 67â€™s /summary> As you can see, i got this â€™ caracter everywhere, how i can resolve this ? Thanks.
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26805172
has comment: http://stackoverflow.com/comment/42183368
has answer: http://stackoverflow.com/a/26805172
tagged with: string

http://stackoverflow.com/comment/41986968
has text: I'm trying to pre-create them because it takes roughly 30 seconds to create each object. I'm not interested in simply offering a RESTful shim, i'd like to offer some speed so if there's an opportunity to seize some "whitespace" in the idle background where my service can work and generate these objects, then I'd like to shoot for it. Regardless of whether it's optimal design, is there a simple way to trigger some code on server startup?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26695035

http://stackoverflow.com/q/26790722
tagged with: mysql
type: Question
answer count: 1
has title: Communicating with MySql using Java (JDBC) using separate classes
score: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/26796866
has body: I have done a lot of testing with example code online, and have got things to work when it comes to reading from, and adding fields to a MySql database. As I have been progressing along, I am now trying to implement it all to a more advanced setup – using multiple files, building my way up towards a MVC structure… (at least a brave attempt!) I have come to a point, where I can’t really see why it doesn’t work… getting blind here! :/ Please see the attached code. Tried to strip it down to the actual problem to explain it as best as I can; (sorry for all the GUI code. – I’ll blame the WindowBilder plug-in!) I have a button in my "NewContact.java" class, that collects the content (user input) of the textfields, and adding it to the String query = "INSERT INTO contact….” btnAddContact.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textfield_firstname.getText(); textfield_surname.getText(); mysqlitem = new DBConnect(); mysqlitem.runQuerytoDB(); String query = "INSERT INTO contact (`firstname`, `surname`) VALUES ('" + textfield_firstname + "', '" + textfield_surname + "' )"; try { mysqlitem.resultSet = mysqlitem.statement.executeQuery(query); } catch (Exception e1) { //this is where it fails!!!! e1.printStackTrace(); } } }); ...so to the question : -Does this line of code mysqlitem.resultSet = mysqlitem.statement.executeQuery(query); send the query to the database online? This is where it fails: try { mysqlitem.resultSet = mysqlitem.statement.executeQuery(query); } catch (Exception e1) { //this is where it fails!!!! e1.printStackTrace(); -What am I missing here? Why do I end up in the catch Exeption...(?) I think I am missing some code to send the query to my database. But I am not sure what and where... Here are my files: GUI.java package view; import java.awt.CardLayout; public class GUI extends JFrame { private static final long serialVersionUID = -8116151922074331976L; private JDesktopPane desktopPane; private JPanel contentPane;…
type: UnansweredQuestion
tagged with: dependency-injection
linked to: http://stackoverflow.com/q/20587996
linked to: http://stackoverflow.com/q/10915375
tagged with: java

http://stackoverflow.com/a/26697855
type: Answer
upvote count: 1
has body: You are adding the same Employee object multiple times to the list. That's why all the Employees in the list have the same data (since they are the same object). You have to create a new instance before each time you want to add an Employee to the list. List&lt;Employee&gt; emps = new ArrayList&lt;Employee&gt;(); Employee emp = new Employee (); // create first employee emp.A = 10; emps.add(emp); // add first employee emp = new Employee(); // create second employee emp.A = 13; emps.add(emp); // add second employee
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26697849
has comment: http://stackoverflow.com/comment/41990098
has comment: http://stackoverflow.com/comment/41990073
has comment: http://stackoverflow.com/comment/41990128

codahale-metrics
tag name: codahale-metrics
tags question: http://stackoverflow.com/q/26697880
type: Tag

http://stackoverflow.com/a/26730281
has body: 1) Try the following (I would expect this to work, but Hibernate may not play this way): @Entity @Table(name="part") @SecondaryTable(name="supplement", pkJoinColumns ={@PrimaryKeyJoinColumn="id"}) public class Part{ @Id @GeneratedValue private Integer id; private String poNo; private String partNo; private String partDesc; private String eccNo; @Column(table="supplement") @Basic(optional=true) private String vernderPartNo; @Column(table="supplement") @Basic(optional=true) private String exportHSCCode; ... getter and setter... } 2) You'll need to change how your keying Part. You've defined its primary key as an auto incremented integer...that's gonna be your foreign key in the supplement table. This is actually how JPA wants you to do it (I say that because the JPA specification calls natural keys "legacy"). You have a couple options here: remove the autoincrement from the Part entity and create a "composite key" class with just the poNo and partNo, and add that class as a field to Part. This will become your Part primary key, and will be the foreign key used in your supplement table. Forget foreign keys and instead add a @UniqueConstraint to your Part for those two columns (this isn't going to fix your foreign key issue, but it does enforce the constraint you identified)
type: Answer
has comment: http://stackoverflow.com/comment/42050052
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26730047
answers question: http://stackoverflow.com/q/26730047

http://stackoverflow.com/a/26728271
type: Answer
has body: You have to Create a New Common Database for your projects. Run both the projects in ecllipse individually. Copy the Contents of any one project into another.
answers question: http://stackoverflow.com/q/26728191
score: 0

http://stackoverflow.com/a/26784033
score: 1
has body: You can only switch on compile time constants. I think what you're trying to achieve could be done with a simple if statement. if (a.y == a.x) { // do stuff. } Since constants in Java are compile time, "re-initializing" does not make sense as a concept.
upvote count: 1
has comment: http://stackoverflow.com/comment/42146004
answers question: http://stackoverflow.com/q/26783919
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42128045
score: 0
type: AnswerComment
type: Comment
has text: I rewrote the code, but it did not solve the problem
comment on: http://stackoverflow.com/a/26774388

http://stackoverflow.com/comment/42050146
has text: Add complete stacktrace please.
score: 4
comment on: http://stackoverflow.com/q/26731327
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42228811
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26824620
has text: In addition to that, I KNOW that it is properly reading from the database, because it's pulling in the same amount of null rows that the database contains.

http://stackoverflow.com/q/26723994
accepted answer: http://stackoverflow.com/a/26724462
has comment: http://stackoverflow.com/comment/42038318
has comment: http://stackoverflow.com/comment/42037750
answer count: 4
has comment: http://stackoverflow.com/comment/42037843
favorite count: 0
tagged with: interface
tagged with: marker-interfaces
has answer: http://stackoverflow.com/a/26724462
score: 11
tagged with: java-8
has comment: http://stackoverflow.com/comment/42037775
type: AnsweredQuestion
tagged with: default-method
has title: can marker interface like serializable contain default methods?
tagged with: java
has body: I think it can't, because marker interface principle is to not have any methods, but since default methods are not abstract I am not sure.
has answer: http://stackoverflow.com/a/26724804
has comment: http://stackoverflow.com/comment/42038095
type: Question
downvote count: 2
possible better answer: http://stackoverflow.com/a/26724488
upvote count: 13
has comment: http://stackoverflow.com/comment/42037565
has comment: http://stackoverflow.com/comment/42037521
has answer: http://stackoverflow.com/a/26740703
has answer: http://stackoverflow.com/a/26724488
has comment: http://stackoverflow.com/comment/42038433

http://stackoverflow.com/comment/41966541
comment on: http://stackoverflow.com/a/26682913
score: 0
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64070/discussion-between-reimeus-and-mr37037).
type: Comment

http://stackoverflow.com/comment/42190040
has text: Please switch to JOGL 2 first. JOGL 1 maintenance was stopped in 2010. There should be a call to glBegin per call to glEnd which isn't the case in your code. Just as a reminder, we're here to help you, not to do your homework or assignment.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26791041
score: 1

http://stackoverflow.com/q/26784152
type: UnansweredQuestion
has body: I dont always have square/rectangle images, sometimes I should match round images as well. Below are 2 images for example. Ball is the template image and the second is Source where the template should be searched. I can make the background of template transparent, but this gives error, making it white decreases the match score, because as you see on the Source image there is no white around the ball. These are just 2 examples pictures. Do you have suggestions/solutions?
has answer: http://stackoverflow.com/a/26792586
tagged with: java
tagged with: image-processing
has title: OpenCV Template Matching for Round Images in Java
type: Question
tagged with: opencv
tagged with: template-matching
has answer: http://stackoverflow.com/a/26793014
tagged with: image
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26791932

http://stackoverflow.com/q/26817615
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42209083
accepted answer: http://stackoverflow.com/a/26908045
score: 3
tagged with: spring
tagged with: spring-mvc
upvote count: 3
has comment: http://stackoverflow.com/comment/42206038
type: AnsweredQuestion
has body: On webapp start, it should connect to the socket and keep listening to events on the socket until the lifecycle of the webapp (forever, until of course tomcat is killed). I have been searching for quite some time, but background tasks just return after their execution is done, but I want the thread to be alive to receive incoming data on the socket. Any help ?
has answer: http://stackoverflow.com/a/26832982
tagged with: java
has title: how to create a background task in spring to keep listening to data on TCP socket
has answer: http://stackoverflow.com/a/26908045
type: Question
possible better answer: http://stackoverflow.com/a/26832982

http://stackoverflow.com/a/26850191
downvote count: 0
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26791441
has body: If you don't want any dependencies, you could simply use an array which allows a one-time change only. This is not the most efficient solution, but it should work. public String replace(String sentence, String[]... replace){ String[] words = sentence.split("\\s+"); int[] lock = new int[words.length]; StringBuilder out = new StringBuilder(); for (int i = 0; i &lt; words.length; i++) { for(String[] r : replace){ if(words[i].contains(r[0]) &amp;&amp; lock[i] == 0){ words[i] = words[i].replace(r[0], r[1]); lock[i] = 1; } } out.append((i &lt; (words.length - 1) ? words[i] + " " : words[i])); } return out.toString(); } Then, it whould work. String story = "Once upon a time, there was a foo and a bar."; String[] a = {"foo", "bar"}; String[] b = {"bar", "foo"}; String[] c = {"there", "Pocahontas"}; story = replace(story, a, b, c); System.out.println(story); // Once upon a time, Pocahontas was a bar and a foo.

http://stackoverflow.com/comment/42020297
has text: Like this at the context.xml? ` ${from.email.default} ` And this at the pom.xml? `<from.email.default>xxx@xxx.com.br</from.email.default>`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26714607
score: 0

http://stackoverflow.com/a/26792111
type: Answer
answers question: http://stackoverflow.com/q/26791441
upvote count: 3
has body: If you want to be able to handle multiple occurrences of the search strings to be replaced, you can do that easily by splitting the string on each search term, then replacing it. Here is an example: String regex = word1 + "|" + word2; String[] values = Pattern.compile(regex).split(story); String result; foreach subStr in values { subStr = subStr.replace(word1, word2); subStr = subStr.replace(word2, word1); result += subStr; }
downvote count: 0
score: 3

http://stackoverflow.com/q/26822626
tagged with: layout
linked to: http://stackoverflow.com/q/6592468
score: 0
answer count: 2
has title: java change size of Textfield
has body: I want to make a frame where you have to enter your name and stuff. I try to make it like, name: textfield, next line, age: textfield and so on... But the textfield is really high. If I add 2 textfields in one panel in the frame, one textfield contains half of my screen. I try to fix this with a layout manager but I have no idea how. Could someone please help me? Here's my code: import javax.swing.*; import java.awt.event.*; import java.awt.*; class GUI{ public static void main(String [] args){ GUI g = new GUI(); g.Start(); } public void Start(){ JFrame frame = new JFrame(); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setSize(640, 640); JPanel panel = new JPanel(); JPanel west = new JPanel(); JLabel name = new JLabel("Name: "); JLabel age = new JLabel("Age: "); JTextField field1 = new JTextField(); JTextField field2 = new JTextField(); west.setLayout(new BoxLayout(west, BoxLayout.Y_AXIS)); west.add(name); west.add(age); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(field1); panel.add(field2); frame.getContentPane().add(BorderLayout.CENTER, panel); frame.getContentPane().add(BorderLayout.WEST, west); frame.setVisible(true); } }
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26822662
tagged with: swing
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/26822644

http://stackoverflow.com/comment/42165830
type: Comment
has text: sorry, my question is not clear enough; I want to know whether there is a "sorted" data structure that did operation in O(logN) and support position based deletion thus can be done in constant time.
type: QuestionComment
comment on: http://stackoverflow.com/q/26795798
score: 0

http://stackoverflow.com/comment/42010624
type: Comment
has text: Still Im getting the same error: D/xxx(27091): in while current:3148854 11-03 02:10:27.793: D/skia(27091): --- SkImageDecoder::Factory returned null what changes should be done in reciever(android client)?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26709198

http://stackoverflow.com/comment/42109982
type: QuestionComment
comment on: http://stackoverflow.com/q/26764405
score: 0
type: Comment
has text: Dici is right. This program is wrong on too many levels. Try to consider: what is the purpose of `a`, `max` and `input`? Use either a debugger or just pen and paper, and try to run a few loops, note the values of the variables, and think if this is what you expected them to do.

http://stackoverflow.com/q/26699019
tagged with: java
has body: To get a servlet request in Struts 2 we can use either ServletRequestAware or ServletActionContext. However, in a particular internet resource, it is told that ServletRequestAware should be used instead of ServletActionContext. Does that have something to do with the fact that ServletActionContext will be a shared resource in a multi-threaded environment or is there any other reason behind this?
type: Question
answer count: 2
has title: Why use ServletRequestAware instead of ServletActionContext?
downvote count: 0
possible better answer: http://stackoverflow.com/a/26705015
tagged with: struts2
tagged with: servlets
has answer: http://stackoverflow.com/a/26705015
accepted answer: http://stackoverflow.com/a/26699159
tagged with: actioncontext
favorite count: 0
upvote count: 2
tagged with: multithreading
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26699159

http://stackoverflow.com/q/26774482
score: 0
linked to: http://stackoverflow.com/q/26776583
tagged with: ipojo
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26797936
tagged with: java
has title: Change dynamically "from" in iPOJO metadata
type: Question
has body: I have a problem relating to iPOJO, as example: I define and deploy a component A which provide a “HelloService” service (interface). And an instance of component A named “instance_A” I define also a component B requiring “HelloService” service in A. the implementation of B declared a dependency: HelloService hello; And in metadata.xml, I declare: &lt;ipojo&gt; &lt;component classname="B_class" name="B" immediate="true"&gt; &lt;requires field=" hello" from="instance_A"&gt; &lt;/requires&gt; &lt;/component&gt; &lt;instance component="B" name="call"/&gt; &lt;/ipojo&gt; Now, I want implement a component C to dynamically control change (from="instance_A") in metadata to another (ex. from="instance_D") How I can do it (component C) to change this "from"? Thanks in advance

http://stackoverflow.com/a/26738067
answers question: http://stackoverflow.com/q/26737852
upvote count: 5
has body: use Integer.toHexString(i) instead of your own
score: 3
has comment: http://stackoverflow.com/comment/42070006
downvote count: 2
type: Answer

http://stackoverflow.com/comment/42277508
comment on: http://stackoverflow.com/a/26814439
score: 0
type: Comment
has text: Projections are useful when selecting only parts of an entity. You can also map the selected columns to a DTO. For fetching entities you don't need projections
type: AnswerComment

http://stackoverflow.com/q/26706987
answer count: 1
has comment: http://stackoverflow.com/comment/42006841
favorite count: 0
has body: In java 7, the Servlet interface is in package "javax.servlet". That interface defines a "service" method that returns void and accepts ServletRequest and ServletResponse as input parameters. Why was it designed to return void instead of ServletResponse? I'm interested in api design and it seems counter-intuitive. But there's probably a good reason for it. http://docs.oracle.com/javaee/7/api/index.html?javax/servlet/ServletRequest.html
tagged with: void
score: 2
type: AnsweredQuestion
has title: Why was Servlet.service designed to return void?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26707140
accepted answer: http://stackoverflow.com/a/26707140
tagged with: servlets
upvote count: 3
tagged with: api
downvote count: 1

http://stackoverflow.com/a/26732789
score: 1
has body: I think you have to use Dexmaker. Take a look to this thread: Mockito Android dynamic proxies
answers question: http://stackoverflow.com/q/26732406
has comment: http://stackoverflow.com/comment/42096476
has comment: http://stackoverflow.com/comment/42123374
has comment: http://stackoverflow.com/comment/42104479
has comment: http://stackoverflow.com/comment/42090658
has comment: http://stackoverflow.com/comment/42095691
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42096490
has comment: http://stackoverflow.com/comment/82969732

http://stackoverflow.com/comment/42206716
type: QuestionComment
comment on: http://stackoverflow.com/q/26817224
type: Comment
has text: I don't understand how seeing sources (reflection in .Net) will help me alter the logic of the .jar file.
score: 0

http://stackoverflow.com/q/26762660
has title: Error reading an integer
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42106591
tagged with: java
has body: I am getting an error when I try to read an integer with scanner. I'm using Scanner to read it then add it to a switch. public class Main{ public static void main(String [] args) throws FileNotFoundException { int switchVar = 0; Scanner sc = new Scanner("System.in"); while(switchVar != 5) { System.out.println("op"); switchVar = sc.nextInt(); switch(switchVar) { case 1 : //Data case 2 : //Data } } sc.close(); } } The console error: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at Main.main(Main.java:18) Line 18 is switchVar = sc.nextInt(); Thank you.
has answer: http://stackoverflow.com/a/26762755
type: Question
score: 0

http://stackoverflow.com/a/26756819
type: Answer
answers question: http://stackoverflow.com/q/26756589
has body: @xavier solution is great this is just another point of view. String strDatos=""75.00 470.00 500.00";"; StringTokenizer tokens=new StringTokenizer(strDatos, " ");//second parameter specify separator double sum = 0; while(tokens.hasMoreTokens()){ String str=tokens.nextToken(); sum+=Double.valueOf(str).doubleValue(); }
score: 0

http://stackoverflow.com/comment/42142512
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26781201
score: 1
has text: I've never seen this, does it occur in a later EclipseLink version as well?

http://stackoverflow.com/q/26815752
answer count: 2
has body: I need to handle HTTP requests using com.sun.net.httpserver.HttpServer which requests are triggered by the following URL schema: http://somehost:9000/&lt;var&gt;/&lt;service&gt; &lt;var&gt; is a parameter which is passed to the &lt;service&gt; &lt;service&gt; is a predefined service that the server provides The problem is that the context path is not known at compile time (because of the &lt;var&gt;) so I can not just call createContext(String path, HttpHandler handler). How can I bind this kind of 'dynamic' context to a specific HttpHandler instance?
has comment: http://stackoverflow.com/comment/42202449
has comment: http://stackoverflow.com/comment/42453453
has answer: http://stackoverflow.com/a/26960109
accepted answer: http://stackoverflow.com/a/26960109
score: 8
favorite count: 0
has title: Create dynamically contexts for com.sun.net.httpserver.HttpServer (Java)
possible better answer: http://stackoverflow.com/a/52990880
has answer: http://stackoverflow.com/a/52990880
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: httpserver
upvote count: 8
type: Question

http://stackoverflow.com/a/26713383
has comment: http://stackoverflow.com/comment/42017734
has comment: http://stackoverflow.com/comment/42017806
has comment: http://stackoverflow.com/comment/42017538
accepted answer of: http://stackoverflow.com/q/26713270
has comment: http://stackoverflow.com/comment/42018369
has comment: http://stackoverflow.com/comment/42017480
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42017679
has comment: http://stackoverflow.com/comment/42017567
has comment: http://stackoverflow.com/comment/42017673
has comment: http://stackoverflow.com/comment/42018631
type: Answer
has comment: http://stackoverflow.com/comment/42017601
has comment: http://stackoverflow.com/comment/42017832
has comment: http://stackoverflow.com/comment/42017899
score: 1
answers question: http://stackoverflow.com/q/26713270
upvote count: 1
has body: Try this code &lt;a href="#" onclick="callServlet()"&gt;&lt;img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_buynow_pp_142x27.png" alt="PayPal - The safer, easier way to pay online!"&gt;&lt;/a&gt; EDIT: Finally we discovered that a servlet should be mapped without extension and doGet method is used to get the request from javascript.

http://stackoverflow.com/comment/41972015
type: Comment
type: QuestionComment
has text: Sample for the class plz?
score: 0
comment on: http://stackoverflow.com/q/26687255

http://stackoverflow.com/q/26776318
possible better answer: http://stackoverflow.com/a/26977166
has body: I have a jar file with two main classes. Depending on what I need I can run one or the other. To have this application run via webstart I created two JNLP files, each of them referencing one of the two main classes. It is mindboggling to see that only one of the main classes is started from both files! What I know is the class that gets fired up is also the one listed as main-class in the jar's manifest. I tried to read the webstart specs, the webstart documentation but cannot find anything related to the manifest here. When I tried to look at the source code (shipped with the Oracle JDK) I did not see much related to the webstart launcher at all. So how exactly does webstart find its main class?
has answer: http://stackoverflow.com/a/26977166
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26776487
type: Question
tagged with: java-web-start
score: 0
answer count: 2
has title: How does Webstart determine the main class?
tagged with: mainclass
has answer: http://stackoverflow.com/a/26776487

http://stackoverflow.com/q/26733455
tagged with: java
linked to: http://stackoverflow.com/q/1051295
has title: How to get size of NFS Export point at client side?
type: Question
has body: Can anyone please tell me how to get the size of the NFS Export point at the client side if the export point is available? Is there any command / Java API available for the same?
tagged with: nfsclient
score: 0
tagged with: nfs
accepted answer: http://stackoverflow.com/a/26749500
answer count: 1
has answer: http://stackoverflow.com/a/26749500
type: AnsweredQuestion

http://stackoverflow.com/q/26817812
has title: Java InputStream End of File for Serial Connection
has comment: http://stackoverflow.com/comment/42205963
tagged with: serial-port
has comment: http://stackoverflow.com/comment/42206087
linked to: http://stackoverflow.com/q/5219450
answer count: 0
type: UnansweredQuestion
has body: I'm struggling with EOF on a serial port and using a Java InputStream. My serial device sends continuously 16 bytes with a frequency of 100Hz. My receive routine is similar to this private static final int MESSAGE_SIZE = 20; public byte[] read() throws IOException { final byte[] buffer = new byte[MESSAGE_SIZE]; int total = 0; int read = 0; while (total &lt; MESSAGE_SIZE &amp;&amp; (read = in.read(buffer, total, MESSAGE_SIZE - total)) &gt;= 0) { total += read; } return buffer; } posted and proved here. As result, I get a mixture between the 16 bytes packets and EOF. How can EOF occur on a serial port?
tagged with: java
tagged with: inputstream
type: Question
has comment: http://stackoverflow.com/comment/42209099
linked to: http://stackoverflow.com/q/13711594
linked to: http://stackoverflow.com/q/11805300
tagged with: eof
score: 0

http://stackoverflow.com/a/26779610
score: 1
has comment: http://stackoverflow.com/comment/42137237
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26779567
type: Answer
answers question: http://stackoverflow.com/q/26779567
downvote count: 0
has body: Remove the context loader listener. You only need that if you have to initialize a parent context. The contexts from the dispatcher servlet are standalone, but could access such parent contexts if needed, i.e. to retreive a service or dao.

http://stackoverflow.com/q/26823324
accepted answer: http://stackoverflow.com/a/26823416
has body: I have two constructors for Student and am trying to use both of them with one object. But I should be doing it wrong because my output is not what I expect it to be. Output: School: null Grade Level: 0 Intended Major: null Student's ID number is: 154324 Student's name: Sam Bay Student's GPA: 3.56 Code for class definition: public class Student { private int id, gradeLevel; private String name, school, major; private double gpa; //constructor to initialize the instance variables of student object public Student(int id, String name, double gpa) { this.id = id; this.name = name; this.gpa = gpa; } public Student(int gradeLevel, String school, String major) { this.gradeLevel = gradeLevel; this.school = school; this.major = major; } //toString() to display the attributions of the student object public String toString() { return "School: " + school + "\nGrade Level: " + gradeLevel + "\nIntended Major: " + major + "\n" + "\nStudent's ID number is: " + id + "\nStudent's name: " + name + "\nStudent's GPA: " + gpa; } }//end class code for main: public class StudentDrive { public static void main(String [] args) { //creating student objects Student sam = new Student(12, "Alpha High School", "Biology"); sam = new Student(154324, "Sam Bay", 3.56); System.out.println(sam); } } It seems like I've initialized the first part but I get null and 0??!!!
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/18999635
has comment: http://stackoverflow.com/comment/42215767
downvote count: 0
has answer: http://stackoverflow.com/a/26823392
has comment: http://stackoverflow.com/comment/42215752
possible better answer: http://stackoverflow.com/a/26823392
has answer: http://stackoverflow.com/a/26823416
has comment: http://stackoverflow.com/comment/42215778
favorite count: 0
score: 2
upvote count: 2
has title: Using multiple constructors with one object in Java
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26742593
answer count: 1
tagged with: n-tier-architecture
has title: Is there any JavaEE architecture where business logic layer is dedicated?
upvote count: 2
has comment: http://stackoverflow.com/comment/42070948
tagged with: jakarta-ee
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26743657
tagged with: java
has body: Supposing a classical 3-tier JavaEE architecture like this JSF / JSP / Servlets (Web) EJB (Biz) DB (Persistence) All JavaEE tutorial examples show the web and biz layers in different containers, but in the same JavaEE server. Is there any situation where there is an advantage to keep the EJBs apart, in their own machine? In this case, supposing they're going to communicate with the web tier via RMI, is there any kind of JavaEE container that manages EJBs but not JSP and servlets?
type: Question
score: 2
tagged with: ejb
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26743657

http://stackoverflow.com/a/50043289
has comment: http://stackoverflow.com/comment/106908283
has comment: http://stackoverflow.com/comment/97364855
has body: I've written a utility for converting XML to XML (log4j.xml to concise log4j2.xml). Using JAXB and FreeMarker, it makes a few assumptions about the input and doesn't support all features, but also saves comments assuming that the input file is reasonably formatted. It can hopefully be easily modified for your own requirements: https://github.com/farnetto/log4jconverter
downvote count: 1
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/137423380
score: 3
answers question: http://stackoverflow.com/q/26718495

http://stackoverflow.com/q/26727036
type: Question
has title: Spring: Unable to locate Spring NamespaceHandler for XML schema namespace
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26790423
tagged with: spring
linked to: http://stackoverflow.com/q/11160534
type: AnsweredQuestion
tagged with: java
has body: [http://www.springframework.org/schema/tx] I included the jar files in the maven pom.xml. The swing application works fine when I run it from within eclipse. However when I try to run it from a jnlp file, it throws this error. I have added the spring-tx jar in jnlp file. Here is my spring context 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: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.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> Here is the pom.xml: org.springframework spring-context-support ${org.springframework.version} org.springframework spring-tx ${org.springframework.version} org.springframework spring-core ${org.springframework.version} org.springframework spring-aop ${org.springframework.version} org.springframework spring-orm ${org.springframework.version}
has answer: http://stackoverflow.com/a/26790423

http://stackoverflow.com/q/26769412
tagged with: apache
upvote count: 3
downvote count: 2
answer count: 1
has title: How shall I convert String to Writable object in my Hadoop Mapper
favorite count: 0
tagged with: hbase
type: UnansweredQuestion
has body: This is a very crazy problem hitting me since a few hours. Any help would be highly appreciated. I am not able to public void map(Object key, Text value, Context context) throws IOException, InterruptedException { if (!value.toString().equals("")) { Gson gson = new Gson(); Boolean flag = true; System.out.println("000000000"); while(flag){ Text tweetId = new Text(); Tweet tweet = gson.fromJson(value.toString(), Tweet.class); tweetId.set(tweet.getRetweetStatus().getUser().getId().toString()); System.out.println("Tweet objects:" + tweet.toString()); System.out.println("ParentUserId:" + tweetId); context.write(tweetId, tweet); flag = false; } Text tweetId = new Text(); Tweet tweet = gson.fromJson(value.toString(), Tweet.class); tweetId.set(tweet.getUser().getId().toString()); String tweetReverse = (Object) tweet.getRetweetStatus().getUser().getId(); System.out.println("Reverse::"); System.out.println("Tweet objects:" + tweetReverse); System.out.println("ParentUserId:" + tweetId); context.write(tweetId, tweetReverse); } } I want to convert the String object 'tweetReverse' to Writable so that I can use it the context.write function. Is this even possible? What shall I do if not convert? If I change the generic type to String, then also I get problems in the class which extends Writable to reading and writing values. Any help would be highly appreciated. Thanks a lot in advance.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26771386
tagged with: twitter
type: Question
tagged with: hadoop

http://stackoverflow.com/q/26764560
has comment: http://stackoverflow.com/comment/42110791
has comment: http://stackoverflow.com/comment/42112606
answer count: 1
has comment: http://stackoverflow.com/comment/42110606
tagged with: generics
has comment: http://stackoverflow.com/comment/42110151
accepted answer: http://stackoverflow.com/a/26766174
favorite count: 0
has comment: http://stackoverflow.com/comment/42112067
tagged with: java-8
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
has body: In attempt to utilize only predefined functional interfaces from java.util.function I've started to wonder why it's not possible to specify varargs inside type declaration. For example I want to provide API which can be used like this object.method((x, y, z) -&gt; x + y - z) Where method takes mathematical function of n arguments. Here is what I want my object interface to look like interface I { I method(ToDoubleFunction&lt;double...&gt; f); } I do realize that I can define my own funcional interface, or change API slightly specifying double[] inside angle brackets. I'm curious only why mentioned above way of doing it is not feasible. Edit: In the comments there is an explanation why example above is not correct usage of varargs. Radiodef divided my quesion into two separated ones why vararg is not allowed as a generic argument and why you cannot declare and access vararg by name in Java. Due to the title of the question I have to stick with the first one. Here is expected behavior: ToDoubleFunction&lt;double...&gt; lambda = (double... d) -&gt; d[0] + d[1] - d[2]; lambda.applyAsDouble(1, 2, 3);
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26766174
has comment: http://stackoverflow.com/comment/42110271
has title: Specification of vararg inside type declaration
has comment: http://stackoverflow.com/comment/42111472

http://stackoverflow.com/comment/42026899
comment on: http://stackoverflow.com/q/26718336
score: 0
type: Comment
type: QuestionComment
has text: i don't see any adapter here. are you using this class in an adapter? if so, how?

http://stackoverflow.com/q/26756121
has answer: http://stackoverflow.com/a/26774900
score: 0
answer count: 1
has title: Query on clarification about RunLengthEncoding() constructor
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26727357
has body: For the Part III assignment given in link, Part III: Converting an Ocean to a Run-Length Encoding write a RunLengthEncoding constructor that takes an Ocean object as its sole parameter and converts it into a run-length encoding of the Ocean. To accomplish this, you will need to implement a sharkFeeding() method in the Ocean class, which tells you how hungry a given shark is. Read Ocean.java and RunLengthEncoding.java carefully for an explanation of what methods you must write. The fields of the Ocean class MUST be private, so the RunLengthEncoding constructor will rely upon the width(), height(), starveTime(), cellContents(), and sharkFeeding() methods. Testing Your RunLengthEncoding implementation is required to have a check() method, which walks through the run-length encoding and checks its validity. Specifically, it should print a warning message if any of the following problems are found: If two consecutive runs have exactly the same type of contents. For instance, an "F12" run followed by an "F8" run is illegal, because they should have been consolidated into a single run. (Don't forget, though, that sharks are divided based on how recently they've eaten.) If the sum of all run lengths doesn't equal the size (in cells) of the Ocean; i.e. its width times its height. You may find that the check() method is very useful in helping to debug your RunLengthEncoding constructors and addFish() and addShark() in Part IV. here is the incomplete solution: class RunLengthEncoding { /** * Define any variables associated with a RunLengthEncoding object here. * These variables MUST be private. */ private DList2 list; private long sizeOfRun; private int width; private int height; private static int starveTime; /** * The following method is required for Part III. */ /** * RunLengthEncoding() (with one parameter) is a constructor that creates * a run-length encoding of an input Ocean. You will need to implement * the sharkFeeding method in the Ocean class for this constructor's …
tagged with: oop
tagged with: java
type: Question

http://stackoverflow.com/comment/42275385
type: AnswerComment
comment on: http://stackoverflow.com/a/26853958
has text: It doesn't unfortunately. This method doesn't account for invisible elements
score: 0
type: Comment

http://stackoverflow.com/comment/42185664
has text: Doh, sorry. Just re-read and saw you're using XCC. What I posted above is for the Java Client API.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26806338

http://stackoverflow.com/comment/42051303
type: Comment
type: QuestionComment
has text: Here is a link to your question http://stackoverflow.com/questions/4283062/textwatcher-for-more-than-one-edittext
comment on: http://stackoverflow.com/q/26731936
score: 0

http://stackoverflow.com/q/26674729
has body: I have a small question about Java Hashmap. If I override the hashCode method such that: @Override public int hashCode(){ return 9; } This will cause all the HashMap keys to have the same index. Will they be placed in a linked list structure in the map or will the map only contain the last key which has replaced all the other keys?
tagged with: hashcode
has comment: http://stackoverflow.com/comment/41948821
score: 4
has answer: http://stackoverflow.com/a/26674964
answer count: 3
possible better answer: http://stackoverflow.com/a/26674815
has answer: http://stackoverflow.com/a/26674760
accepted answer: http://stackoverflow.com/a/26674760
has answer: http://stackoverflow.com/a/26674815
has title: How will Hashmap key behave if hash code is overridden such that it returns only a constant number?
favorite count: 0
has comment: http://stackoverflow.com/comment/41949079
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/22939639
type: Question
tagged with: hashmap

http://stackoverflow.com/comment/42188130
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26807684
has text: And where can I post this question plz ?
score: 0

http://stackoverflow.com/comment/42216551
score: 0
comment on: http://stackoverflow.com/q/26823141
type: Comment
type: QuestionComment
has text: I tried building with Maven from terminal, but still got the error. I added the exact command I used to the question.

http://stackoverflow.com/a/26702346
score: 2
has comment: http://stackoverflow.com/comment/41998184
has comment: http://stackoverflow.com/comment/41998167
downvote count: 0
has comment: http://stackoverflow.com/comment/41998150
has body: student variable is declared within the scope of the if/else, not outside, thus you cannot use it outside these blocks of code. If UndergradTA and GradTA have a common super class or interface, then declare the variable outside and use it accordingly: Student student = null; if (option==1) { student = new UndergradTA(); //cumbersome student.setIsUnderGrad(true); } else if(option==2) { student = new GradTA(); //cumbersome student.setIsGrad(true); } student.someMEthod(...);
type: Answer
answers question: http://stackoverflow.com/q/26702340
upvote count: 2

http://stackoverflow.com/a/26788513
downvote count: 0
has body: I just searched for the code of SparseIntArray. If you are referring to android.util.SparseIntArray, it doesn't override equals, which means it uses the default implementation of Object class, which compares the references. What is the point for having a base class Object.equals(Object other) method if we cant rely on it? Actually, you can't rely of the base class Object.equals, since it does precisely what you don't want to do: public boolean equals(Object obj) { return (this == obj); } It's up to the writers of any class to decide whether to override equals and give a different implementation.
answers question: http://stackoverflow.com/q/26788431
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26788431
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42153314
score: 3

entity-bean
tags question: http://stackoverflow.com/q/26777580
tag name: entity-bean
type: Tag

http://stackoverflow.com/comment/41971701
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26687044
has text: Would you mind to provide some code examples which could implement into my solution above?
type: AnswerComment

http://stackoverflow.com/a/27089910
has comment: http://stackoverflow.com/comment/42749722
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42707967
has body: Found a working solution: https://i.sstatic.net/63PHx.jpg import javax.swing.*; import javax.swing.text.html.HTMLEditorKit; public class test { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { // now add it all to a frame JFrame j = new JFrame("Test"); WorkBench right = new WorkBench(); JScrollPane sp = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); sp.setAutoscrolls(false); sp.setViewportView(right); j.getContentPane().add(sp, BorderLayout.CENTER); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); SwingUtilities.invokeLater(new Runnable() { public void run() { sp.getViewport().setViewPosition(new java.awt.Point(0, 0)); } }); // center the jframe, then make it visible j.setSize(800, 600); j.setLocationRelativeTo(null); j.setVisible(true); } }); } public static JPanel getPortal() { JEditorPane swingbox = new JEditorPane(); swingbox.setEditorKit(new HTMLEditorKit()); swingbox.setOpaque(true); swingbox.setContentType("text/html"); String htmlString = " \n" + " \n" + " Welcomfve! sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " This is an H2 header. sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " This is some sample text sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " devdaily blog \n" + " \n"; swingbox.setText(htmlString); swingbox.setBackground(Color.WHITE); JPanel p = new JPanel(new BorderLayout()); p.setBackground(Color.WHITE); JLabel title = new JLabel("Heading " ); title.setBackground(Color.WHITE); p.add(title, BorderLayout.NORTH); p.add(swingbox, BorderLayout.CENTER); return p; } public static class WorkBench extends JPanel implements Scrollable { Box vertical_box = null; public WorkBench() { setLayout(new BorderLayout()); this.vertical_box = Box.createVerticalBo…
has comment: http://stackoverflow.com/comment/42752869
type: Answer
has comment: http://stackoverflow.com/comment/42808501
accepted answer of: http://stackoverflow.com/q/26730983
upvote count: 1
answers question: http://stackoverflow.com/q/26730983
score: 1

http://stackoverflow.com/comment/108939434
has text: see here: https://github.com/seancfoley/IPAddress/wiki/Code-Examples#parse-prefixed-as-subnet-or-ip-address
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/55263916
score: 1

http://stackoverflow.com/a/26817961
answers question: http://stackoverflow.com/q/26817914
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42206161
has body: Have a look at the class java.util.Random. It has a nextInt(int n) method that returns a number between 0 and n-1 (inclusive).

http://stackoverflow.com/a/63804773
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26752919
has body: I would like to propose a solution using reduce(), which is more intuitive for me. I would use it inline though. Map&lt;String, Long&gt; toMap(Stream&lt;Map&lt;String, Long&gt;&gt; stream) { return stream.reduce(new HashMap&lt;&gt;(), Util::reduceInto); } And in Util.java: public static &lt;R, T&gt; Map&lt;R, T&gt; reduceInto(Map&lt;R, T&gt; into, Map&lt;R, T&gt; valuesToAdd) { reduceInto.putAll(valuesToAdd); return reduceInto; } In this case reduceInto() works for any type of map and uses mutability to avoid creating a new Map for each item of the Stream. Important: although this method allows repeated keys in the stream, reduceInto() is not associative, meaning that if you have repeated keys there is no guarantee of which will be the final value.

http://stackoverflow.com/q/26803373
tagged with: java
downvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/26803822
upvote count: 0
has comment: http://stackoverflow.com/comment/42180007
has comment: http://stackoverflow.com/comment/42180025
answer count: 1
favorite count: 0
has title: How to implement two spinners in android?
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26803822
tagged with: android
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42180110
has body: I am using the code available at the following link http://android-helper4u.blogspot.in/2013/03/d-databse-and-spinner-tutorial.html How to write setonItemSelectedListener for the two spinners.i want to fetch the selected data of the spinners from the database.

http://stackoverflow.com/q/26708962
downvote count: 0
tagged with: sorting
favorite count: 0
has title: sort list of objects based on field which can be null
score: 5
has answer: http://stackoverflow.com/a/26709080
has answer: http://stackoverflow.com/a/26709096
possible better answer: http://stackoverflow.com/a/26709092
has answer: http://stackoverflow.com/a/26709092
has body: How to to sort list of objects based on field which can be null? I am trying to do it in following way using Comparator interface and collections sort method. The class is CustomClass and the field on which sorting is to be done is createDate Comparator comparator=new Comparator&lt;CustomClass&gt;(){ public int compare(CustomClass o1, CustomClass o2) { if(o1.getCreateDate()==null &amp;&amp; o2.getCreateDate()==null){ return 0; } else if(o1.getCreateDate()==null &amp;&amp; o2.getCreateDate()!=null){ return 1; } else if(o1.getCreateDate()!=null &amp;&amp; o2.getCreateDate()==null){ return -1; } else{ if(o1.getCreateDate().equals(o2.getCreateDate())){ return 0; } else if(o1.getCreateDate().after(o2.getCreateDate())){ return 1; } else{ return -1; } } } }; Is there a better way to do it?
type: Question
accepted answer: http://stackoverflow.com/a/26709096
type: AnsweredQuestion
upvote count: 5
tagged with: java
answer count: 3
tagged with: null

http://stackoverflow.com/comment/42180531
has text: What if the data is not stored in your catch block. Another query is that if any exception occurs then try to resolve it don't try to perform any operation can generate another exception for you.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26803592
type: Comment

http://stackoverflow.com/q/26682052
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/28649923
has body: So I went to the Oracle site, here, and downloaded the JDK and NetBeans bundle file. Followed the download instructions, and ran it. It opens up and seems to run fine, but when I try to create a file, it asks which file type. Java isn't any of the options: There is only XML and Other. Under Other, the closest I see is Java Script with I know is not the same thing as Java. I also ran the JDK file and tried again, but still Java isn't an option in NetBeans. Help?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26682292
accepted answer: http://stackoverflow.com/a/26682292
tagged with: java
has answer: http://stackoverflow.com/a/28649923
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41963461
score: 0
upvote count: 1
downvote count: 1
has title: NetBeans has no Java option
favorite count: 0

http://stackoverflow.com/a/26735014
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26731460
downvote count: 1
has body: If you want all Action part extracted you should use a parser like this string input = xmlFile; string[] parts2 = Regex.Split(input, "(&lt;action)|(&lt;/action&gt;")); And you will get an array of stings in each element is a action code.
score: -1

http://stackoverflow.com/a/26755079
has comment: http://stackoverflow.com/comment/42093130
has comment: http://stackoverflow.com/comment/42092976
score: 0
has comment: http://stackoverflow.com/comment/42093076
type: Answer
has body: When click on submit, the page hello.xhtml should be displayed no welcome will be displayed on the url, but the internal page returned is what you sat here model.setViewName("hello");
answers question: http://stackoverflow.com/q/26754060

nullpointerexception
tags question: http://stackoverflow.com/q/26764586
tags question: http://stackoverflow.com/q/26694264
tags question: http://stackoverflow.com/q/26815953
tags question: http://stackoverflow.com/q/26766628
tags question: http://stackoverflow.com/q/26813826
tags question: http://stackoverflow.com/q/26777207
tags question: http://stackoverflow.com/q/26824827
tags question: http://stackoverflow.com/q/26748341
tags question: http://stackoverflow.com/q/26817348
tags question: http://stackoverflow.com/q/26792582
tags question: http://stackoverflow.com/q/26726304
tags question: http://stackoverflow.com/q/26692784
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/26709282
tags question: http://stackoverflow.com/q/26829280
tags question: http://stackoverflow.com/q/26825054
tags question: http://stackoverflow.com/q/26702675
tags question: http://stackoverflow.com/q/26741284
tags question: http://stackoverflow.com/q/26768122
tags question: http://stackoverflow.com/q/26787305
tags question: http://stackoverflow.com/q/26764505
tags question: http://stackoverflow.com/q/26708271
tags question: http://stackoverflow.com/q/26796367
tags question: http://stackoverflow.com/q/26818859
tags question: http://stackoverflow.com/q/26719720
tags question: http://stackoverflow.com/q/26719913
tags question: http://stackoverflow.com/q/26773863
tags question: http://stackoverflow.com/q/26766997
tags question: http://stackoverflow.com/q/26752131
tags question: http://stackoverflow.com/q/26818694
tags question: http://stackoverflow.com/q/26739765
tags question: http://stackoverflow.com/q/26702089
tags question: http://stackoverflow.com/q/26722825
tags question: http://stackoverflow.com/q/26792113
tags question: http://stackoverflow.com/q/26720287
tags question: http://stackoverflow.com/q/26690481
tags question: http://stackoverflow.com/q/26721820
tags question: http://stackoverflow.com/q/26702315

http://stackoverflow.com/comment/42198866
type: QuestionComment
has text: Firstly, there's no such thing as a "full" or "empty" `double`. A double _always_ takes 64 bits, of which 52 are _always_ precision bits. Whether those bits are 0s or 1s doesn't make them more or less "full," any more than "0001" is a shorter string than "1111". Secondly, if the result of floating-point arithmetic is larger than the floating point can hold (in your case, because the two terms are very large), then the result "overflows" to infinity, which is a special value meant for just such situations. It sounds like you should read a tutorial, which is off-topic for SO.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26813322

http://stackoverflow.com/comment/42010936
has text: Thanks for the reply. My doubt is according to isHandler Method of RequestMappingHandlerMapping, even if i annotate my class with just @RequestMapping annotation, it would still be considered as handler class and it's method scanned for handler methods.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26709489
type: Comment

http://stackoverflow.com/a/26739588
has body: When you call pig = line.substring(x, b - 1); you are assuming that b is initialized with a positive int, which would only be true if when you evaluate int b = line.indexOf(" "); there actually was a space in the String. If there wasn't, b's value will be -1, and when you subtract an additional 1 from that, you are attempting to call subString with a value that is out of the String's bounds.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26739276
downvote count: 0

http://stackoverflow.com/comment/42184557
score: 0
comment on: http://stackoverflow.com/a/26804879
type: Comment
has text: Ah perfect! It works ! So simple though ... I wonder how did I not see it ! Thank you ...
type: AnswerComment

http://stackoverflow.com/q/26795838
answer count: 1
has comment: http://stackoverflow.com/comment/42166011
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26795945
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42166131
has comment: http://stackoverflow.com/comment/42166259
has title: How do I can Iterate this structure from ArrayList
tagged with: servlets
has body: I am pretty new on Java, and I'm wondering how to iterate this ArrayList [ [{ID_CLIENTE=1}, {CODIGO=001}, {NOMBRES=John}, {STA=1}], [{ID_CLIENTE=2}, {CODIGO=003}, {NOMBRES=Laura }, {STA=1}] ] this is an arraylist that contains a record on each row, and inside there is a value/pair for the column name and value, and draw only the selected columns on the column array. This is my Java Code: String columns = request.getParameter("columns"); String[] cols = columns.split(","); List&lt;ArrayList&lt;String&gt;&gt; mant = mantDao.getAllMant(); // this return the arraylist shown above for(ArrayList&lt;String&gt; row: mant){ //IF it is ON cols array // response.getWriter().write("&lt;tr&gt;td&gt;"+row.get(index) +"&lt;/td&gt;"....); &lt;-- BAD CODE } Any help will be really apprecciated. I'm stuck on this for while. EDIT: this is the getAllMant() function public List getAllMant() { ArrayList mant = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); try { Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(this.query); campos = this.getCampos(); while (rs.next()) { ArrayList row = new ArrayList&lt;&gt;(); for(List&lt;String&gt; campo: campos){ LinkedHashMap&lt;String, String&gt; lhm = new LinkedHashMap&lt;String, String&gt;(); String valueField = ""; if( Arrays.asList(INTS).contains(Integer.parseInt(campo.get(1)) ) ){ valueField = String.valueOf(rs.getInt(campo.get(0))); }else if( Arrays.asList(NUMBERS).contains(Integer.parseInt( campo.get(1)) ) ){ valueField = String.valueOf(rs.getLong(campo.get(0))); }else if( Arrays.asList(VARCHAR).contains(Integer.parseInt( campo.get(1)) ) ){ valueField = rs.getString(campo.get(0)) ; }else if( Arrays.asList(DATES).contains(Integer.parseInt( campo.get(1)) ) ){ if(rs.getDate(campo.get(0)) !=null){ valueField = rs.getDate(campo.get(0)).toString(); }else{ valueField = ""; } } lhm.put(campo.get(0),valueField); row.add(lhm); } mant.add(row); } } catch (SQLException e) { e.printStackTrace(); } return mant; } reg…
accepted answer: http://stackoverflow.com/a/26795945
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42165914
has comment: http://stackoverflow.com/comment/42165954

http://stackoverflow.com/a/26702175
type: Answer
has comment: http://stackoverflow.com/comment/41997852
has body: A factory method pattern will only be necessary if you want/need to provide an exact implementation of IRestClient based on some arguments. Since this doesn't seem to be your case, you will be good by programming oriented to interfaces. So, instead of having this: RestClient restClient = new RestClient(); restClient.foo("bar"); You will have this: //declare the variable as interface //assign the value with the class implementation IRestClient restClient = new RestClient(); restClient.foo("bar"); So if you need a new implementation, just change the current implementationto the desired one: IRestClient restClient = new FooRestClient(); //rest of the code remains intact restClient.foo("bar"); If you want to move this into Factory Method Pattern, then you will have something like this: class RestClientFactory { public static IRestClient defaultRestClient() { return new RestClient(); } public static IRestClient createRestClient(String name) { String realName = name.toLowerCase(); switch(realName) { case "foo": return new FooRestClient(); case "bar": return new BarRestClient(); //and on... default: return defaultRestClient(); } } } And then you will have to initialize the instance by calling the respective method from the factory: IRestClient restClient = RestClientFactory.createRestClient("foo"); //rest of the code remains intact restClient.foo("bar");
upvote count: 1
downvote count: 1
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26702120
answers question: http://stackoverflow.com/q/26702120
has comment: http://stackoverflow.com/comment/41997774

http://stackoverflow.com/comment/41996394
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26700775
score: 3
has text: For one, don't post stacktraces in comments. Edit your question. Two, how is that in the least bit related to generics? Search for `ClassNotFoundException`. You're missing a class from your classpath.

http://stackoverflow.com/a/30510491
answers question: http://stackoverflow.com/q/26733501
score: 4
has body: Although Sheets API does not appear in the list of API Libray, you can create an Oauth2 client or Public API access to use it. Sheets API is accessible by default, and we do not have to explicitly enable it. OAuth 2.0 allows users to share specific data with you (for example, contact lists) while keeping their usernames, passwords, and other information private.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/26955380
type: Answer
has body: I'm not really sure I understand the need for it or your use case in any detail, but in Spring OAuth 2.0.4 you can add the user credentials to the AccessTokenRequest before calling the AccessTokenProvider (i.e. not using OAuth2RestTemplate until you have an access token to give it).
score: 0
answers question: http://stackoverflow.com/q/26819673

http://stackoverflow.com/a/26684710
downvote count: 3
has comment: http://stackoverflow.com/comment/113636612
has comment: http://stackoverflow.com/comment/89133363
upvote count: 1063
accepted answer of: http://stackoverflow.com/q/26684562
has comment: http://stackoverflow.com/comment/117880283
has comment: http://stackoverflow.com/comment/83544338
has comment: http://stackoverflow.com/comment/75834342
has comment: http://stackoverflow.com/comment/77867792
has comment: http://stackoverflow.com/comment/75109489
has comment: http://stackoverflow.com/comment/113682381
has comment: http://stackoverflow.com/comment/77367054
has comment: http://stackoverflow.com/comment/85298810
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26684562
has body: Both map and flatMap can be applied to a Stream&lt;T&gt; and they both return a Stream&lt;R&gt;. The difference is that the map operation produces one output value for each input value, whereas the flatMap operation produces an arbitrary number (zero or more) values for each input value. This is reflected in the arguments to each operation. The map operation takes a Function, which is called for each value in the input stream and produces one result value, which is sent to the output stream. The flatMap operation takes a function that conceptually wants to consume one value and produce an arbitrary number of values. However, in Java, it's cumbersome for a method to return an arbitrary number of values, since methods can return only zero or one value. One could imagine an API where the mapper function for flatMap takes a value and returns an array or a List of values, which are then sent to the output. Given that this is the streams library, a particularly apt way to represent an arbitrary number of return values is for the mapper function itself to return a stream! The values from the stream returned by the mapper are drained from the stream and are passed to the output stream. The "clumps" of values returned by each call to the mapper function are not distinguished at all in the output stream, thus the output is said to have been "flattened." Typical use is for the mapper function of flatMap to return Stream.empty() if it wants to send zero values, or something like Stream.of(a, b, c) if it wants to return several values. But of course any stream can be returned.
has comment: http://stackoverflow.com/comment/124570622
type: Answer
has comment: http://stackoverflow.com/comment/122556237
score: 1060

http://stackoverflow.com/comment/42062078
type: QuestionComment
has text: solved problem moving email_templates directory to /java/resources foulder
comment on: http://stackoverflow.com/q/26735030
score: 0
type: Comment

http://stackoverflow.com/a/26928657
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26759807
answers question: http://stackoverflow.com/q/26759807
type: Answer
has body: this problem appears if two or more threetenbp-libraries are inside the classpath. This even happens if the library-files are identical. In our case, we included the same library twice but from different paths in the filesystem. Best regards, Christian
has comment: http://stackoverflow.com/comment/79289846
has comment: http://stackoverflow.com/comment/79367412
score: 3
has comment: http://stackoverflow.com/comment/79360909
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/26690162
has body: may be you can give main activity code try giving activity name instead of , sometime sit causes problem Intent i = new Intent(MainActivity.this,Playlist.class); startActivity(i);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26690101

http://stackoverflow.com/a/37589822
type: Answer
upvote count: 2
has body: I tried setting the opencsv jar in the hadoop classpath but it didn't work.We need to explicitly copy the jar in the classpath for this to work.It did worked for me. Below are the steps i followed: I have done this in a HDP CLuster.I ahave copied my opencsv jar in hbase libs and exported it before running my jar Copy ExternalJars to HDP LIBS: To Run Open CSV Jar: 1.Copy the opencsv jar in directory /usr/hdp/2.2.9.1-11/hbase/lib/ and /usr/hdp/2.2.9.1-11/hadoop-yarn/lib **sudo cp /home/sshuser/Amedisys/lib/opencsv-3.7.jar /usr/hdp/2.2.9.1-11/hbase/lib/** 2.Give the file permissions using sudo chmod 777 opencsv-3.7.jar 3.List Files ls -lrt 4.exporthadoop classpath:hbase classpath 5.Now run your Jar.It will pick up the opencsv jar and will execute properly.
score: 2
answers question: http://stackoverflow.com/q/26748811
downvote count: 0

http://stackoverflow.com/a/26678065
score: 9
type: Answer
has body: because Date object doesn't have timezone as part of its state, You need SimpleDateFormat to format and print the date in your required timezone
upvote count: 9
accepted answer of: http://stackoverflow.com/q/26678030
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26678030

http://stackoverflow.com/comment/42141177
type: QuestionComment
comment on: http://stackoverflow.com/q/26760602
has text: It is among the project resources.
score: 0
type: Comment

http://stackoverflow.com/comment/42015340
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26691214
has text: Do you want it before the suite is run?
score: 0

http://stackoverflow.com/comment/41963434
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26682139
has text: I have added facets file as well
type: AnswerComment

http://stackoverflow.com/a/26782383
type: Answer
has comment: http://stackoverflow.com/comment/58363975
score: 4
has comment: http://stackoverflow.com/comment/42548491
answers question: http://stackoverflow.com/q/26779508
upvote count: 4
downvote count: 0
has body: Don't pass a URL to the queryHistory method, pass a server path or a local path. You're getting this error because you have passed a path that is not a server path (does not start with $/), so the system is trying to understand what server path you have mapped to http://...etc. Since that URL is also not a local path, you have gotten that error. If you want to see all history, pass the server path $/.

http://stackoverflow.com/q/26828246
downvote count: 1
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/26828285
possible better answer: http://stackoverflow.com/a/26828325
answer count: 2
has comment: http://stackoverflow.com/comment/42224016
has answer: http://stackoverflow.com/a/26828325
favorite count: 0
has title: Why can't I assign lambda to Object?
has body: I was trying to assign a lambda to Object type: Object f = ()-&gt;{}; And it gives me error saying: The target type of this expression must be a functional interface Why is this happening, and how to do this?
tagged with: java-8
accepted answer: http://stackoverflow.com/a/26828285
type: AnsweredQuestion
tagged with: java
score: 16

http://stackoverflow.com/comment/42068522
type: QuestionComment
score: 0
has text: @yurib You're right, that would work nicely. It might be useful for others to put it as an answer.
comment on: http://stackoverflow.com/q/26740746
type: Comment

http://stackoverflow.com/comment/42192379
score: 1
comment on: http://stackoverflow.com/q/26809876
has text: There are 2 separate indices; which do you mean?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42201418
type: QuestionComment
type: Comment
has text: AFAIK You don't need anything. Also i am not sure who downvoted and why. Anyways i am going to say the same in answer so it would be helpful in future to users with similar issues.
comment on: http://stackoverflow.com/q/26814901
score: 0

http://stackoverflow.com/comment/42235495
comment on: http://stackoverflow.com/a/26831049
has text: ohh! nonono that dots was a mistake
score: 1
type: AnswerComment
type: Comment

foreground
type: Tag
tag name: foreground
tags question: http://stackoverflow.com/q/26831024

http://stackoverflow.com/comment/42020619
type: AnswerComment
score: 0
has text: I don't see reason for argument here. We all agree that there is no certain way to check other than compiling it. So the question is, how much validations are we willing to do in order to make sure. In this line of though I agree with @poida here a extension check + checks from proper class start (class, public class, comment prefix etc.) might be enough.
type: Comment
comment on: http://stackoverflow.com/a/26714535

http://stackoverflow.com/comment/42134034
has text: I'm using struts2 and all I have is an Action class through which my methods get triggered. Those methods in return call the DAO interface which is implement by DAOImpl. Now I don't have service methods and where would I then place @transactional ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26749896

http://stackoverflow.com/q/26705372
upvote count: 1
type: Question
has title: How to select different elements using Selenium?
has comment: http://stackoverflow.com/comment/42004869
has answer: http://stackoverflow.com/a/26707807
downvote count: 0
tagged with: javascript
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26707807
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
has body: I had to start using Selenium recently as a website that I crawled had updated to javascript, after seeking some advise here Selenium was recommended as the program of choice in this situation. Using Selenium I am now able to crawl the website and "roughly" get what I want but I would like some guidance on how to select the different elements that I gathered when I crawled the Table. For example, When I use J-Soup to gather the data I get the Whole table like so: docVTS = Jsoup.connect("http://********************").timeout(10000).get(); Elements table = docVTS.select("table.dynlist"); Then I can gather the different parts of that table like this: Elements number = table.select("td:eq(0)"); vtsInt = number.size(); for (int i = 0; i &lt; vtsInt; i++) { ships = table.select("td:eq(1)").get(i).text().replace("&amp;nbsp",""); arr_ships.add(ships); dwt = table.select("td:eq(3)").get(i).text().replace("&amp;nbsp",""); arr_dwt.add(dwt); Is it possible to do the same with Selenium? I currently have: String text = driver.findElement(By.xpath("//div[@id='cphBody_Report_grid']")).getText(); This gets the table but I am unsure as to how I could select the different parts of the table like I do in j-soup. I would welcome any advice. Thank you. Edit: I found this CookBook for Selenium and selectors in general and found it rather helpful when starting with selenium: https://www.simple-talk.com/dotnet/.net-framework/xpath,-css,-dom-and-selenium-the-rosetta-stone/
tagged with: selenium

http://stackoverflow.com/a/26781291
has body: Try (Groovy implementation): String timeString = "2230" def bookingTime = Date.parse("HHmm", timeString)
type: Answer
has comment: http://stackoverflow.com/comment/42143474
has comment: http://stackoverflow.com/comment/42142452
upvote count: 5
answers question: http://stackoverflow.com/q/26781025
score: 5
downvote count: 0

http://stackoverflow.com/q/26735605
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/42057917
tagged with: spring-boot
has title: add directory to classpath in runtime
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: In my current spring project, when I run the application, it's created a directory on the user's home directory where I store some configuration files (*.properties file). In my code, I refer to this file in that way: private String getFilename() { return System.getProperty("user.home")+File.separator+".webapp"+File.separator+"webapp.preferences"; } which allows me run the application in any operational system without change the code. I need add this directory to the classpath of the application, to allow me use the annotation PropertySource to access the properties stored in the file using either the method getproperty from Enviroment class or the Value annotation. I using spring-boot, so the start point for the application it's that: @Controller @EnableJpaRepositories @EnableAutoConfiguration @ComponentScan(value="com.spring") public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } I also have classes WebAppInitializer, WebAppConfig and DispatcherConfig to store the configurations handled by the XML files web.xml and dispatcher-config.xml from spring. Anyone can tell if this is possible and hor to accomplish that? UPDATE Following the sugestions in the commentaries, I add to my project this bean: @Bean static PropertySourcesPlaceholderConfigurer property() throws Exception { PropertySourcesPlaceholderConfigurer propertyConfigurer = new PropertySourcesPlaceholderConfigurer(); String filename = System.getProperty("user.home")+File.separator+".webapp"+File.separator+"webapp.preferences"; File file = new File( filename ); if(file.exists()) propertyConfigurer.setLocation( new FileSystemResource( filename ) ); else { if(file.mkdir()) { FileOutputStream fos = new FileOutputStream( filename ); fos.close(); propertyConfigurer.setLocation( new FileSystemResource( filename ) ); } } return propertyConfigurer; } and try use this in my pojo class: @Input(label = "Titulo") @Property(key = "geral.tit…
has comment: http://stackoverflow.com/comment/42057605
tagged with: spring
tagged with: spring-mvc
answer count: 0
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/42219052
type: QuestionComment
has text: Edit it into your question, not as a comment (hard to read as a comment). `contacts` is a `ContactList`, not an `ArrayList<Contact>`, which is why your method isn't accepting it
score: 0
comment on: http://stackoverflow.com/q/26825139
type: Comment

http://stackoverflow.com/comment/42065799
comment on: http://stackoverflow.com/q/26739865
has text: @membersound No need. An answer with same idea posted :)
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26812203
has comment: http://stackoverflow.com/comment/42205928
downvote count: 0
score: 1
has body: When you call age = keyIn.nextInt(); it consumes the int but leaves the trailing new-line. So, this choice = keyIn.next().charAt(0); // &lt;-- returns immediately with '\n'. Add a keyIn.nextLine(); // &lt;-- consume the \n choice = keyIn.next().charAt(0); // &lt;-- get the next input Also, you're missing a pipe symbol in your while test. while (choice == 'Y' || choice == 'y');
answers question: http://stackoverflow.com/q/26812183
type: Answer
upvote count: 1

http://stackoverflow.com/a/26680283
has comment: http://stackoverflow.com/comment/42080623
has comment: http://stackoverflow.com/comment/41969300
answers question: http://stackoverflow.com/q/26678314
has comment: http://stackoverflow.com/comment/41959492
has comment: http://stackoverflow.com/comment/42027265
has comment: http://stackoverflow.com/comment/41966497
score: 0
has body: You just need a small fix with SpEL syntax, &lt;mvc:resources mapping="/help/*" location="file:#{systemProperties['help.dir']}"/&gt; and for JVM argument : -Dhelp.dir=/workspace/shared/data/help/ with leading and trailing slashes to get it all work see : http://wordgraphs.com/post/1751/Serving-a-resource-from-outside-the-context-root-in-Spring-MVC and Spring Expression Language (SpEL)
type: Answer

http://stackoverflow.com/a/26905933
type: Answer
has comment: http://stackoverflow.com/comment/42402210
has comment: http://stackoverflow.com/comment/42509922
has comment: http://stackoverflow.com/comment/42421862
has body: If you would like to have reproducirAviso() not to be called several times add a flag to check if already running reproducirAviso(). For example, somewhere set a static boolean like public static boolean reproducing = false; public void reproducirAviso() { // // lots of your code // reproducing = false; } so your code becomes @Override public void onTick(long l) { if(!reproducing &amp;&amp; (TimeUnit.MILLISECONDS.toSeconds(l) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(l))) == 10){ reproducirAviso(); } tiempo.setText(String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(l), TimeUnit.MILLISECONDS.toSeconds(l) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(l)))); }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26752404
answers question: http://stackoverflow.com/q/26752404
score: 0

http://stackoverflow.com/a/26693765
has body: Problem solved. What I had to do is to put those icons into my projects package folder, then select "Image within project" in button options and add them again.
answers question: http://stackoverflow.com/q/26693648
type: Answer
score: 0

http://stackoverflow.com/comment/42162625
comment on: http://stackoverflow.com/q/26793670
has text: Then how do I do to make the method return "cont"?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42004992
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26705387
has text: I did not dive that deep into the code :) But I your initial question should be answered
score: 0

ajax
tags question: http://stackoverflow.com/q/26795429
tags question: http://stackoverflow.com/q/26799064
tags question: http://stackoverflow.com/q/26755693
type: Tag
tags question: http://stackoverflow.com/q/26796352
tags question: http://stackoverflow.com/q/26794520
tags question: http://stackoverflow.com/q/26803620
tags question: http://stackoverflow.com/q/26684520
tags question: http://stackoverflow.com/q/26675415
tags question: http://stackoverflow.com/q/26736306
tags question: http://stackoverflow.com/q/26767683
tags question: http://stackoverflow.com/q/26684970
tags question: http://stackoverflow.com/q/26770791
tags question: http://stackoverflow.com/q/26718649
tags question: http://stackoverflow.com/q/26747789
tags question: http://stackoverflow.com/q/26752613
tags question: http://stackoverflow.com/q/26794699
tags question: http://stackoverflow.com/q/26797277
tags question: http://stackoverflow.com/q/26726621
tags question: http://stackoverflow.com/q/26756458
tags question: http://stackoverflow.com/q/26796396
tags question: http://stackoverflow.com/q/26729532
tags question: http://stackoverflow.com/q/26778292
tag name: ajax

http://stackoverflow.com/a/26814338
accepted answer of: http://stackoverflow.com/q/26814218
answers question: http://stackoverflow.com/q/26814218
score: 1
has comment: http://stackoverflow.com/comment/42200175
type: AcceptedAnswer
downvote count: 0
has body: If you want to run you class file, you must compile the java file. The steps are as follows: 1 complile the java file javac Work.java 2 if there is no error in previous step,please run class file java -cp .;%cd% Work
type: Answer
upvote count: 1

http://stackoverflow.com/q/26808053
has comment: http://stackoverflow.com/comment/42189278
tagged with: internationalization
answer count: 0
type: UnansweredQuestion
tagged with: excel
has comment: http://stackoverflow.com/comment/42210818
has body: I'm using Java and the apache poi library. I can set up dates to export into different formats just fine using workbook.getCreationHelper().createDataFormat().getFormat("d/m/yyy") and such. What I'm trying to do, however, is allow the date to be formatted based on operating system settings. Essentially, I want to select one of the two options shown below, but programmatically. (Sorry - screenshot not provided because I don't have enough reputation points. I found an example here. See the screenshot that shows the date formats in excel marked with an *: http://excelsemipro.com/2011/06/regional-date-formats-in-excel/ ) If this has been answered elsewhere, I'd love a link. I've not had success in searching for it myself. Thank you in advance!
has title: How to export a date into excel that will format based on operating system settings?
score: 1
tagged with: java
tagged with: date-formatting
type: Question
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42190374
favorite count: 0
has comment: http://stackoverflow.com/comment/42991124

http://stackoverflow.com/a/26724622
accepted answer of: http://stackoverflow.com/q/26724391
type: AcceptedAnswer
downvote count: 0
has body: From HashMap documentation: public Collection&lt;V&gt; values() The view's iterator is a "weakly consistent" iterator that will never throw ConcurrentModificationException, and guarantees to traverse elements as they existed upon construction of the iterator. So, you shouldn't get any NoSuchElementException after hasNext() returns true.
type: Answer
answers question: http://stackoverflow.com/q/26724391
upvote count: 1
score: 1

http://stackoverflow.com/comment/42230536
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26831984
has text: it really depends on the way of marshalling. could be the missing no-arg constructor or the missing Serializable implementation. With few information like this, this question cannot be answered
score: 0

http://stackoverflow.com/a/42499109
score: 0
answers question: http://stackoverflow.com/q/26748947
type: Answer
has body: You could also do it very similar to how to initialized it. while(!stack1.isEmpty()) { int t = stack1.pop(); System.out.println(t); }

http://stackoverflow.com/q/26787572
has answer: http://stackoverflow.com/a/26787609
tagged with: java
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/42151522
accepted answer: http://stackoverflow.com/a/26787609
score: 0
answer count: 1
has body: I have the following values: public int TYP_SOMEONE = 1, TYP_SOMETWO = 2, TYP_SOMESPECIAL = 433, TYP_SOMETHREE = 3, .., TYP_SOMENINETYNINE = 99; They are used in at least 5 methods throughout the code. At one place there's a long switch-case list where these values are used to assign Strings the right way: switch ( iTyp ){ case 1: assignedString = "one"; break case 2: assignedString = "two"; break; } I want to shorten the code. What is a good way to do this? I thought about enums, but I wonder how, because it's a long task to change in every class that uses TYP_xxx the type of the variable and add parentheses and so on...
has title: integer list -> long switch/case - better readability
tagged with: code-readability
type: AnsweredQuestion

http://stackoverflow.com/a/43359975
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/26713813
has body: First, I selected SVNKit (Pure Java) SVNKit v1.8.12.10533, but failed. Then I selected JavaHL (JNI) 1.9.3 (r1718519) and succeeded.
downvote count: 1
type: Answer

http://stackoverflow.com/a/26716749
type: Answer
accepted answer of: http://stackoverflow.com/q/26716649
has comment: http://stackoverflow.com/comment/42023582
answers question: http://stackoverflow.com/q/26716649
upvote count: 1
score: 1
has body: Try replace api to replace all "*" in your input as below: double d = Double.valueOf("***123.04***".replace("*", "")); System.out.println(d);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42172263
score: 0
type: AnswerComment
type: Comment
has text: Also, is there a way to hard code authentication given that I will only be using the one account
comment on: http://stackoverflow.com/a/26799153

http://stackoverflow.com/q/26786246
tagged with: spring-batch
accepted answer: http://stackoverflow.com/a/26788580
favorite count: 0
has title: How to parse many XML files (with CDATA) in a folder and import to MySQL using Java batch?
has answer: http://stackoverflow.com/a/26788580
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: mysql
has body: I have many XML files, the structure like this: <?xml version="1.0" encoding="UTF-8"?> TITANIC 1997 7.7 James Cameron Leonardo DiCaprio Kate Winslet Frances Fisher I want to make a Java batch program to parse data file by file in folder and import to MySQL create table films( film_code VARCHAR(255), film_name VARCHAR(255), imdb VARCHAR(50), directors TEXT, actors TEXT ); I have found some useful article ( http://websystique.com/springbatch/spring-batch-read-an-xml-file-and-write-to-mysql-database/ ) but I can't parse file by file from folder, also I can't get value of CDATA. Does anyone can guide me how to do? Many thanks.
type: Question
upvote count: 2
tagged with: xml-parsing
answer count: 1

http://stackoverflow.com/comment/108111756
comment on: http://stackoverflow.com/a/42054523
type: Comment
has text: Pretty sure, according to this https://developers.google.com/protocol-buffers/docs/encoding, bool types have a `wire` type encoded.
score: 1
type: AnswerComment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/26814372
tag name: semaphore
tags question: http://stackoverflow.com/q/26816706

http://stackoverflow.com/comment/42226668
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26829729
has text: Isn' t there a "t" missing?
score: 0

http://stackoverflow.com/q/26831644
upvote count: 1
has answer: http://stackoverflow.com/a/26842710
accepted answer: http://stackoverflow.com/a/26842710
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42270414
has answer: http://stackoverflow.com/a/27385686
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/27385686
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42268138
tagged with: android-5.0-lollipop
type: Question
answer count: 2
has body: I downloaded and built the new android lollipop source code on my computer and tried importing the code into an IDE, I tried intellij and android studio using the post here https://stackoverflow.com/a/21471652/3057931 I tried executing the development/tools/idegen/idegen.sh file but seem to keep getting a java file error Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java (Is a directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138) at java.io.FileReader.&lt;init&gt;(FileReader.java:72) at Configuration.parsePackageName(Configuration.java:204) at Configuration.rootOf(Configuration.java:180) at Configuration.traverse(Configuration.java:140) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.traverse(Configuration.java:167) at Configuration.&lt;init&gt;(Configuration.java:72) at Main.main(Main.java:37) This method worked for me in the KitKat source code but in this build I keep getting this error. I really don't know what to do anymore. I really really need to use intellij or android studio for the AOSP code. PLEASE HELP.
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/16727607
tagged with: android-source
has title: Failed to import AOSP code to IDEA / Intellij / Android Studio

http://stackoverflow.com/q/26720542
has answer: http://stackoverflow.com/a/26720643
tagged with: url
has comment: http://stackoverflow.com/comment/42031098
favorite count: 0
answer count: 3
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26720703
accepted answer: http://stackoverflow.com/a/26720643
has title: Truncate Domain From URL using Java
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/26720747
has body: Given such a domain: http%3a%2f%2fwww.google.com%2fpagead%2fconversion%2f1001680686%2f%3flabel%3d4dahCKKczAYQrt7R3QM%26value%3d%26muid%3d_0RQqV8nf-ENh3b4qRJuXQ%26bundleid%3dcom.google.android.youtube%26appversion%3d5.10 I want to replace the %3a%2f%2 with :// and get rid all the content behind ".com", so finally I just want to got http://www.google.com How can I implement this in Java using a regex?
type: Question
has answer: http://stackoverflow.com/a/26720747
tagged with: java
linked to: http://stackoverflow.com/q/30404224
has comment: http://stackoverflow.com/comment/42031042
score: 0

http://stackoverflow.com/q/26679121
has comment: http://stackoverflow.com/comment/41959935
has answer: http://stackoverflow.com/a/26679184
has comment: http://stackoverflow.com/comment/41971458
has answer: http://stackoverflow.com/a/26679346
has answer: http://stackoverflow.com/a/26680007
has title: Efficiently removing an item from Java LinkedList
accepted answer: http://stackoverflow.com/a/26679248
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26679155
has answer: http://stackoverflow.com/a/26679248
has answer: http://stackoverflow.com/a/26679155
answer count: 5
has comment: http://stackoverflow.com/comment/41967875
has body: Here is the pseudo-code I am using to remove an item from the linked-list: public static void removeByID(LinkedList&lt;Fruit&gt; fruits, int fruitID) { for(Fruit f : fruits) { if (f.ID == fruitID) { fruits.remove(f); return; } } } I am thinking this is not very efficient as fruits.remove() will once again iterate over the list. Wondering if there is a better way to achieve this.
type: AnsweredQuestion
tagged with: linked-list
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/42200929
type: QuestionComment
comment on: http://stackoverflow.com/q/26814865
has text: If you wrote `b.super(5);` in the first example, would you it say "B.Inner(B, int) is undefined" or "B.Inner(int) is undefined"?
score: 0
type: Comment

http://stackoverflow.com/q/26814673
has title: Android JSONArray to ArrayList
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42200674
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
answer count: 2
tagged with: arraylist
has answer: http://stackoverflow.com/a/26814776
accepted answer: http://stackoverflow.com/a/26814759
tagged with: arrays
has body: I am trying to parse a JSONArray into and ArrayList in my android app. The PHP script correctly retuns the expected results, however the Java fails with a null pointer exception at resultsList.add(map) public void agencySearch(String tsearch) { // Setting the URL for the Search by Town String url_search_agency = "http://www.infinitycodeservices.com/get_agency_by_city.php"; // Building parameters for the search List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("City", tsearch)); // Getting JSON string from URL JSONArray json = jParser.getJSONFromUrl(url_search_agency, params); for (int i = 0; i &lt; json.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); try { JSONObject c = (JSONObject) json.get(i); //Fill map Iterator iter = c.keys(); while(iter.hasNext()) { String currentKey = (String) iter.next(); map.put(currentKey, c.getString(currentKey)); } resultsList.add(map); } catch (JSONException e) { e.printStackTrace(); } }; MainActivity.setResultsList(resultsList); }
has comment: http://stackoverflow.com/comment/42200812
has answer: http://stackoverflow.com/a/26814759
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42200817
possible better answer: http://stackoverflow.com/a/26814776
tagged with: android
has comment: http://stackoverflow.com/comment/42200802

http://stackoverflow.com/comment/47880803
comment on: http://stackoverflow.com/a/27044295
has text: After google implement support Java8 in ART, developers will wait about 3-5 years to use it, because there no backward compatibility. It's sad
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42087800
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26694712
has text: Please show a stacktrace corresponding to the error. Stacktrace contains important information, notably the classes in which the error occurs with the source line when available. Without more, it could be a typo in the the name of the table or fields, but stacktrace should give directly the exact line involved.
type: AnswerComment

constructor
tags question: http://stackoverflow.com/q/26722960
tags question: http://stackoverflow.com/q/26829152
tags question: http://stackoverflow.com/q/26703645
tags question: http://stackoverflow.com/q/26816164
tags question: http://stackoverflow.com/q/26790324
tags question: http://stackoverflow.com/q/26752021
tags question: http://stackoverflow.com/q/26811266
tags question: http://stackoverflow.com/q/26824253
tags question: http://stackoverflow.com/q/26821736
tags question: http://stackoverflow.com/q/26734456
tags question: http://stackoverflow.com/q/26826959
tags question: http://stackoverflow.com/q/26752443
tags question: http://stackoverflow.com/q/26705396
tags question: http://stackoverflow.com/q/26711967
tags question: http://stackoverflow.com/q/26820044
tags question: http://stackoverflow.com/q/26760279
tags question: http://stackoverflow.com/q/26691890
tag name: constructor
tags question: http://stackoverflow.com/q/26723164
type: Tag
tags question: http://stackoverflow.com/q/26820094
tags question: http://stackoverflow.com/q/26729566
tags question: http://stackoverflow.com/q/26818784
tags question: http://stackoverflow.com/q/26694833
tags question: http://stackoverflow.com/q/26693667
tags question: http://stackoverflow.com/q/26760996
tags question: http://stackoverflow.com/q/26706651
tags question: http://stackoverflow.com/q/26817376
tags question: http://stackoverflow.com/q/26706021
tags question: http://stackoverflow.com/q/26717768
tags question: http://stackoverflow.com/q/26729831
tags question: http://stackoverflow.com/q/26701913
tags question: http://stackoverflow.com/q/26815552

http://stackoverflow.com/a/26797409
answers question: http://stackoverflow.com/q/26796491
has body: assuming that you don't have to store the numbers in the same order in which they were entered by the user, you would make a sorted insert. that means, for each value entered, find the index at which this number can be inserted while maintaining a sorted array (if there exists a number at this index you have to move it move it to the right) provided a sorted array you can find min and max in O(1): min = number[0]; max = number[n-1];
score: 0
type: Answer

http://stackoverflow.com/a/26786724
answers question: http://stackoverflow.com/q/26786347
downvote count: 0
has comment: http://stackoverflow.com/comment/42170780
upvote count: 2
type: Answer
score: 2
has body: If you want to switch places two numbers separated by space you can do it with replaceAll(regex, replacement). regex representing two numbers separated by space can look like (\\d+) (\\d+) \\d represents one digit (character 0, 1 ... 9) \\d+ represents string build from one or more digits (\\d+) will place match from \\d+ in group which will let us reuse it later Now because each number is in separate groups we can use matches from this groups in replacement via $x where x represents group number, so in this case we can put match from group 2 before match from group 1. Demo: String text = "LINESTRING (0 1, 3 2 , 4 5)"; System.out.println("before replacing: "+text); text = text.replaceAll("(\\d+) (\\d+)", "$2 $1"); System.out.println("after replacing: "+text); Output: before replacing: LINESTRING (0 1, 3 2 , 4 5) after replacing: LINESTRING (1 0, 2 3 , 5 4)

http://stackoverflow.com/a/26872273
has comment: http://stackoverflow.com/comment/42535501
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42613498
has comment: http://stackoverflow.com/comment/42719978
has comment: http://stackoverflow.com/comment/42392302
has comment: http://stackoverflow.com/comment/42430860
has comment: http://stackoverflow.com/comment/42455107
score: 0
has comment: http://stackoverflow.com/comment/42623960
accepted answer of: http://stackoverflow.com/q/26771133
type: Answer
has comment: http://stackoverflow.com/comment/42467732
has body: A couple of guide lines for better formed code: Break your code into methods that only do one thing each. That way it's easier to manage and nicely compartmentalized, plus you don't enter into indentation hell with such embedded loop and if structures as the one you have over here. Use class variables for things like the WebDriver instance, so you can initialize it once and keep calling on it later. Don't hard code text into the application, use constants. Then you only need to define the text once and can refer to it multiple times. Makes the code much easier to maintain and change, when you don't have to search and replace through entire class, after some details (like a file path) change. Also, I'm guessing you meant to do the following: loop the rows in objectRepository in the k-loop, instead of looping the rows in the testSuite again. get cells from objectRepository rather than from testScenarios when reading the cells from objectRepository Example: public class MainClass { private static final String BROWSER_PATH = "D:\\softs\\FF installed\\FF18\\firefox.exe"; private static final String TEST_SUITE_PATH = "D:\\GmailTestSuite.xls"; private static final String OBJECT_REPOSITORY_PATH = "D:\\objectrepository.xls"; private static final String ADDRESS_TO_TEST = "https://www.gmail.com"; private static final By EMAIL_INPUT = By.id("Email"); // other constants private WebDriver driver; private Properties properties; public MainClass() { File file = new File(BROWSER_PATH); FirefoxBinary fb = new FirefoxBinary(file); driver = new FirefoxDriver(fb, new FirefoxProfile()); driver.get(ADDRESS_TO_TEST); } public static void main(String[] args) throws IOException, BiffException { MainClass main = new MainClass(); main.handleTestSuite(); } private void handleTestSuite() { ReadPropertyFile readConfigFile = new ReadPropertyFile(); properties = readConfigFile.loadPropertiess(); ExcelHandler testSuite = new ExcelHandler(TEST_SUITE_PATH, "Suite"); testSuite.columnData(); int rowCoun…
has comment: http://stackoverflow.com/comment/42451015
answers question: http://stackoverflow.com/q/26771133
has comment: http://stackoverflow.com/comment/42584071
has comment: http://stackoverflow.com/comment/42429002
has comment: http://stackoverflow.com/comment/42505254
has comment: http://stackoverflow.com/comment/42497951
has comment: http://stackoverflow.com/comment/42418834
has comment: http://stackoverflow.com/comment/42704242
has comment: http://stackoverflow.com/comment/42651234
has comment: http://stackoverflow.com/comment/42544692
has comment: http://stackoverflow.com/comment/42547783

http://stackoverflow.com/q/26685113
answer count: 0
has title: How to make your variable immune to reflection?
type: UnansweredQuestion
score: 6
duplicate of: http://stackoverflow.com/q/7566626
upvote count: 6
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/41968403
has comment: http://stackoverflow.com/comment/41968389
type: Question
has comment: http://stackoverflow.com/comment/41968321
has body: I was recently making a Utilities class with a couple of private variables which I need to make sure will never get changed even if someone tries using reflection. So I was wondering, is there any way to make a variable immune to reflection?
downvote count: 0
has comment: http://stackoverflow.com/comment/42004214
has comment: http://stackoverflow.com/comment/41968720
has comment: http://stackoverflow.com/comment/41968364
favorite count: 0
linked to: http://stackoverflow.com/q/7566626

http://stackoverflow.com/q/26751883
has comment: http://stackoverflow.com/comment/42166127
has title: Spring Declarative transaction management failed with jdbc template
type: UnansweredQuestion
tagged with: jdbc
tagged with: spring
has comment: http://stackoverflow.com/comment/42088227
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/42165972
upvote count: 1
has body: I am using Spring 3.2.2 version, I have a issue when I am using @Transactional with jdbc template, My XML configuration is below: &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory" /&gt; &lt;bean id="reportTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt; &lt;property name="dataSource" ref="reportDataSource" /&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" order="0"/&gt; &lt;tx:annotation-driven transaction-manager="reportTransactionManager" order="1"/&gt; Code : @Transactional(value = "reportTransactionManager", rollbackFor = Exception.class) public ReportResponse deleteAndSave(input) throws ReportServiceException { service1.saveData(input); service2.saveData(input); service3.saveData(input); service4.saveData(input); service5.saveData(input); service6.saveData(input); service7.saveData(input); } catch (Exception exception) { _LOGGER.debug("Caught exception all KPI changes should be reverted back for scenario id {}", scenarioId); _LOGGER.error(ExceptionUtils.getFullStackTrace(exception)); throw new ReportServiceException(exception.getMessage(), exception); } return reportResponse; } So issues is whenever any service fails everthing should roll back but in my case if suppose service7 failed all services are roll backed except one service i.e service4 only, I thought may be transaction is not propagating to service4 api, then I tested using TransactionSynchronizationManager.getCurrentTransactionName(); TransactionSynchronizationManager.isSynchronizationActive(); TransactionSynchronizationManager.isCurrentTransactionReadOnly(); TransactionSynchronizationManager.isActualTransactionActive(); Its returning me the transaction and its details properly, but still not rollbacking I surprised that why only that service api is failed to rollback , Can any one please suggest me on this. Note : Apart from d…
type: Question
tagged with: java
tagged with: spring-transactions
has comment: http://stackoverflow.com/comment/42168881
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42159183
has text: It was no harm to implement these two constructors `public RunLengthEncoding(, , )` & `public RunLengthEncoding(, , , , )` to encode the `Ocean` to `Dlist` of `TypeAndSize` objects which is already implemented, because we did not require hungerLevel info, but the problem is `public Ocean toOcean()` method decodes `DList` of `TypeAndSize` object back to `Ocean` as per [query](http://stackoverflow.com/questions/26727357/query-on-clarification-about-toocean-method). Now, How can i my third constructor encode to something other than `TypeAndSize` object? Hope you understand!!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26774900

http://stackoverflow.com/comment/41977736
type: QuestionComment
has text: You simply do the hashing again and check wether the results match. If either of the strings has the slightest difference, the hash will not match. If they match, you know that both input strings and both passwords matched, because the hash matches.
comment on: http://stackoverflow.com/q/26690360
score: 4
type: Comment

http://stackoverflow.com/comment/42192068
comment on: http://stackoverflow.com/a/26807873
score: 0
type: AnswerComment
has text: Okay gotcha. I followed your first approach. Now I just have to figure out how to retrieve values from map and save to sqlite db appropriately. Thanks. I am wondering through how can I loop through the map and get the button Value(s), so that I can save in db column?
type: Comment

http://stackoverflow.com/q/26830100
tagged with: android
tagged with: android-studio
type: UnansweredQuestion
tagged with: java
tagged with: android-actionbar
type: Question
has title: Action bar Action View won't work
score: 0
answer count: 1
has body: I am trying to make a collapsible EditText in the Action Bar. I have followed the Android Developers guide. But when I click on my search icon, nothing happens. What can I do? Here is my code. The activity: public class ElementPagerActivity extends ActionBarActivity implements ElementListFragment.onElementClickListener, CalculateFragment.OnCalculateClickListener{ ViewPager theViewPager; private ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getSupportActionBar(); theViewPager = new ViewPager(this); theViewPager.setId(0x1); theViewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { if(position == 0){ return new ElementListFragment(); } return Element.values()[position - 1].toFragment(); } @Override public int getCount() { return Element.values().length + 1; } }); theViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int position) { invalidateOptionsMenu(); if(position == 0){ actionBar.setTitle(R.string.Element_info_activity_label); actionBar.selectTab(null); } else { actionBar.setTitle(Element.values()[position - 1].getName()); actionBar.selectTab(actionBar.getTabAt(position - 1)); } } @Override public void onPageScrollStateChanged(int i) { } }); actionBar = actionBar; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tabListener = new ActionBar.TabListener(){ @Override public void onTabSelected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) { int position = tab.getPosition(); theViewPager.setCurrentItem(position + 1, true); } @Override public void onTabUnselected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) { } @Override public void onTabReselected(ActionBar.Tab tab, android.suppor…
has answer: http://stackoverflow.com/a/26830157

http://stackoverflow.com/q/26797304
answer count: 1
tagged with: user-interface
tagged with: layout-manager
has title: Dynamic GridLayout with fixed size
favorite count: 0
has body: Guidance required.. Would like to achieve something like the image below whereby the child panel stays the same size but contains up to 4 components. I realize I can achieve this by changing the number of columns in my gridlayout below but in order to keep the child panel the same size I would have to change the border sizes which is something I don't mind doing but it seems a bit cumbersome and am wondering if there is a smart way to go about this. The code I have provided is based on sample code provided to me here import java.awt.*; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; public class DynamicGridLayout { private JPanel ui = null; DynamicGridLayout() { initUI(); } public final void initUI() { if (ui!=null) return; ui = new JPanel(new GridBagLayout()); ui.setBorder(new TitledBorder("Parent Panel")); JPanel controls = new JPanel(new GridLayout(2,0,10,10)); ui.add(controls); controls.setBackground(Color.RED); controls.setBorder(new TitledBorder("Child Panel")); for (int ii=1; ii&lt;5; ii++) { addLabel(controls, "String " + ii); } } public JComponent getUI() { return ui; } private void addLabel(JPanel panel, String text) { JPanel controls1 = new JPanel(new GridLayout(3,0,3,3)); controls1.setBackground(Color.green); controls1.setBorder(new EmptyBorder(75,75,75,75)); panel.add(controls1); } public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { JFrame f = new JFrame("Three Button/Text Field Combo"); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setLocationByPlatform(true); DynamicGridLayout dgl = new DynamicGridLayout(); f.setContentPane(dgl.getUI()); f.setSize(1050, 720); f.setMinimumSize(f.getSize()); f.setVisible(true); } }; SwingUtilities.invokeLater(r); } }
score: 6
tagged with: swing
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/26798650
accepted answer: http://stackoverflow.com/a/26798650
linked to: http://stackoverflow.com/q/26775624
tagged with: grid-layout

http://stackoverflow.com/q/26798290
accepted answer: http://stackoverflow.com/a/26886626
answer count: 1
tagged with: log4j
favorite count: 0
has comment: http://stackoverflow.com/comment/42178067
has comment: http://stackoverflow.com/comment/42171972
has answer: http://stackoverflow.com/a/26886626
has title: Logging the particular level (FATAL) in a different file with the name as current date using log4j
has comment: http://stackoverflow.com/comment/42171309
tagged with: logging
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42327792
downvote count: 0
has comment: http://stackoverflow.com/comment/42329477
has body: I want to log only FATAL level in a different logfile with the current date as its name. i have tried like below # Console appender configuration log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%-5p: %c - %m%n log4j.appender.stdout.filter.b=org.apache.log4j.varia.LevelMatchFilter log4j.appender.stdout.filter.b.LevelToMatch=FATAL log4j.appender.stdout.filter.b.AcceptOnMatch=false #File appender configuration log4j.appender.fileout = org.apache.log4j.FileAppender log4j.appender.fileout.File = F:/Logs/log1.log log4j.appender.fileout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c - %m%n log4j.appender.fileout.layout = org.apache.log4j.PatternLayout log4j.appender.fileout.ImmediateFlush=true log4j.appender.fileout.Threshold=FATAL log4j.appender.fileout.Append=true log4j.appender.fileout.filter.a=org.apache.log4j.varia.LevelMatchFilter log4j.appender.fileout.filter.a.LevelToMatch=FATAL log4j.appender.fileout.filter.a.AcceptOnMatch=true with this i am able to print into different file but unable to change the name dynamically as current date.. please suggest a solution I am using log4j 1.2.13
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/42177805
tagged with: log4j2
type: Question
upvote count: 3

http://stackoverflow.com/comment/42004079
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26705559
has text: If you're looking for a tool to do it for you, that's off topic for SO (see [here](http://stackoverflow.com/help/on-topic), item 4). If you're looking for a method (not a tool), that's _probably_ too broad, since it's pretty close to to "how do I extract information from an IDEA project" plus "how do I make a Makefile project [given that information]."
score: 0

http://stackoverflow.com/a/26814101
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26814064
accepted answer of: http://stackoverflow.com/q/26814064
score: 5
type: AcceptedAnswer
has body: Arrays.asList takes an array of objects (an Object[]). ints are not objects, which means it's impossible to interpret your int[] as an Object[] -- to do that, arr would have to be Integer[]. (Always remember that primitives and objects are fundamentally different, even if the compiler will sometimes conveniently convert between them for you.) But int[] itself is an Object. That means Arrays.asList(arr) can use the varargs functionality to turn: Arrays.asList(arr) into: Arrays.asList(new int[][] { arr }) This is a single-element array, whose only element is of type int[] -- an array of arrays. In other words, the input to Arrays.asList is interpreted as a single object (the int[] arr), which is then wrapped into a one-element array of objects. So the result type is List&lt;int[]&gt;. You then take this List&lt;int[]&gt; and try to cast it to a Collection&lt;Integer&gt;. This means that when you fetch the first item (which is an int[]), it's cast to an Integer. That's what's causing your ClassCastException. Instead, you should use the varargs directly: Arrays.asList(1, 2, 4, 3, 6, 3, 2, 9) If you do that, the compiler has no choice but to treat each element as an object. It'll do that by auto-boxing each one into an Integer. The end result is something like this: Arrays.asList(new Integer[]{ Integer.valueOf(1), Integer.valueOf(2), ... }) As a general piece of advice, the checked warnings are there for a reason. Until you become very comfortable with generics and erasures, I would recommend not suppressing them. The ClassCastException doesn't happen until you try to fetch something out of the Collection&lt;Integer&gt;, which could happen much later than when you put those elements in -- and possibly in another class altogether.
upvote count: 5

http://stackoverflow.com/comment/42017538
score: 0
type: AnswerComment
type: Comment
has text: @SanKrish He wants an image button to go to a jsp page
comment on: http://stackoverflow.com/a/26713383

http://stackoverflow.com/comment/42174258
type: QuestionComment
comment on: http://stackoverflow.com/q/26798644
has text: no it doesn't work at all. Even if the LG G2 is not busy, the foreground service will be destroyed. I just read about bugs with Android 4.4. Perhabs it will depend on it.
score: 0
type: Comment

http://stackoverflow.com/q/26754456
has body: I have a Dspace 4.2 instalation that throw the following Exception. The same code work at my PC and other server. This problem avoid statistical data to be registered. has anyone had a similar problem? ERROR org.dspace.statistics.SolrLoggerUsageEventListener @ java.lang.NullPointerException at org.dspace.statistics.util.SpiderDetector.isSpider(SpiderDetector.java:208) at org.dspace.statistics.util.SpiderDetector.isSpider(SpiderDetector.java:258) at org.dspace.statistics.SolrLogger.getCommonSolrDoc(SolrLogger.java:287) at org.dspace.statistics.SolrLogger.postSearch(SolrLogger.java:469) at org.dspace.statistics.SolrLoggerUsageEventListener.receiveEvent(SolrLoggerUsageEventListener.java:51) at org.dspace.services.events.SystemEventService.fireLocalEvent(SystemEventService.java:144) at org.dspace.services.events.SystemEventService.fireEvent(SystemEventService.java:86) at org.dspace.app.xmlui.cocoon.SearchLoggerAction.act(SearchLoggerAction.java:65) at org.apache.cocoon.sitemap.impl.DefaultExecutor.invokeAction(DefaultExecutor.java:55) at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTypeNode.java:105) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55) at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:78) at
answer count: 1
has answer: http://stackoverflow.com/a/28472157
accepted answer: http://stackoverflow.com/a/28472157
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42453844
tagged with: java
has comment: http://stackoverflow.com/comment/42515775
tagged with: dspace
type: Question
has title: Error at SolrLoggerUsageEventListener that stop registering statistics
score: 0

http://stackoverflow.com/comment/42204704
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26817059
has text: May be you need a second button or second form or another servlet. It's generally unclear what are you asking.
type: Comment

http://stackoverflow.com/a/26805553
has body: I found a solution and will share for any other unfortunate individuals who are working with axis2. ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null); NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint); ServiceClient client = stub._getServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(aEndPoint)); //Added chunking property: options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); client.setOptions(options); //Engaged rampart module: client.engageModule("rampart"); return stub; Above is the magic combination that worked for me. Adding the rampart module back in it gave me a chunking exception and after adding that property regarding chunking it worked. I am not sure if this particular web service I was connecting to has special settings requiring the above config but it was very frustrating getting the perfect combination.
accepted answer of: http://stackoverflow.com/q/26766366
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26766366

http://stackoverflow.com/comment/42236463
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26834430
type: Comment
has text: I didn't have any errors in my logs, so this didn't exactly solve my problem, but it helped get me there! I will post the solution shortly.

http://stackoverflow.com/q/26806743
has comment: http://stackoverflow.com/comment/42186476
has title: Limit connection keep alive time in HTTP client 3.1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42190610
answer count: 0
has comment: http://stackoverflow.com/comment/42188956
type: Question
tagged with: apache-commons-httpclient
has body: I use the Apache HTTP client 3.1 with the MultiThreadedHttpConnectionManager to poll an API every couple second. Whenever a new version of the API is deployed, the DNS entries are changed to point to a new server. Since I use HTTP keep alive and the old server does not close the connection, I keep hitting the old server which leads to various problem. It does not help to use the IdleConnectionTimeoutThread since the connection is never idle for a longer time and I couldn't find an setting which lets me limit the time for which a connection is reused. I don't want to disable keep alive because this would add too much overhead. My current idea is to set a new connection manager every minute and call the shutdown() method on the old connection manager. However, I am not convinced that this is the right approach. Is there any other way of solving this problem? My restrictions are: I have to use HTTP keep alive I cannot control the API or the deployment of the service I cannot update to Apache HTTP client 4.x or another HTTP client
has comment: http://stackoverflow.com/comment/42196492
score: 0
tagged with: http

http://stackoverflow.com/comment/42211056
has text: No not at all i want just a sample!
comment on: http://stackoverflow.com/q/26719773
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33104797
answers question: http://stackoverflow.com/q/26723376
has body: Note that as of Querydsl 4.x, the accepted answer by Timo Westkämper is no longer valid. Breaking changes in Querydsl 4.0 have removed the query.list() method. A solution working with Querydsl 4.0+ would now be: query.from(application) .groupBy(application.category) .select(application.category, application.category.count()) .fetch();
downvote count: 0
upvote count: 30
score: 30
type: Answer

http://stackoverflow.com/q/26721911
has answer: http://stackoverflow.com/a/26722174
has comment: http://stackoverflow.com/comment/42033647
has comment: http://stackoverflow.com/comment/42033866
type: AnsweredQuestion
has body: I've been scratching my head over this for a while.. couldn't figure out what to do. String tempprice = null; String findPriceCommand = "SELECT sellingprice FROM `item` WHERE itemNo = '" + itemNo + "'"; try { tempprice = viewValue(conn, findPriceCommand); } catch (SQLException e) { e.printStackTrace(); } Double price = Double.parseDouble(tempprice); Double temp = (quantity.get(count) * price); finalprice.add(temp); All im trying to do it get the price from the database using itemNo. Since im getting this value as a string value, i used Double price = Double.parseDouble(tempprice); to change it to a double value. It all worked before i turned finalprice into an ArrayList (so that i can insert multiple values at once.. (code given above is part of a loop...) Anyway, now im getting a NullPointerException Like this: int count = 0; if (action.getSource() == btnAdd) { //other ArrayList variables ArrayList&lt;Integer&gt; quantity = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Double&gt; finalprice = new ArrayList&lt;Double&gt;(); //.....previous code... count++; } Any clue what I'm missing here? :/
tagged with: java
has comment: http://stackoverflow.com/comment/42034207
has comment: http://stackoverflow.com/comment/42033922
has comment: http://stackoverflow.com/comment/42034227
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/42033590
has comment: http://stackoverflow.com/comment/42033968
has comment: http://stackoverflow.com/comment/42033991
tagged with: arraylist
score: 0
has title: Nullpointerexception when using parseDouble
has comment: http://stackoverflow.com/comment/42033793
has comment: http://stackoverflow.com/comment/42033650
answer count: 1
accepted answer: http://stackoverflow.com/a/26722174
has comment: http://stackoverflow.com/comment/42033890
has comment: http://stackoverflow.com/comment/70720502
tagged with: double

http://stackoverflow.com/comment/41978571
type: AnswerComment
type: Comment
has text: Thank you, I've found a way, I get the resultsetmetadata of the table I want to insert, get the java.sql.Types of each column, and then use the preparedStatement.setObject((int parameterIndex, Object x,int targetSqlType). What do you think? Is there better way?
comment on: http://stackoverflow.com/a/26690950
score: 0

http://stackoverflow.com/a/26726668
has comment: http://stackoverflow.com/comment/42042413
has comment: http://stackoverflow.com/comment/42115999
has comment: http://stackoverflow.com/comment/42043879
has comment: http://stackoverflow.com/comment/42182795
score: 0
has body: 1.No need to create a system service, just a normal service which run in background,you don't need GUI so don't use activity but service. 3. If make it as a system service ,when error occurred ,the whole system will be reset.
type: Answer
has comment: http://stackoverflow.com/comment/42076650
answers question: http://stackoverflow.com/q/26726259
has comment: http://stackoverflow.com/comment/42087315

http://stackoverflow.com/q/26797354
has comment: http://stackoverflow.com/comment/42168811
type: Question
tagged with: object
tagged with: java
has comment: http://stackoverflow.com/comment/42169888
has comment: http://stackoverflow.com/comment/42168696
has answer: http://stackoverflow.com/a/26797523
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42169069
has title: passing objects as parameters in java
answer count: 4
has comment: http://stackoverflow.com/comment/42169041
has answer: http://stackoverflow.com/a/26797544
has answer: http://stackoverflow.com/a/26797467
has comment: http://stackoverflow.com/comment/42169172
has answer: http://stackoverflow.com/a/26797878
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42168940
linked to: http://stackoverflow.com/q/40480
has body: I'm trying to make a 2d game in Java. In the process I soon noticed that many objects needed bounds (x1, x2, y1, y2) and as a consequence many methods thus had parameters (int x1, int x2, int y1, int y2). So I thought what the heck, why not make an object IntRectangle with attributes x1, x2, y1, y2 (which I set as public for a performance boost), along with a few helpful methods like getWidth(), getHeight(), etc. At this point my code is much cleaner and I haven't lost much performance since the variables are public. I soon noticed, unlike passing primitive values into a method, the values of the passed object changed when I changed them in the method. For instance, with a primitive value int x = 10; subtract5(x); print(x); void subtract5(int i) { i -= 5; } this line of code would print 10. But with an object... class XY { public int X; public int Y; } main { XY xy = new XY(); xy.X = 5; xy.Y = 10; changeX(xy); print xy.X; } changeX(XY xy2) { xy2.X = 7; } It prints 7; The theory I've developed is that an int is not a pointer to an int, it's an int stored in the register. It is pushed when a method is called and then popped back when returned, unchanged. An object is a reference to an object. The object itself isn't pushed onto the stack, just the pointer. But I've tired this with strings (that I know are objects) and they behave just like ints in this matter, which confuses me. Perhaps they make a copy out of themselves somehow? Well, I hope someone can shed some light on this matter and tell me where my reasoning is taking a wrong turn and hopefully give me some advice on how to clean up my code, keep performance, but without making it venerable.
upvote count: 1
tagged with: parameter-passing

http://stackoverflow.com/comment/42158887
comment on: http://stackoverflow.com/q/26791476
has text: You should perform `if(s.length() == 1) return true;` BEFORE substringing. If `s.length() == 1`, then `s.substring(s.length()-2)` will be out of bounds. Perform the length check before doing anything else
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26675441
has comment: http://stackoverflow.com/comment/41951304
has answer: http://stackoverflow.com/a/26676421
tagged with: wicket
has title: Wicket: add TextField / Panel dynamically
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41950974
has body: I want to add some TextField to a form dynamically and hide or show some of the onClick. What I want to implement as image (its actually german so I explain it): On the left side there are the days of the week (Monday, Tuesday, ... , Sunday). If u click the button with the arrow to the right direction the actuall week should hide and the next week shows up. I stored an Integer that represent a cycle. So If in the database is a 3 I need to be able to click 3 times on the button "next week". (NOTE: this number can change dynamically). So If I change the number 3 to 5 I need 5 times this form. I hope I described it "O.k", my english isn´t the best. Sorry for that. What I´ve read: First I need a panel where I add the TextFields, second I need a ListView which gets a list of Panels. But I don´t get how this works.. is this the right way to do this? FormPanel: public class FoodFieldPanel extends Panel { public FoodFieldPanel(String id) { super(id); WebMarkupContainer foodFields = new WebMarkupContainer("foodFields"); TextField monday = new TextField("monday"); TextField tuesday = new TextField("tuesday"); TextField wendnesday = new TextField("wendnesday"); TextField thursday = new TextField("thursday"); TextField friday = new TextField("friday"); TextField saturday = new TextField("saturday"); TextField sunday = new TextField("sunday"); foodFields.add(monday); foodFields.add(tuesday); foodFields.add(wendnesday); foodFields.add(thursday); foodFields.add(friday); foodFields.add(saturday); foodFields.add(sunday); add(foodFields); } } Page: public class FoodDetailPanel extends Panel { public FoodDetailPanel(String id, final IModel&lt;Category&gt; catModel, boolean fieldsEnabled) { super(id, catModel); setOutputMarkupId(true); int cycle = 4; List&lt;FoodFieldPanel&gt; textFields = new ArrayList&lt;FoodFieldPanel&gt;(); for (int a = 1; a &lt;= cycle; a++) { textFields.add(new FoodFieldPanel("foodField")); } add(new ListView("test", textFields) { protected void populateItem(List…
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26676421
type: Question
has comment: http://stackoverflow.com/comment/41950601
has comment: http://stackoverflow.com/comment/41950905
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42187286
type: AnswerComment
has text: @usr55410: start with correct and then [profile](http://stackoverflow.com/q/2064427/230513) for fast; +1 for `SWingWorker`.
type: Comment
comment on: http://stackoverflow.com/a/26806472
score: 1

http://stackoverflow.com/comment/42169103
type: AnswerComment
type: Comment
score: 0
has text: Don't worry too much about the slider, the model feeds information to the delegate, the component acts as the glue between the two. You need a model which controls not only the range the user can zoom, but the current zoom value and the original image...
comment on: http://stackoverflow.com/a/26793687

http://stackoverflow.com/comment/42155140
has text: @AmandaMerical : when if(i>numDigits(number)) is true everytime return negative; but when this line was false , your method return digit;
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26789415
score: 0

http://stackoverflow.com/comment/42014169
type: Comment
comment on: http://stackoverflow.com/a/26711246
has text: Now it works... the key was to to pack(), THEN use the code, and then pack AGAIN. So much packing, but it works now! Thanks :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42100501
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26759587
has text: Thank you! I feel a little blind and embarrassed now, should have seen that. :).

highest
tag name: highest
tags question: http://stackoverflow.com/q/26739402
type: Tag

http://stackoverflow.com/comment/42108037
comment on: http://stackoverflow.com/q/26761130
score: 0
type: Comment
type: QuestionComment
has text: This question is similar to http://stackoverflow.com/questions/26672773/format-a-date-string-java . Maybe my answer can help you.

http://stackoverflow.com/a/26814087
has comment: http://stackoverflow.com/comment/42207149
has comment: http://stackoverflow.com/comment/42207599
accepted answer of: http://stackoverflow.com/q/26805966
answers question: http://stackoverflow.com/q/26805966
upvote count: 8
type: AcceptedAnswer
type: Answer
has body: As proposed by markspace, using an AtomicInteger is a good solution: AtomicInteger progress = new AtomicInteger(); Collection.parallelStream().forEach(signer -&gt; { progress.incrementAndGet(); // do some other useful work }); I would not use the runLater() variant as your goal is a high performance, and if many parallel threads will generte JavaFX 'runLater' tasks, you will again create a bottleneck... For the same reason I would NOT call an update to the ProgressBar each time, but use a seaparte JavaFX Timeline to update the progress bar in regular intervals independently from the processing threads. Here is a full code comparing sequential and parallel processing with ProgressBar. If you remove the sleep(1) and set the number of items to 10 million it will still work concurrently and efficiently... public class ParallelProgress extends Application { static class ParallelProgressBar extends ProgressBar { AtomicInteger myDoneCount = new AtomicInteger(); int myTotalCount; Timeline myWhatcher = new Timeline(new KeyFrame(Duration.millis(10), e -&gt; update())); public void update() { setProgress(1.0*myDoneCount.get()/myTotalCount); if (myDoneCount.get() &gt;= myTotalCount) { myWhatcher.stop(); myTotalCount = 0; } } public boolean isRunning() { return myTotalCount &gt; 0; } public void start(int totalCount) { myDoneCount.set(0); myTotalCount = totalCount; setProgress(0.0); myWhatcher.setCycleCount(Timeline.INDEFINITE); myWhatcher.play(); } public void add(int n) { myDoneCount.addAndGet(n); } } HBox testParallel(HBox box) { ArrayList&lt;String&gt; myTexts = new ArrayList&lt;String&gt;(); for (int i = 1; i &lt; 10000; i++) { myTexts.add("At "+System.nanoTime()+" ns"); } Button runp = new Button("parallel"); Button runs = new Button("sequential"); ParallelProgressBar progress = new ParallelProgressBar(); Label result = new Label("-"); runp.setOnAction(e -&gt; { if (progress.isRunning()) return; result.setText("..."); progress.start(myTexts.size()); new Thread() { public v…
score: 8
downvote count: 0

http://stackoverflow.com/a/26676146
upvote count: 2
type: Answer
has body: So your problem is not based on a dependency it's because you configured maven-assembly-plugin wrong: [...] [...] org.apache.maven.plugins maven-assembly-plugin 2.5 jar-with-dependencies package <goals> single <goals> package The problem is that maven-assembly-plugin does not bind by default to any life cycle phase. Afterwards try: mvn clean package And check the resulting jar file (target/WhatEver-x.x-SNAPSHOT-jar-with-dependencies.jar).
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42007928
answers question: http://stackoverflow.com/q/26674806

http://stackoverflow.com/comment/42169972
has text: @BogdanM. I am trying to use this way of handling ArrayList in a project I am working on.
comment on: http://stackoverflow.com/q/26797822
score: 0
type: Comment
type: QuestionComment

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/26733700

http://stackoverflow.com/q/26767453
upvote count: 1
score: 1
tagged with: java
tagged with: stream
has body: I am currently working on integrating Netty to a server that will communicate using XML messages. These XML messages are actually objects that has been serialized to XML-messages which are then sent over a TCP connection. I can both send and receive objects, but I get the following exception at the second message I send to the server: java.lang.IndexOutOfBoundsException: readerIndex(306) + length(613) exceeds writerIndex(614): UnpooledUnsafeDirectByteBuf(ridx: 306, widx: 614, cap: 1024) at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1161) at io.netty.buffer.AbstractByteBuf.skipBytes(AbstractByteBuf.java:734) at io.netty.buffer.WrappedByteBuf.skipBytes(WrappedByteBuf.java:540) at io.netty.handler.codec.xml.XmlFrameDecoder.decode(XmlFrameDecoder.java:176) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:227) I have the following code to initialize the channel: @Override public void initChannel(SocketChannel ch) throws Exception { LOGGER.info("Accepted connection from " + ch.remoteAddress().toString()); ClientConnection connection = new ClientConnection(ch); ch.pipeline().addLast(new XmlFrameDecoder(6000), connection); } And the following code to handle messages I receive: @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { LOGGER.info("Got data"); ByteBuf buf = (ByteBuf)msg; try (ByteBufInputStream is = new ByteBufInputStream(buf)) { Message message = MessageFactory.getInstance().deserialize(is); // does stuff with message... } catch (Throwable ex) { LOGGER.log(Level.WARNING, ex.getMessage(), ex); } finally { ReferenceCountUtil.release(msg); } } And this code for sending messages: public void sendMessage(Message msg) { ByteBufAllocator alloc = PooledByteBufAllocator.DEFAULT; ByteBuf buf = alloc.buffer(1024); try (ByteBufOutputStream outputStream = new ByteBufOutputStream(buf)) { String message = MessageFactory.getInstance().serialize(msg) + "\0"; outputStream.write(message.getBytes()…
type: Question
tagged with: network-programming
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26768243
type: UnansweredQuestion
tagged with: netty
has title: Netty throws IndexOutOfBoundsException

http://stackoverflow.com/a/26781790
type: Answer
score: 1
upvote count: 1
has body: This is because hashcode() method of Integer class returns value as hashcode. Returns a hash code for this Integer. @return a hash code value for this object, equal to the primitive int value represented by this Integer object. public int hashCode() { return value; } While hashcode() method of Double class performs some operation and returns hashcode. Returns a hash code for this Double object. The result is the exclusive OR of the two halves of the long integer bit representation, exactly as produced by the method {@link #doubleToLongBits(double)}, of the primitive double value represented by this Double object. That is, the hash code is the value of the expression: public int hashCode() { long bits = doubleToLongBits(value); return (int)(bits ^ (bits >>> 32)); }
answers question: http://stackoverflow.com/q/26781550
downvote count: 0

http://stackoverflow.com/a/26819717
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42209238
answers question: http://stackoverflow.com/q/26819583
type: Answer
has body: You should use relative path instead of absolute path. Absolute path is machine dependent. In your case the right path is "/src/wolfHowl.mp3" Check the answers to similar question here. You can read more on path operations here.
has comment: http://stackoverflow.com/comment/42209357
upvote count: 1
has comment: http://stackoverflow.com/comment/42209369
has comment: http://stackoverflow.com/comment/42209185
score: 1
accepted answer of: http://stackoverflow.com/q/26819583
has comment: http://stackoverflow.com/comment/42209401

http://stackoverflow.com/comment/44154892
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26771891
type: Comment
has text: I'm glad it works but you don't fill me with confidence. Maybe you should post your solution in the form of a new question.

http://stackoverflow.com/comment/42159609
type: Comment
comment on: http://stackoverflow.com/a/26784352
has text: @Petr.M It's possible that under some OSs (like windows), the cursor only supports 256 colors, the image may be getter dithered to support this...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42154955
type: QuestionComment
comment on: http://stackoverflow.com/q/26780957
score: 0
has text: I was thinking that `Resource` should implements `ApplicationContextAware` , and within its `@PostConsturct` you could use `applicationContext.getBeansOfType(ResourceProcessor.class)`. Yes is a twisted thought but i think that works fine :)
type: Comment

http://stackoverflow.com/a/26741694
has comment: http://stackoverflow.com/comment/42069531
has comment: http://stackoverflow.com/comment/42069791
has comment: http://stackoverflow.com/comment/42069979
has body: You cannot use the function as an argument to priority queue (In java), but you can use return value of the function, as long as return type of the function matches the required argument. The type of the argument in offer() is specified by generics. Here is code example. public static int login(){ return 0; } public static void main (String[] args){ PriorityQueue&lt;Integer&gt; prq = new PriorityQueue&lt;Integer&gt;(); prg.offer(login()); } You can then change Integer to whatever is return type of your function login().
has comment: http://stackoverflow.com/comment/42069458
has comment: http://stackoverflow.com/comment/42069145
answers question: http://stackoverflow.com/q/26741520
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42069690
has comment: http://stackoverflow.com/comment/42070086
has comment: http://stackoverflow.com/comment/42069483
has comment: http://stackoverflow.com/comment/42069212
has comment: http://stackoverflow.com/comment/42069319

http://stackoverflow.com/comment/42197902
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26812921
has text: The ArrayList "capacity" is irrelevant, except for (supposed) performance tuning purposes.
type: Comment

http://stackoverflow.com/comment/42083413
comment on: http://stackoverflow.com/q/26749560
type: Comment
type: QuestionComment
has text: The specific test case that is giving the odd numbers would let someone tell exactly what is going on. It is most likely one of the general answers below.
score: 0

http://stackoverflow.com/comment/42190573
has text: Thanks I am happy to solve your problem
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26808528

http://stackoverflow.com/a/26822176
score: 3
has body: Your three methods are synchronized on the same instance. And Thread#sleep(..) does not release the lock acquired by synchronized. So the thread executing t1 acquires the lock, sleeps for a second, wakes up, calls notifyAll() and completes. Your two other threads then each get a turn at executing and call wait(). But there's nothing left to notify them, so your application blocks. You've got a race condition. Change the order in which you start the threads or run it like you have enough times and you'll potentially see different behavior.
upvote count: 3
has comment: http://stackoverflow.com/comment/42213716
downvote count: 0
has comment: http://stackoverflow.com/comment/42213743
answers question: http://stackoverflow.com/q/26822156
has comment: http://stackoverflow.com/comment/42213682
type: Answer

http://stackoverflow.com/a/26795508
type: AcceptedAnswer
downvote count: 0
has body: You can use: int position = ARRAYLETTERS.indexOf("a"); As an aside, you really should stick to standard java naming conventions and use camel case (arrayLetters) instead of all-caps for member names.
type: Answer
has comment: http://stackoverflow.com/comment/42165296
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26795485
score: 3
answers question: http://stackoverflow.com/q/26795485

http://stackoverflow.com/q/26752034
answer count: 2
has body: In Java we got a special for-loop to read from arrays: for (char c : a) System.out.print(c + " "); Every element of the array a will be saved in the variable c. The variable c will be unavailable after the loop is finished. This can be used to output easily every element of the array. Does this special for-loop exist in PHP? I wasn't able to find it in the PHP docs and in the Google results.
linked to: http://stackoverflow.com/q/2350361
possible better answer: http://stackoverflow.com/a/26752154
has comment: http://stackoverflow.com/comment/42087537
has comment: http://stackoverflow.com/comment/42087942
tagged with: php
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26752154
tagged with: java
has answer: http://stackoverflow.com/a/26752059
accepted answer: http://stackoverflow.com/a/26752059
type: Question
has title: read-only for-loop in PHP
tagged with: arrays
score: 0

http://stackoverflow.com/comment/41981096
comment on: http://stackoverflow.com/a/26692626
score: 0
type: AnswerComment
type: Comment
has text: No no, that part is like you said. I asked for "run configuration" part.

http://stackoverflow.com/a/26789454
answers question: http://stackoverflow.com/q/26789365
has body: Something like this: public class MyMap&lt;K,V&gt; extends HashMap&lt;K,V&gt; { @Override public V put(K key, V value) { // maybe I want to print the key first... System.out.println("Key = " + key); super.put(key, value); // add it to the data structure by using the superclass } @Override public V get(K key) { // do something similar } @Override public int size() { // do something similar } }
type: Answer
score: 0

http://stackoverflow.com/q/26757486
type: Question
tagged with: hibernate-search
tagged with: jpa
tagged with: lucene
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26764592
type: UnansweredQuestion
has title: Same Hibernate Search Lucene index for multiple applications
tagged with: java
tagged with: hibernate
has body: I have a database which is being used by two applications Appl 1 and Appl 2 .Both the applications perform Read/Write/Update on the DB. I am using hibernate search for Indexing my search. My problem is as follows : Both Appl1 and Appl2 reside on different servers and hence maintain there own copy of the index,on their local file system. Now because of this if Appl1 does any update/delete operation Appl2 does not reflect the changes and vice-versa. Is there any way that both application indexes get updated,when either one of them performs any operation,or i can create a common index directory that is used by both the applications.

http://stackoverflow.com/q/26737270
score: 2
downvote count: 0
answer count: 0
tagged with: java
type: Question
has body: My webservice XML is as follow: HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> string string </soap:Body> </soap:Envelope> How do I go about receiving that as an array on my android app? I have attempted the following but the result returned is 0. (I know there is more than 0 entries) //panels webservice public static String[] invokeGetAllPanelsWS(String ON, String SA) { String[] returnList = null; // Create request to get all the panels SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, ON); // Create envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //ensures that the envelope is .NET compatible envelope.dotNet = true; // Set output SOAP object envelope.setOutputSoapObject(request); // Create HTTP call object HttpTransportSE androidHttpTransport = new HttpTransportSE(SOAP_ADDRESS); try { // Invoke web service androidHttpTransport.call(SA, envelope); // Get the response SoapObject response = (SoapObject) envelope.getResponse(); // get the amount of list items int intPropertyCount = response.getPropertyCount(); //creates a new return array returnList = new String[intPropertyCount]; //loops through all the results for (int i = 0; i < intPropertyCount; i++) { String str = ((String)(response).getPropertyAsString(i)); returnList[i] = str; } } catch (Exception e) { //should show error screen //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! System.out.println(e.getMessage()); e.printStackTrace(); return null; } //Return array to calling object return returnList; } Now this I call on one of my main activities to test as such: public class WebServiceGetAllPanels extends AsyncTask<Void, Void, String[]> { @Override protected void onPreExecute() { // TODO Auto…
tagged with: javascript
tagged with: eclipse
upvote count: 2
tagged with: arrays
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android webservice: How to receive an array of string

http://stackoverflow.com/comment/42582755
comment on: http://stackoverflow.com/a/26722375
score: 0
type: AnswerComment
type: Comment
has text: cpp or m4 both do file inclusion. You could also just concatenate a number of files together using cat or ANT's concat task.

http://stackoverflow.com/comment/41971502
type: Comment
has text: @Dhinakar Not according to your Exception (or the query you posted).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26686935

http://stackoverflow.com/comment/42144557
comment on: http://stackoverflow.com/a/26726650
has text: To know which toggle button is chosen. When a toggle button is chosen change the lastButtonIndex value to the toggle buttons index number in the toggleButtons array. When the plus and minus signs are hit you can easily change it by just adding/subtracting one instead of using the counter to find the button.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26708898
has comment: http://stackoverflow.com/comment/42010990
has comment: http://stackoverflow.com/comment/42011087
has comment: http://stackoverflow.com/comment/42013026
has comment: http://stackoverflow.com/comment/42011991
has comment: http://stackoverflow.com/comment/42011330
has comment: http://stackoverflow.com/comment/42011028
has comment: http://stackoverflow.com/comment/42010928
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42012804
has comment: http://stackoverflow.com/comment/42010563
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42010236
type: Question
has body: Every time a connection is made from the client to the server, the client sends a string message "11" to the server, and when the Server receives the string message "11" it operates count++. Then there has been two connections made, which should make count = 2 from count++ operating twice, but when the client connects, I checked it and the client sends the string message "11" correctly to the server, but the count stays as 1 and never enters the if(count == 2) block. Been testing and looking for hours but can't seem to locate the problem. Please help! Thank you Client's snippet code: Socket s = new Socket(hostname, port); // Plug in the socket to connect to the server pw = new PrintWriter(s.getOutputStream()); //Instance of sending it out BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); public void run() { //Deal with reading from server and print them out try { pw.println("11"); //Sends the message when connection is made to the server pw.flush(); } catch (Exception e) { e.printStackTrace(); } try{ while(true){ String line = br.readLine(); //Read in the message from server if(line.equals("12")){ //When finally receives the string message "12" from server button.setBackground(Color.white); button.addActionListener(sl); } int update = Integer.parseInt(line); if(update &lt; 10){ current-= update; } } } catch (IOException ioe){ System.out.println("ioe in ChatClient.run: " + ioe.getMessage()); } } Server thread's snippet code: PrintWriter pw = new PrintWriter(s.getOutputStream()); public void run(){ try{ BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); while(true){ String line = br.readLine(); //blocking //Keep reading in messages if(line.equals("11")){ //Tested it out and does receive "11" whenever a client connects and prints out "11" count++; //But the problem is count stays as 1 every time it connects and never becomes 2 System.out.println(line); System.out.println(count); } if(count == 2){ //Never …
tagged with: network-programming
has comment: http://stackoverflow.com/comment/42010951
has comment: http://stackoverflow.com/comment/42010626
tagged with: java
has title: Why is my count++ resetting in my run() method inside the Thread class?
has answer: http://stackoverflow.com/a/26709920
has comment: http://stackoverflow.com/comment/42010586
score: 0
has comment: http://stackoverflow.com/comment/42010552
has comment: http://stackoverflow.com/comment/42010276
answer count: 1
tagged with: user-interface

http://stackoverflow.com/a/26828783
answers question: http://stackoverflow.com/q/26828175
type: AcceptedAnswer
has body: Resending the json object with id again for update is the best idea. because you dont need to edit the particular attribute in the entity object which was changed in the ui. Receiving the complete json and update method of hibernate makes the edit process easier.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26828175

http://stackoverflow.com/q/26724120
has body: Currently I am using cometd 3.0.2 (the latest one). Trying to do a simple handshake it gives me the following error: With jetty 7.4.4: java.lang.NoClassDefFoundError: org/eclipse/jetty/client/api/ContentProvider With jetty 9.2.3: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ajax/JSON This is the code that I am trying to run: import java.util.HashMap; import java.util.Map; import org.cometd.client.BayeuxClient; import org.cometd.client.transport.ClientTransport; import org.cometd.client.transport.LongPollingTransport; import org.eclipse.jetty.client.HttpClient; public class MyClass { public static void main(String[] args) throws Exception { // Create (and eventually set up) Jetty's HttpClient: HttpClient httpClient = new HttpClient(); // Here set up Jetty's HttpClient, for example: // httpClient.setMaxConnectionsPerAddress(2); httpClient.start(); // Prepare the transport Map&lt;String, Object&gt; options = new HashMap&lt;String, Object&gt;(); ClientTransport transport = new LongPollingTransport(options, httpClient); BayeuxClient client = new BayeuxClient("http://localhost:8080/cometd", transport); client.handshake(); boolean handshaken = client.waitFor(1000, BayeuxClient.State.CONNECTED); if (handshaken) { System.out.println("Yey"); } } } Does anyone know which jetty is compatible with the latest cometd? Or any other cometd?
has comment: http://stackoverflow.com/comment/42039502
tagged with: cometd
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42039029
tagged with: jetty
has comment: http://stackoverflow.com/comment/42037884
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26745511
type: Question
has title: Which version of jetty is compatible with cometd-3.0.2

multithreading
tags question: http://stackoverflow.com/q/26673750
tags question: http://stackoverflow.com/q/26689550
tags question: http://stackoverflow.com/q/26768302
tags question: http://stackoverflow.com/q/26811140
tags question: http://stackoverflow.com/q/26712062
tags question: http://stackoverflow.com/q/26791069
tags question: http://stackoverflow.com/q/26684367
tags question: http://stackoverflow.com/q/26754146
type: Tag
tags question: http://stackoverflow.com/q/26756513
tags question: http://stackoverflow.com/q/26702452
tags question: http://stackoverflow.com/q/26772257
tags question: http://stackoverflow.com/q/26828735
tags question: http://stackoverflow.com/q/26718522
tags question: http://stackoverflow.com/q/26687111
tags question: http://stackoverflow.com/q/26737897
tags question: http://stackoverflow.com/q/26822156
tags question: http://stackoverflow.com/q/26801620
tags question: http://stackoverflow.com/q/26789279
tags question: http://stackoverflow.com/q/26736418
tags question: http://stackoverflow.com/q/26701869
tags question: http://stackoverflow.com/q/26789754
tags question: http://stackoverflow.com/q/26814372
tags question: http://stackoverflow.com/q/26799266
tags question: http://stackoverflow.com/q/26693707
tags question: http://stackoverflow.com/q/26739497
tags question: http://stackoverflow.com/q/26713387
tags question: http://stackoverflow.com/q/26699019
tags question: http://stackoverflow.com/q/26765999
tags question: http://stackoverflow.com/q/26764650
tags question: http://stackoverflow.com/q/26751640
tags question: http://stackoverflow.com/q/26807529
tags question: http://stackoverflow.com/q/26830244
tags question: http://stackoverflow.com/q/26818285
tags question: http://stackoverflow.com/q/26788912
tags question: http://stackoverflow.com/q/26821099
tags question: http://stackoverflow.com/q/26772109
tags question: http://stackoverflow.com/q/26825867
tags question: http://stackoverflow.com/q/26829296
tags question: http://stackoverflow.com/q/26706342
tags question: http://stackoverflow.com/q/26786594
tags question: http://stackoverflow.com/q/26682230
tags question: http://stackoverflow.com/q/26714341
tags question: http://stackoverflow.com/q/26782436
tags question: http://stackoverflow.com/q/26816336
tags question: http://stackoverflow.com/q/26709471
tags question: http://stackoverflow.com/q/26709538
tags question: http://stackoverflow.com/q/26695171
tags question: http://stackoverflow.com/q/26754254
tags question: http://stackoverflow.com/q/26723924
tags question: http://stackoverflow.com/q/26699101
tags question: http://stackoverflow.com/q/26675381
tags question: http://stackoverflow.com/q/26816706
tags question: http://stackoverflow.com/q/26732112
tags question: http://stackoverflow.com/q/26795788
tags question: http://stackoverflow.com/q/26724443
tags question: http://stackoverflow.com/q/26719944
tags question: http://stackoverflow.com/q/26806160
tags question: http://stackoverflow.com/q/26761736
tags question: http://stackoverflow.com/q/26783038
tags question: http://stackoverflow.com/q/26831222
tags question: http://stackoverflow.com/q/26741290
tags question: http://stackoverflow.com/q/26694354
tags question: http://stackoverflow.com/q/26740095
tags question: http://stackoverflow.com/q/26756688
tags question: http://stackoverflow.com/q/26788260
tags question: http://stackoverflow.com/q/26680634
tags question: http://stackoverflow.com/q/26781416
tags question: http://stackoverflow.com/q/26704002
tags question: http://stackoverflow.com/q/26768529
tags question: http://stackoverflow.com/q/26728743
tags question: http://stackoverflow.com/q/26831569
tags question: http://stackoverflow.com/q/26729447
tags question: http://stackoverflow.com/q/26753635
tags question: http://stackoverflow.com/q/26741582
tags question: http://stackoverflow.com/q/26798073
tags question: http://stackoverflow.com/q/26793222
tags question: http://stackoverflow.com/q/26746919
tags question: http://stackoverflow.com/q/26719521
tags question: http://stackoverflow.com/q/26815474

http://stackoverflow.com/a/26747490
answers question: http://stackoverflow.com/q/26747276
has comment: http://stackoverflow.com/comment/42079955
score: 0
has body: Try this: class Person implements Comparable&lt;Person&gt;{ private String fname; private String mname; private String lname; private String age; private String address; public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public int compareTo(Person o2) { return (fname+lname+mname+age+address).compareTo(o2.fname+o2.lname+o2.mname+o2.age+o2.address); } }
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26776011
has comment: http://stackoverflow.com/comment/42134934
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42130777
has body: You can use @MappedSuperclass annotation on the interface class. AFAIK this is the right way to do it.
type: Answer
has comment: http://stackoverflow.com/comment/42131130
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26775460
has comment: http://stackoverflow.com/comment/42135098
accepted answer of: http://stackoverflow.com/q/26775460

http://stackoverflow.com/a/26826440
type: Answer
has body: It's depend of the encoding used, but you can write it in memorystream and get the length.
upvote count: 0
has comment: http://stackoverflow.com/comment/42221100
score: -2
answers question: http://stackoverflow.com/q/26826394
downvote count: 2

http://stackoverflow.com/a/26780527
downvote count: 1
answers question: http://stackoverflow.com/q/26729809
upvote count: 3
has body: The relevant exception : Caused by: java.lang.UnsupportedOperationException: Can't convert to integer: type=0x3 at android.content.res.TypedArray.getInteger(TypedArray.java:368) at com.digitalaria.gama.wheel.WheelBehavior.&lt;init&gt;(WheelBehavior.java:117) WheelBehavior.java, line 117 setWheelDiameter(arr.getInteger(R.styleable.Wheel_wheel_diameter, Configuration.DEFAULT_WHEEL_DIAMETER)); Here are the styleable attributes : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="Wheel"&gt; &lt;attr name="wheel_rotation_duration" format="integer"/&gt; &lt;!-- default:400 --&gt; &lt;attr name="wheel_diameter" format="integer"/&gt; &lt;!-- default:250 --&gt; &lt;attr name="items" format="integer"/&gt; &lt;attr name="item_selected_index" format="integer"/&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; wheel_diameter must be defined somewhere in your project, with something else than a integer inside it. That's why it crashed. But according to your layout, it is not. Try a global search on the string wheel_diameter
has comment: http://stackoverflow.com/comment/42163286
has comment: http://stackoverflow.com/comment/42357183
has comment: http://stackoverflow.com/comment/42182109
type: Answer
has comment: http://stackoverflow.com/comment/42168914
has comment: http://stackoverflow.com/comment/42179045
score: 2
has comment: http://stackoverflow.com/comment/42178765
has comment: http://stackoverflow.com/comment/42372412

http://stackoverflow.com/comment/42077843
score: 0
type: AnswerComment
type: Comment
has text: Main class = Main.java
comment on: http://stackoverflow.com/a/26745877

http://stackoverflow.com/q/26739738
accepted answer: http://stackoverflow.com/a/26739914
tagged with: jpa
downvote count: 0
favorite count: 0
has title: How to configure hibernate properties without persistence xml
type: Question
tagged with: spring
tagged with: spring-mvc
upvote count: 2
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26739914
answer count: 1
has body: I have a Spring MVC web setup with a Spring ORM/Hibernate persistence layer. I have configured my LocalContainerEntityManagerFactoryBean to auto-scan for persistence entities on a package so I don't need persistence xml configuration. How can I set up my beans configuration so it shows the generated queries and refreshes the database with model changes on startup?
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/41989571
type: Comment
comment on: http://stackoverflow.com/a/26697497
type: AnswerComment
has text: thanks a lot. ^^ There´s no error message anymore, yay! But now it keeps printing 2 all the time in infinite amounts. :?
score: 0

http://stackoverflow.com/comment/41999699
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26703091
has text: If you can successfully compile it and run it then it may be some false-positive code analysis error ... IntelliJ gives me those from time to time (possibly a bug in the IDE?). When I restart IntelliJ it usually disappears. This also happens when you don't have project SDK defined, but since you can compile and run it that's probably not the case.
type: QuestionComment

http://stackoverflow.com/a/26824488
has comment: http://stackoverflow.com/comment/42217988
type: Answer
answers question: http://stackoverflow.com/q/26824475
upvote count: 1
score: 1
has body: Just type: /* and then 'enter'. It will start a comment block for you with just the single ending */ and your cursor in the middle. At least, that's what I think you are asking?
downvote count: 0

http://stackoverflow.com/a/26795599
upvote count: 7
accepted answer of: http://stackoverflow.com/q/26795598
answers question: http://stackoverflow.com/q/26795598
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
has body: HTML from a Jar file that links resources (e.g. CSS or images) by relative references will work just fine. E.G. This example loads HTML (that has a relative reference to an image) from a Jar. import javax.swing.*; import java.net.URL; class ShowHtml { public static void main(String[] args) { final String address = "jar:http://pscode.org/jh/hs/object.jar!/popup_contents.html"; SwingUtilities.invokeLater(new Runnable() { public void run() { try { URL url = new URL(address); JEditorPane jep = new JEditorPane(url); JFrame f = new JFrame("Show HTML in Jar"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JScrollPane(jep)); f.pack(); f.setSize(400,300); f.setLocationByPlatform(true); f.setVisible(true); } catch(Exception e) { e.printStackTrace(); } } }); } } Screenshot HTML The HTML that is being loaded. <!-- * Copyright (C) 1997 Sun Microsystems, Inc * All rights reserved. * Notice of copyright on this source code * product does not indicate publication. * * RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by * the U.S. Government is subject to restrictions as set forth * in subparagraph (c)(1)(ii) of the Rights in Technical Data * and Computer Software Clause at DFARS 252.227-7013 (Oct. 1988) * and FAR 52.227-19 (c) (June 1987). * * Sun Microsystems, Inc., 2550 Garcia Avenue, * Mountain View, California 94043. * --> <TITLE> Editing Project Attributes Popup Window Popup windows appear near the location from which they are activated. They are not contained in frames and thus cannot be resized or moved by the user. Popups are dismissed by clicking anywhere in the help viewer. Popup windows can be activated by clicking on a text object, graphic object, or JComponent button. All three examples are included in this demo. More... E.G. 2 For dynamically created HTML, the JRE will probably use the class file's location as the presumed location of the HTML. But to remove all doubt, we can specify the base element in the head. import javax.swing.*; class Html…

http://stackoverflow.com/comment/42229772
score: 2
has text: The file is named `Config.txt`, not `config.txt`. Sigh. Voting to close for "simple typographical error"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26831483

http://stackoverflow.com/a/26762536
type: Answer
answers question: http://stackoverflow.com/q/26762449
has body: It's because random.nextInt() return a value between -2,147,483,648 and 2,147,483,647 you should use the random.nextInt(int n) that return a value between 0 inclusive and n exclusive so replace int randomMove = new Random().nextInt(); b by int randomMove = 1 + new Random().nextInt(3); Also, you should assign new Random() to a field that would be reused.
score: 1
has comment: http://stackoverflow.com/comment/42106775
upvote count: 1
has comment: http://stackoverflow.com/comment/42106943
has comment: http://stackoverflow.com/comment/42106504
has comment: http://stackoverflow.com/comment/42107073
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42106735
has comment: http://stackoverflow.com/comment/42106679
accepted answer of: http://stackoverflow.com/q/26762449

http://stackoverflow.com/q/26689567
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26689680
has body: I’m new to JavaAnnotation so my question is when processing annotion like... void process(Object object) { ... } ie knowing the instance on witch we'll process annotation... How to process annotation such a way there is no need to call .process(ourInstance) ourself, after each instanciation? Thanks a lot!
downvote count: 0
score: 1
tagged with: java
tagged with: annotations
has title: How to process annotation on any Instance without express call
type: Question
upvote count: 1

http://stackoverflow.com/comment/42015128
type: Comment
comment on: http://stackoverflow.com/a/26711661
score: 0
type: AnswerComment
has text: I have tried something similar (linking two arrays virtually) but stuck at same place.I even wrote separate code for number greater than Integer.MAXValue.if(num>Integer.MAXValue){ two arrays linked solution} else {one array solution}

specifications
type: Tag
tag name: specifications
tags question: http://stackoverflow.com/q/26680604

http://stackoverflow.com/q/26700775
has title: How to use generics in spring?
has answer: http://stackoverflow.com/a/26701630
accepted answer: http://stackoverflow.com/a/26701630
tagged with: spring
has comment: http://stackoverflow.com/comment/41996078
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41996394
has comment: http://stackoverflow.com/comment/41996254
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41996209
upvote count: 1
possible better answer: http://stackoverflow.com/a/26700893
has answer: http://stackoverflow.com/a/26700893
favorite count: 0
score: 0
downvote count: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/41996382
has body: i have read lot of oline articles and couldnt find an answer and i have tried to make it correct and not able to do it. Can anyone help,how to initialize generics in bean file and make it work? Config File &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;bean id="collectionDemo" class="com.prashant.Collections6.CollectionDemo"&gt; &lt;constructor-arg index="0" type="String" value="google"/&gt; &lt;constructor-arg index="1" type="String" value="gooogle"/&gt; &lt;/bean&gt; &lt;/beans&gt; CollectionDemo.java public class CollectionDemo&lt;T&gt; { private T id,phoneNumber; public CollectionDemo(T id, T phoneNumber) { super(); this.id = id; this.phoneNumber = phoneNumber; } public T getId() { return id; } public void setId(T id) { this.id = id; } public T getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(T phoneNumber) { this.phoneNumber = phoneNumber; } @Override public String toString() { return "CollectionDemo [id=" + id + ", phoneNumber=" + phoneNumber + "]"; } } ColleactionApp.java package com.prashanth.Collections6; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; public class ColleactionApp { public static void main(String[] args) { ApplicationContext app=new FileSystemXmlApplicationContext ("/src/main/java/com/prashanth/Collections6/beans.xml"); CollectionDemo&lt;String&gt; coll=(CollectionDemo&lt;String&gt;) app.getBean("collectionDemo"); System.out.println(coll); } }

http://stackoverflow.com/comment/42200557
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26814475
has text: Running the code on Java 6 will prevent you from using APIs not defined in Java 6. For example, nothing in [`java.time`](http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) including [`LocalDate`](http://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html) will work in 6 or 7.
score: 0

http://stackoverflow.com/comment/61467345
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26777925
has text: I'd agree that failures are a subset of the use cases for exceptions, but are not the only subset. An alternative use might be something like an InterruptedException, where technically nothing has failed but a sudden change in program flow needs to be sent back up the stack. I do think in the context of the question the definition is helpful, but you are right that its too vague in a larger sense...
type: AnswerComment

http://stackoverflow.com/a/26759494
has body: The square-and-multiply method takes time O(log n): function power(b, e) if (e == 0) return 1 if (e is even) return power(b*b, e/2) /* e is odd */ return b * power(b, e-1)
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26758300
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26758300

http://stackoverflow.com/comment/42212295
has text: If you want to retain the older children then you must not overwrite their state. You could make the GraphColoringState immutable by making all variables final and replacing the gcolors array by a list. Make sure the list is also immutable by wrapping it into an unmodifiable list by calling Collections.unmodifiableList(..). This way it is impossible that you accidentally change the state of the previous child. But, the original error seems to be that you reuse the gcolors array for the copy and then modify this.
type: Comment
comment on: http://stackoverflow.com/a/26821233
score: 0
type: AnswerComment

http://stackoverflow.com/q/26674509
has answer: http://stackoverflow.com/a/26674570
score: 2
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/26674568
has body: I need to write a program to solve the eight queens problem and I have no idea how to do it, but I have already started with the multidimensional array. The thing is that I don't know how to call a constructor from the main class, just to check if the array was constructed properly, or how to call it from a method. Can anybody help, please? This is the code, it returns null. import javax.swing.JOptionPane; public class Eightqueens { private static int[][] board; public static void main(String[] args) { JOptionPane.showMessageDialog(null,board); } public Eightqueens (int size) { size = 8; board = new int[size][size]; int row; int col; for (row = 0; row &lt; size; row++) for (col = 0; col &lt; size; col++) board[row][col] = 0; } }
favorite count: 0
has answer: http://stackoverflow.com/a/26674571
has answer: http://stackoverflow.com/a/26674579
possible better answer: http://stackoverflow.com/a/26674561
accepted answer: http://stackoverflow.com/a/26674559
has answer: http://stackoverflow.com/a/26674786
has answer: http://stackoverflow.com/a/26674561
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: How to call a constructor from main method in java?
has comment: http://stackoverflow.com/comment/41948457
type: Question
has answer: http://stackoverflow.com/a/26674559

http://stackoverflow.com/comment/42053070
has text: I recommend using an IDE
comment on: http://stackoverflow.com/q/26732819
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26718995
tagged with: generics
has answer: http://stackoverflow.com/a/26720727
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42029262
type: Question
score: 1
tagged with: java
has title: How to make CDI decide the implementation to use according to generic type of the bean
upvote count: 1
has comment: http://stackoverflow.com/comment/42030929
has comment: http://stackoverflow.com/comment/42030914
answer count: 1
has body: This is, briefly, my architecture: What I want to achieve is to make CDI inject the correct implementation of the BO inside the Controller, and the right implementation of the DAO inside the BO accourding to the generic type of the Controller. How can I achieve that?
favorite count: 0
tagged with: cdi

http://stackoverflow.com/comment/42110052
comment on: http://stackoverflow.com/q/26764459
score: 0
type: Comment
has text: the bigdecimal constructor is not the problem, it is accurately conveying the double floating point value.
type: QuestionComment

http://stackoverflow.com/a/26821571
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26816813
has body: You have to figure out how much wrapper you need, you already know the diameter and height of the soup can. Since D=2*r, and C=2*pi*r, the area of the rectangular wrapper you need is (2*pi*r)(21/2).

m2e
type: Tag
tags question: http://stackoverflow.com/q/26699644
tag name: m2e

http://stackoverflow.com/comment/42035617
type: Comment
comment on: http://stackoverflow.com/a/26722706
type: AnswerComment
has text: Correct. Within the catch clause.
score: 0

http://stackoverflow.com/a/26690433
answers question: http://stackoverflow.com/q/26683898
score: 1
upvote count: 1
downvote count: 0
has body: Yes, you are correct that I meant getting the Socket from the accept() method. My problem was very simple. The client was doing a readLine() method call but the server was not sending the "\n" character.
type: Answer

http://stackoverflow.com/a/26689134
has comment: http://stackoverflow.com/comment/41975285
has body: If I understand your question correctly, if think if you are not using ORM you would have to do this manually. In your DAO class for Customer it would first have to persist all the products. An alternative might be to create a Stored Procedure on the database and have that sort out the correct persistence. This can be handled very nicely by Spring JDBC, the downside is you know have to manage Java and Stored Procedures. In your case it might still be two Stored Procedures. There is also the possibility that QueryDSL and Jooq, thought I haven't had a chance to have a good look at them. I personally like the Stored Procedure solution, for me the additional over head is worth it, I know others disagree, but I just don't like/buy the ORM deal.
has comment: http://stackoverflow.com/comment/41975329
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26688636

http://stackoverflow.com/a/26673150
downvote count: 0
has body: If I understood your problem correctly: System.out.println(pattern + " " + sdf.format(paidDate);
answers question: http://stackoverflow.com/q/26672976
type: Answer
has comment: http://stackoverflow.com/comment/41946806
upvote count: 3
has comment: http://stackoverflow.com/comment/41946832
score: 3
has comment: http://stackoverflow.com/comment/41947141

http://stackoverflow.com/comment/41951865
has text: What you mean? @NeilStockton
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26675483

http://stackoverflow.com/comment/42115104
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26755013
has text: I tried that using this version: http://support.apple.com/kb/dl1573 but I could not install (my Mac is a 10.9.5)
score: 0

http://stackoverflow.com/comment/42011847
comment on: http://stackoverflow.com/q/26710082
has text: might be because you do substring that start at place 1 instead of 0?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42182145
type: QuestionComment
comment on: http://stackoverflow.com/q/26804489
type: Comment
score: 0
has text: Have the size be a variable?

http://stackoverflow.com/comment/42235978
type: Comment
comment on: http://stackoverflow.com/a/26830757
score: 1
has text: @user263980 Then the question is, where is the image stored within your Jar? The answer provided is the correct approach
type: AnswerComment

http://stackoverflow.com/q/26795275
has comment: http://stackoverflow.com/comment/42169601
has comment: http://stackoverflow.com/comment/42174116
type: UnansweredQuestion
tagged with: macos
has comment: http://stackoverflow.com/comment/42401223
tagged with: apache-poi
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/xls
has comment: http://stackoverflow.com/comment/42171670
type: Question
has comment: http://stackoverflow.com/comment/42169147
tagged with: date
has body: Using apache poi library we are generating a report in xls format. The report column containing date is formatted as dd.MMM.yyyy in java code. This report displays the date cells fine on Windows machine with software MS Office 2013, 2010 &amp; Apache Open Office.The dates are also visible in Mac OS when viewed in Apache Open Office, Libre Office. But the default software of Mac for excel i.e. 'Numbers' fails to display the month part. The date is displayed as 01.MMM.2014 in Numbers. I googled about this issue but couldn't get much info. Can you please throw some light as part I might be missing? Or if you have faced this issue, what solution did you implement. Thanks, Hanumant
has title: MAC OS's Numbers cant read month of xls generated using Apache POI (3.10.1)
score: 0

http://stackoverflow.com/q/26711407
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26711850
has answer: http://stackoverflow.com/a/26711576
favorite count: 0
has title: What should be the optimal way of solving Recurrence relation for really Huge number greater than Integer maximum value
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26711661
has comment: http://stackoverflow.com/comment/42014726
tagged with: recurrence
has answer: http://stackoverflow.com/a/26711424
has comment: http://stackoverflow.com/comment/42018981
type: Question
has comment: http://stackoverflow.com/comment/42014500
tagged with: java
has comment: http://stackoverflow.com/comment/42016826
has body: I want to find the Nth number of the Recurrence Equation T(n)=T(n-1)+3T(n-2)+3T(n-3)+(n-4),T(1)=T(4)=1,T(2)=T(3)=3 so if suppose you entered 2,5,9 as input, output should be T(2)=3,T(5)=20,T(9)=695 what I did is create an array of size equal to maximum of all input value and storing solution of T(i) at index i.Then look up into the array for specific index. eg array[3] for T(3),array[5] for T(5),etc The code worked fine till maximum number is not greater than maximum integer value system can hold i.e Integer.MAXValue. Because the index of array can only be integer then if number is n=1855656959555656 what should be the best way to find the solution of T(1855656959555656)? as clearly I cant create an array of size=1855656959555656.. I have even tried BigInteger from java.Math but with no success. I have to find some other approach.please suggest some ideas.. Thanks
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/26711468
upvote count: 4
has answer: http://stackoverflow.com/a/26711587
has comment: http://stackoverflow.com/comment/42014275

http://stackoverflow.com/comment/42194279
score: 1
comment on: http://stackoverflow.com/q/26810859
has text: See [this thread](http://stackoverflow.com/questions/10834589/how-can-i-include-external-jar-on-my-netbeans-project) for a similar question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42038255
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26724224
has text: <> is mainly to do with "Template"ing your classes. This is very object-oriented and generic approach. This is also available in C++ the idea is that you keep your types flexible and the types get assigned during compile time. All the compiler needs to know is how the templates should be implemented i.e. the definitions of the template classes/functions.

http://stackoverflow.com/a/26821233
answers question: http://stackoverflow.com/q/26821189
has comment: http://stackoverflow.com/comment/42212295
has comment: http://stackoverflow.com/comment/42212976
score: 0
type: Answer
has body: gcolors is an array that you set as a value of the new child theClone.gcolors = this.gcolors; Then you modify gcolors in nextChild() child.gcolors[firstUncolored] = colors.get(currentColor++); To avoid such errors you could use an unmodifiable list instead.
has comment: http://stackoverflow.com/comment/42212104

http://stackoverflow.com/comment/42156907
type: AnswerComment
has text: But shouldn't the lastNode.nextNode always point to null? I mean in this case lastNode.nextNode points back to lastNode. This looks a little strange to me.
comment on: http://stackoverflow.com/a/26790402
type: Comment
score: 0

http://stackoverflow.com/comment/42155478
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26768038
has text: You would have to search for all `\uXXXX`, and recalculate `XXXX` to octal value (not greater than `\277` since it is max Java can handle). That is actually not that hard if we use `Integer.parseInt(strValue,radix)` and `Integer.toString(intValue,radix)`.
score: 0

http://stackoverflow.com/q/26822957
type: Question
has body: I'm building a Java Application that will connect to the Facebook and get some information. To connect to the Facebook API, Facebook asks for a code called "AccessToken", which you can get when the user connects to your application. My application is running 100% perfect when I already have the AccessToken, but I'm currently getting it externally. So, I read the Facebook docs and apparently the only way to get the AccessToken is using a Browser, even if it is a Desktop application (like my application). I certainly would not like to run an embbed browser in my application (My objective is to build the entire interface using only Swing components). So, my question is: In my case, is there a way to me to get this AccessToken without the need of a Browser? Or I REALLY need to embbed a webbrowser in my application or make the user open a browser and get it externally like I'm doing? Thank you!
tagged with: facebook-access-token
score: 0
has comment: http://stackoverflow.com/comment/42217207
has title: Getting a AccessToken via Java Swing (Facebook API)
answer count: 0
type: UnansweredQuestion
tagged with: facebook
has comment: http://stackoverflow.com/comment/42217125
has comment: http://stackoverflow.com/comment/42217093
tagged with: java
has comment: http://stackoverflow.com/comment/42217036

http://stackoverflow.com/a/26681242
has comment: http://stackoverflow.com/comment/42030849
has comment: http://stackoverflow.com/comment/42029007
type: Answer
has body: To force the browser to show the download dialog, set the content type to "application/octet-stream": response.setContentType("application/octet-stream"); If you set it to "application/pdf", some browsers will try to open the PDF inline or launch another application to view it. You may also want to set the content length so the browser can know the file size upfront, e.g.: response.setContentLength(pdfData.length()); Not sure if it matters, but looking at my code, it calls output.flush() instead of output.close() at the end. You may want to try that if it still doesn't work.
answers question: http://stackoverflow.com/q/26680217
score: 0
has comment: http://stackoverflow.com/comment/42027248
has comment: http://stackoverflow.com/comment/42029726

http://stackoverflow.com/comment/42290329
score: 0
has text: That I was not aware of. I think they are trying to phase it out and aren't doing a fabulous enough job :D
type: AnswerComment
comment on: http://stackoverflow.com/a/26812553
type: Comment

http://stackoverflow.com/comment/42052467
has text: Can you share your code? It is hard to tell you how to replace recursion/find your problem, when we don't see your code. Or your code is too long mayby?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26732679

http://stackoverflow.com/comment/41981964
score: 0
type: AnswerComment
has text: Only if you want to have as many files are there are students. I was thinking more about opening the file, and then calling each of your student objects' `save` method, passing the `Writer` or `Stream` object as a parameter.
type: Comment
comment on: http://stackoverflow.com/a/26693037

http://stackoverflow.com/a/26695779
upvote count: 4
has comment: http://stackoverflow.com/comment/41986716
downvote count: 0
has comment: http://stackoverflow.com/comment/41986764
type: Answer
has body: even though the method variable is definitely READ. Actually, it is definitely not "READ". If it was, then you would get different output. The computer is NOT wrong. The real issue here is that there is something about this that you do not understand. (There is a lesson there ... which you would be wise to learn.) There are two possible explanations for what you are seeing: There are "invisible" (aka "non-printing") characters in one of the strings you are trying to compare. By calling trim() you are removing leading and trailing whitespace, but there are other invisible characters that trim() doesn't remove (e.g. ASCII NUL characters). There are characters that look like other ones ... but aren't. Google for the search term "homoglyphs". Indeed, looking at the code where you put characters into a StringBuffer (which presumably then gives you the String that you are testing ...), it is pretty clear that the problem is the first one. You are creating a string from the entire character array ... not from the part of the array that you read characters into. This line is incorrect: arrInput.append(cbuf); 'cos you are ignoring the number of characters that were actually read.
has comment: http://stackoverflow.com/comment/41986965
score: 4
answers question: http://stackoverflow.com/q/26695687

http://stackoverflow.com/comment/42117809
comment on: http://stackoverflow.com/a/26768116
type: AnswerComment
type: Comment
has text: @Wranorn. You're right that the Oracle Java Tutorial doesn't mention & as a logical operator. However, the Java language is defined in the [Java specification](http://docs.oracle.com/javase/specs/jls/se8/html/index.html), and there (paragraph 15.22.2) & is defined as a logical operator (when the operands are boolean).
score: 1

http://stackoverflow.com/a/26709234
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26709184
upvote count: 7
accepted answer of: http://stackoverflow.com/q/26709184
score: 7
has body: You are misusing the PreparedStatement interface. When using PreparedStatements, you should prepare the statement with your query, bind all necessary parameters and then execute it without any SQL - this will cause the statement to execute the previously prepared SQL statement: String sql = "Select * from registration where id=?"; PreparedStatement pst = conn.prepareStatement(sql); pst.setString(1, "101"); rset = pst.executeQuery(); // Note - No args in the executeQuery call
type: AcceptedAnswer

http://stackoverflow.com/a/26674722
score: 0
has body: The data structure you need is called a Table. A table has two keys and an object, and looks, more or less, like an excel table with the two key sets as columns and rows. Hence the name. There are a variety of Table implementations. I think its normal to use the Guava implementations now. An explanation of guava's table interface is here. The API for guava's table is here, and the implementation that you want, the HashBasedTable, is here
type: Answer
answers question: http://stackoverflow.com/q/26673316

http://stackoverflow.com/a/26679184
type: Answer
answers question: http://stackoverflow.com/q/26679121
score: 0
has body: If you need to access elements from a collection that have a unique attribute, it is better to use a HashMap instead, with that attribute as key. Map&lt;Integer, Fruit&gt; fruits = new HashMap&lt;Integer, Fruit&gt;(); // ... Fruit f = fruits.remove(fruitID);

http://stackoverflow.com/a/26684497
upvote count: 5
answers question: http://stackoverflow.com/q/26684361
score: 5
downvote count: 0
has body: Maksim, you could use the @query annotation like this : public interface PlaylistRepository extends JpaRepository&lt;Playlist, Long&gt; { @Query("select playlist from Playlist playlist fetch join playlist.playlistItems itens fetch join itens.video as video where video.isDeleted = false") List&lt;Playlist&gt; findAll(); } Or even better way : public interface PlaylistRepository extends JpaRepository&lt;Playlist, Long&gt; { @Query("select playlist from Playlist playlist fetch join playlist.playlistItems itens fetch join itens.video as video where video.isDeleted = :hasVideo ") List&lt;Playlist&gt; findPlayList(@Param("hasVideo") boolean hasVideo); }
type: Answer

http://stackoverflow.com/q/26693850
tagged with: netbeans-plugins
accepted answer: http://stackoverflow.com/a/26780177
possible better answer: http://stackoverflow.com/a/26766388
upvote count: 4
answer count: 2
has body: I developed a simple plugin for NetBeans IDE. I have a little problem with default key event on TopComponenet of Wizard panel: For example: I have a wizard with 3 steps. In second step I have a JTextField where user put some values and after that appear a JList below this text field. Everything is okay until user choose a some value from list and than press key ENTER then my panel goes to next Step 3. I attach a key listener to list something like: list = new JList(new PackagesListModel()); list.addKeyListener(new KeyAdapter() { @Override public void keyReleased(java.awt.event.KeyEvent evt) { int keyCode = evt.getKeyCode(); if(keyCode == KeyEvent.VK_ENTER){ JList list = (JList)evt.getSource(); Object selectedPackage = list.getSelectedValue(); typePackageField.setText((String)selectedPackage); } } }); But this listener probably is invoking after default listener of TopComponenet on wizard. How can I prevent moving user to next step using ENTER key? I don't want this action (when user press ENTER then they go to the next step). UPDATE: Forwarding to Kraal answer: Problem is that i dont know where i can lookking for a JButton Next (to shuting down a listener). It sound strange but how i wrote. Im using a Netbeans Plaform WizzardDescriptor to generate a Wizzard (with 3 steps) . WizzardDescriptor is from package: org.openide.WizardDescriptor; // Dialogs API i puted to him a 3 instances of panels: WizardDescriptor.Panel from same package: org.openide.WizardDescriptor // Dialogs API it looks like: panels = new ArrayList&lt;&gt;(); panels.add(new LayoutWizardPanel1(selectedLayout)); panels.add(new LayoutWizardPanel2(selectedLayout)); panels.add(new LayoutWizardPanel3(selectedLayout)); WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator&lt;&gt;(panels)); After this will generated something like: in my program i have access to WizardDescriptor http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/org/openide/WizardDescriptor.html
downvote count: 0
has title: How to turn off a key listener in NetBeans wizard panels?
linked to: http://stackoverflow.com/q/9612020
favorite count: 0
tagged with: netbeans-platform
has answer: http://stackoverflow.com/a/26780177
type: AnsweredQuestion
tagged with: netbeans
score: 4
tagged with: java
tagged with: swing
linked to: http://stackoverflow.com/q/15290035
type: Question
has answer: http://stackoverflow.com/a/26766388

http://stackoverflow.com/q/26761714
has comment: http://stackoverflow.com/comment/42105159
has comment: http://stackoverflow.com/comment/42104997
tagged with: linked-list
has comment: http://stackoverflow.com/comment/42105151
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26763098
has answer: http://stackoverflow.com/a/26762572
type: Question
has comment: http://stackoverflow.com/comment/42105197
tagged with: java
answer count: 6
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/42105137
downvote count: 2
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/26762123
has title: Program to reverse a linked list in Java
has answer: http://stackoverflow.com/a/26777710
favorite count: 0
has answer: http://stackoverflow.com/a/74817398
has body: I have written the following code, in which method rev(list,list) is not working. Please help me determine what's wrong. import java.io.*; public class list { int d; list l; list() { d=0; l=null; } void create()throws IOException { int n;// store number of nodes BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the first data"); this.d=Integer.parseInt(br.readLine()); System.out.println("Enter number of nodes to be made"); n=Integer.parseInt(br.readLine()); list temp; list ptr=this; for(int i=1;i&lt;n;i++) { temp=new list(); System.out.println("Enter the next data"); temp.d=Integer.parseInt(br.readLine()); temp.l=null; ptr.l=temp; temp=null; ptr=ptr.l; } } void delete(list lst, int n) { list ptr=lst; list ptr1=ptr; int c=1; while(c&lt;n) { ptr1=ptr; ptr=ptr.l; c++; } ptr1.l=ptr.l; ptr.l=null; ptr=null; ptr1=null; } void insertmid(list lst,int x, int n) { list temp=new list(); temp.d=x; temp.l=null; list ptr=lst; int c=1; while(c&lt;n) { ptr=ptr.l; c++; } temp.l=ptr.l; ptr.l=temp; } void rev(list lst,list lst1) { lst1=null; list ptr=new list(); while(lst!=null) { ptr =lst; lst=lst.l; ptr.l=lst1; lst1=ptr; } } void display() { list ptr=this; while(ptr!=null) { System.out.print(ptr.d+"\t"); ptr=ptr.l; } System.out.println(); } public static void main(String args[])throws IOException { list l2=new list(); list l3=new list(); l2.create(); l2.display(); l2.insertmid(l2,14,2); l2.display(); l2.delete(l2, 3); l2.display(); l2.rev(l2,l3); l2.display(); } }
has answer: http://stackoverflow.com/a/26762227
has comment: http://stackoverflow.com/comment/42105237

http://stackoverflow.com/comment/42076756
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26741610
has text: I figured it out now, it works fine!! The solution was having Activity.this in the time picker listener. Thank you for all your help.
type: AnswerComment

http://stackoverflow.com/comment/42088784
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26743208
has text: I do not plan to use the enterprise edition. I'm trying to use the generic JDBC connector, but they say it will be deprecated in the next version. So I suppose having a bean is better option for the future, in case there will be no option to use the Generic JDBC connector later, am I right?
score: 0

http://stackoverflow.com/comment/41955950
score: 3
comment on: http://stackoverflow.com/a/26678106
type: AnswerComment
has text: @kaetzacoatl somewhere between the number of cpu cores and twice that, more and performance degrades needlessly. If you have tons of threads waiting around all day long use an async framework.
type: Comment

http://stackoverflow.com/q/26716771
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/42050002
favorite count: 0
has body: I got a very simple problem that I cant figure out. This is what i want to do : 6 * (1/(1*1) + 1/(2*2) + 1/(3*3) + … + 1/(N*N)) And this is my code attempt, that does not work. int eingabe = 5; double c = 0; for (int i = 1 ; i&lt;=eingabe ;i++) { c += 1/(i*i); } c *= 6; System.out.println(c); Please help me guys ! What do I have to do to make the code work?
upvote count: 2
tagged with: addition
accepted answer: http://stackoverflow.com/a/26716824
has comment: http://stackoverflow.com/comment/42023853
type: AnsweredQuestion
tagged with: numbers
has comment: http://stackoverflow.com/comment/42023997
tagged with: java
has answer: http://stackoverflow.com/a/26716848
linked to: http://stackoverflow.com/q/7220681
type: Question
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/26716848
score: -2
duplicate of: http://stackoverflow.com/q/7220681
has answer: http://stackoverflow.com/a/26716824
has title: Add up numbers in a for loop

http://stackoverflow.com/a/27703008
type: Answer
answers question: http://stackoverflow.com/q/26745364
upvote count: 1
has body: This supposedly works (originally from this blog entry): 1) Download and install Apple’s Java version 1.6. 2) Reconfigure your Java installation by using sudo R CMD javareconf -n. 3) Reinstall rJava from source with: install.packages('rJava', type='source'). Please acknowledge Will Lowe at conjugateprior.org for the original post and solution.
score: 1
downvote count: 0

http://stackoverflow.com/comment/100305464
has text: how do i wrap long itemName to multiple lines?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26804593
type: AnswerComment

epub
type: Tag
tags question: http://stackoverflow.com/q/26734907
tag name: epub

swing
tags question: http://stackoverflow.com/q/26818684
tags question: http://stackoverflow.com/q/26778689
tags question: http://stackoverflow.com/q/26814411
tags question: http://stackoverflow.com/q/26763938
tags question: http://stackoverflow.com/q/26825427
tags question: http://stackoverflow.com/q/26744372
tags question: http://stackoverflow.com/q/26786499
tags question: http://stackoverflow.com/q/26707124
tags question: http://stackoverflow.com/q/26720684
tags question: http://stackoverflow.com/q/26785916
tags question: http://stackoverflow.com/q/26807061
tags question: http://stackoverflow.com/q/26735488
tags question: http://stackoverflow.com/q/26732199
tags question: http://stackoverflow.com/q/26793568
tags question: http://stackoverflow.com/q/26823216
tags question: http://stackoverflow.com/q/26685326
tags question: http://stackoverflow.com/q/26808084
tags question: http://stackoverflow.com/q/26807468
tags question: http://stackoverflow.com/q/26810604
tags question: http://stackoverflow.com/q/26707838
tags question: http://stackoverflow.com/q/26764851
tags question: http://stackoverflow.com/q/26684750
tags question: http://stackoverflow.com/q/26766119
tags question: http://stackoverflow.com/q/26678649
tags question: http://stackoverflow.com/q/26815666
tags question: http://stackoverflow.com/q/26679417
tags question: http://stackoverflow.com/q/26808848
tags question: http://stackoverflow.com/q/26815953
tags question: http://stackoverflow.com/q/26796662
tags question: http://stackoverflow.com/q/26703060
tags question: http://stackoverflow.com/q/26810008
tags question: http://stackoverflow.com/q/26761765
tags question: http://stackoverflow.com/q/26743183
tags question: http://stackoverflow.com/q/26789848
tags question: http://stackoverflow.com/q/26701727
tags question: http://stackoverflow.com/q/26711140
tags question: http://stackoverflow.com/q/26794181
tags question: http://stackoverflow.com/q/26718736
tags question: http://stackoverflow.com/q/26755765
tags question: http://stackoverflow.com/q/26686735
tags question: http://stackoverflow.com/q/26730018
tags question: http://stackoverflow.com/q/26828438
tags question: http://stackoverflow.com/q/26781899
tags question: http://stackoverflow.com/q/26820102
tags question: http://stackoverflow.com/q/26793269
tags question: http://stackoverflow.com/q/26817633
tags question: http://stackoverflow.com/q/26806701
tags question: http://stackoverflow.com/q/26826211
tags question: http://stackoverflow.com/q/26753852
tags question: http://stackoverflow.com/q/26701424
tags question: http://stackoverflow.com/q/26704144
tags question: http://stackoverflow.com/q/26767555
tags question: http://stackoverflow.com/q/26744621
tags question: http://stackoverflow.com/q/26714155
tags question: http://stackoverflow.com/q/26789748
tags question: http://stackoverflow.com/q/26779189
tags question: http://stackoverflow.com/q/26795598
tags question: http://stackoverflow.com/q/26784502
tags question: http://stackoverflow.com/q/26747610
tags question: http://stackoverflow.com/q/26808368
tags question: http://stackoverflow.com/q/26782330
tags question: http://stackoverflow.com/q/26812022
tags question: http://stackoverflow.com/q/26749166
tags question: http://stackoverflow.com/q/26806160
tags question: http://stackoverflow.com/q/26831591
tags question: http://stackoverflow.com/q/26724913
tags question: http://stackoverflow.com/q/26675486
tags question: http://stackoverflow.com/q/26778769
tags question: http://stackoverflow.com/q/26693850
tags question: http://stackoverflow.com/q/26710315
type: Tag
tags question: http://stackoverflow.com/q/26767833
tags question: http://stackoverflow.com/q/26758072
tags question: http://stackoverflow.com/q/26709282
tags question: http://stackoverflow.com/q/26699930
tags question: http://stackoverflow.com/q/26694354
tags question: http://stackoverflow.com/q/26691469
tags question: http://stackoverflow.com/q/26822626
tags question: http://stackoverflow.com/q/26702624
tags question: http://stackoverflow.com/q/26740095

http://stackoverflow.com/q/26676244
has comment: http://stackoverflow.com/comment/41951622
has answer: http://stackoverflow.com/a/26676347
has comment: http://stackoverflow.com/comment/41951835
has comment: http://stackoverflow.com/comment/41951802
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26676388
tagged with: java
tagged with: nodes
type: Question
possible better answer: http://stackoverflow.com/a/26676319
has body: So im getting this ClassCastException when trying to cast my Node&lt;T&gt; to my AVLNode&lt;T&gt;. No idea why. Here is where it throws an exception. Node&lt;Integer&gt; n1 = new Node&lt;Integer&gt;(3, null); AVLNode&lt;Integer&gt; n2 = (AVLNode&lt;Integer&gt;) n1; How the classes look... public class Node&lt;T extends Comparable&lt;T&gt;&gt; { public Node&lt;T&gt; right; public Node&lt;T&gt; left; public Node&lt;T&gt; parent; public T data; public Node(T data, Node&lt;T&gt; parent) { this.data = data; this.parent = parent; } // ... And the other class in separate file: public class AVLNode&lt;T extends Comparable&lt;T&gt;&gt; extends Node&lt;T&gt; { public int height = 1; public AVLNode(T data, Node&lt;T&gt; parent) { super(data, parent); } //... Error message: Exception in thread "main" java.lang.ClassCastException: custom.trees.Node cannot be cast to custom.trees.AVLNode
score: 0
has title: Cast exception?
answer count: 3
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/26676319
accepted answer: http://stackoverflow.com/a/26676388
tagged with: classcastexception

http://stackoverflow.com/comment/41999155
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26701592
has text: Can you please re frame your question?
score: 0

http://stackoverflow.com/q/26823342
has body: So everything is working fine for this calculator besides for the askCalcChoice1. Since askCalcChoice1 is a string, I am calling it wrong (obviously). The error says it cannot convert string to int, as well as convert int to boolean. However, when i make the inputOperation as a string, it breaks the other 2 calls below askCalcChoice1. (it breaks displayRedults and askTwoValues because those are not strings). I do not know how to format askCalcChoice in order to call for this method that is written in another class wihtout breaking anything. askCalcChoice is written as a string which i pasted below the oopCalculator code. Is there any way and can someone please show me how to write that portion of that code in oopCalculator? int inputOperation; // user to choose the function askCalcChoice1 myAskCalcChoice1 = new askCalcChoice1(); //menu becomes a complete string below String menu = "Welcome to Hilda Wu's Calculator\t\t" + "\n1. Addition\n" + "2. Subtraction\n" + "3. Multiplication\n" + "4. Division\n" + "5. Exit\n\n"; calculatorCommands.pickNewSymbol(menu); //complete menu will be picked up as a string and display calculatorCommands.putDownSymbol(); while (inputOperation = myAskCalcChoice1.calcChoice()) { //this will call for myAskCalcChoice1 class calculatorCommands.pickNewSymbol("\n"); //pick up the class calculatorCommands.putDownSymbol(); //display the class askTwoValues myAskTwoValues = new askTwoValues(); float[] myFloats = myAskTwoValues.inputFloats(inputOperation); displayResults myDisplayResults = new displayResults(); float result = myDisplayResults.showResults(inputOperation, myFloats); String strFormat = "The answer is: " + result + "\n\n"; //print out The answer is as a string calculatorCommands.pickNewSymbol(strFormat); //pick up string from above calculatorCommands.putDownSymbol(); //display string calculatorCommands.pickNewSymbol(menu); // pick up menu from the beginning of code, loop to calculator menu calculatorCommands.putDownSymbol(); //display me…
favorite count: 0
has comment: http://stackoverflow.com/comment/42215813
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42215781
has title: Console Calculator error java
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/42215948
has comment: http://stackoverflow.com/comment/42215838
tagged with: java
has answer: http://stackoverflow.com/a/26823507
score: -4
has comment: http://stackoverflow.com/comment/42215790
has comment: http://stackoverflow.com/comment/42215821
type: Question
has comment: http://stackoverflow.com/comment/42215842
has comment: http://stackoverflow.com/comment/42215890
answer count: 1

http://stackoverflow.com/comment/42240775
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26830910
has text: Yes, I am. Please, take a look to the printscreen I just added. The first row is printed when I'd ran the application. The next ones, when the tab to changed using button next and prev.
type: QuestionComment

http://stackoverflow.com/comment/42205375
has text: Thanks for the tip; this is interesting. However, I don't have the time to contribute to another language at the moment. (looking into the java API right now).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26817013
type: Comment

http://stackoverflow.com/a/75436114
has body: Yield(): When a running thread is stopped to give its space to another thread with a high priority, this is called Yield.Here the running thread changes to runnable thread. Wait(): A thread is waiting to get resources from a thread to continue its execution.
answers question: http://stackoverflow.com/q/26798073
type: Answer
score: 0

http://stackoverflow.com/comment/42159327
has text: I will be writing a method later on to make sure that there are 4 distinct numbers. I'm not sure what I'm doing, I might just start from scratch. Thank you all for your time!
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26791315

http://stackoverflow.com/comment/42163200
score: 0
comment on: http://stackoverflow.com/q/26794181
type: Comment
type: QuestionComment
has text: Difficult to understand. Please post the relevant parts of your code and explain the exact problem you attempt to solve.

http://stackoverflow.com/comment/41965665
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26682255
has text: In defense of Goetz, those comments were published less than six months after the approval of JSR-133. It looks like they are directed at the pre-JSR-133 memory model, not the current one.

http://stackoverflow.com/comment/42083695
has text: `if(t <= 0 && t >= 3)` should be `if(t <= '0' && t >= '3')`, assuming "between 0 and 3" means "either 1 or 2".
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26749777

http://stackoverflow.com/q/26759670
upvote count: 1
has title: Selenium WebDriver throws NoSuchElementException even though the element exists (verified with Firebug/FirePath)
has comment: http://stackoverflow.com/comment/42141357
type: Question
has comment: http://stackoverflow.com/comment/42141023
tagged with: nosuchelementexception
has comment: http://stackoverflow.com/comment/42104391
downvote count: 0
has body: I use this code in Selenium WebDriver to extract the value of a certain element on a non-Ajax web page. public int getNumberOfPages(WebDriver driver) { try { webDriverBackedSelenium.click(linkLastPage); 1 webDriverBackedSelenium.waitForPageToLoad(normalTimeout); 2 new WebDriverWait(driver, normalTimeoutS).until(ExpectedConditions .presenceOfElementLocated(By.xpath(linkFirstPage))); 3 return Integer.parseInt(driver.findElement(By.xpath(pathToNumberOfPages)) .getText()); } catch (NumberFormatException e){ e.printStackTrace(); webDriverBackedSelenium.click(linkPreviousPage); webDriverBackedSelenium.waitForPageToLoad(normalTimeout); } catch (org.openqa.selenium.NoSuchElementException e){ e.printStackTrace(); } try { 4 return Integer.parseInt(driver.findElement(By.xpath(pathToNumberOfPages)) .getText()); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; } If I have a breakpoint at (1), open Firebug and insert the XPath the element is found but when I run this I get a NoSuchElementException at both 3 and 4 (if I set breakpoints there, again using FirePath, the element is found as expected). I tried different kinds if waits, e.g., 1 and 2 above, one at a time as well as both simultaneously, always with the same result. The timeouts are set to 30 seconds/30 000 milliseconds. I have read two similar questions webdriver findElement throws NoSuchElementException even though its inside try/catch Got NoSuchElementException even though this element exists but the answers there does not apply to my situation (since I have verified that the element is there with FirePath). The bl**dy element is there so why doesn't Selenium find it? XPath //tr[@class='rgPager']//a[@class='PagerItem'] [@title='Första'] HTML &lt;a title="Första" class="PagerItem" href="javascript:__doPostBack('ctl01$cphContent$Quickrank1$ctl00$ctl03$ctl01$ctl04','')" style="display:inline;"&gt;&amp;lt;&amp;lt;&lt;/a&gt;&amp;nbsp;&lt;a title="Föregående" class="Pag…
has comment: http://stackoverflow.com/comment/42180137
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42144389
linked to: http://stackoverflow.com/q/13606134
tagged with: xpath
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/42106792
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/42259855
score: 0
type: AnswerComment
has text: OK, I am just guessing now, but I think the special part about divergence actions is that once a thread has one, it no longer matters. It's in an infinite loop and will never emerge.
type: Comment
comment on: http://stackoverflow.com/a/26788346

http://stackoverflow.com/comment/42028484
type: QuestionComment
has text: post your manifest please.
type: Comment
comment on: http://stackoverflow.com/q/26718775
score: 0

cordova
tags question: http://stackoverflow.com/q/26711355
tags question: http://stackoverflow.com/q/26801562
tags question: http://stackoverflow.com/q/26731417
tag name: cordova
tags question: http://stackoverflow.com/q/26745387
tags question: http://stackoverflow.com/q/26725049
tags question: http://stackoverflow.com/q/26780108
type: Tag

http://stackoverflow.com/comment/42132680
comment on: http://stackoverflow.com/a/26777153
type: AnswerComment
score: 0
type: Comment
has text: I have less idea about transactions in spring. But can you please tell me, suppose two users have loaded same record on edit screen and both users updates some fields of the record with the gape of 5 sec. Then will `transaction stop/throw any exception` in such scenario?

http://stackoverflow.com/comment/42115466
comment on: http://stackoverflow.com/q/26766850
score: 0
type: Comment
type: QuestionComment
has text: dbConnection.commit(); makes no difference

http://stackoverflow.com/comment/42017502
comment on: http://stackoverflow.com/q/26713270
score: 2
has text: What are your intentions? The form is submitting on PayPal and you are trying to modify location when submit is clicked (**race condition**). Also changing the location would generate GET request, but your servlet is handling POST... so there are multiple issues with the code you presented.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26743656
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/10097246
has body: I'm having an issue when using the Hadoop Java API remotely to put a file to a HDFS 2.5.0 Single Node Hadoop Docker Container. When running on the Hadoop system I'm able to copy a local file to hdfs with no issue. However I'm having a problem remotely when attempting to put data to a file. I get the following exception: Exception in thread "main" org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /user/root/books/beowulf.txt could only be replicated to 0 nodes instead of minReplication (=1). There are 1 datanode(s) running and 1 node(s) are excluded in this operation. at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1471) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2791) at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:606) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:455) at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java) at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585) at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2013) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2009) 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:1614) at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2007) at org.apache.hadoop.ipc.Client.call(Client.java:1411) at org.apache.hadoop.ipc.Client.call(Client.java:1364) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206) at com.sun.proxy.$Proxy14.addBlock(Unknown Source) at sun.reflect.NativeMet…
has title: Hadoop 2.5.0 Failure to Write File Remotely
has answer: http://stackoverflow.com/a/26746622
has answer: http://stackoverflow.com/a/34806666
upvote count: 3
tagged with: java
answer count: 2
tagged with: hadoop
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42073421
downvote count: 0
tagged with: hdfs

http://stackoverflow.com/comment/42333619
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26848533
has text: See my answer http://stackoverflow.com/a/26889750/122441 ... It seems the `Jackson2HalModule` is somewhat coupled to the `MappingJackson2HttpMessageConverter` :(
score: 0

http://stackoverflow.com/comment/41985807
has text: Well, I already have all of that, I just figured it would be easier for people if they could just open a launcher that sets the project up for them opposed to them setting the project up themselves.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26695291

http://stackoverflow.com/a/26768116
has comment: http://stackoverflow.com/comment/42117084
has comment: http://stackoverflow.com/comment/42117809
has comment: http://stackoverflow.com/comment/42117026
score: -2
has comment: http://stackoverflow.com/comment/42117150
upvote count: 0
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26768046
has comment: http://stackoverflow.com/comment/42117281
has body: I believe you want &amp;&amp; versus &amp; One is a bitwise operation while other is logical.

http://stackoverflow.com/q/26741636
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 6
has comment: http://stackoverflow.com/comment/42069578
upvote count: 1
possible better answer: http://stackoverflow.com/a/26741851
has body: Suppose I create an int array of size N. Then I fill up the array with sorted numbers until index x, where 0 &lt;= x &lt; N-1. How can I find the index x? Here's one of the examples of the array: {0,1,2,3,4,0,0,0,0,0}, and here's how I generated the array: int[] arr = new int[10]; for (int i = 0; i &lt; 5; i++) { arr[i] = i; } Is there any Java syntax for this? I am specifically talking about Array not ArrayList. ====UPDATE==== Sorry for the confusion, the above array was just an example. Suppose the partially initialized array is given, such that we don't know how it was generated. Again, to be clear, the array can also be initialized as {0,0,0,1,2,6,7,0,0,0,0} where the last 0,0,0,0 part is the part from being uninitialized, whereas the first 0,0,0 is deliberately written by somebody else.
tagged with: arrays
has answer: http://stackoverflow.com/a/26741934
has comment: http://stackoverflow.com/comment/42069248
has comment: http://stackoverflow.com/comment/42069632
favorite count: 0
accepted answer: http://stackoverflow.com/a/26741860
has answer: http://stackoverflow.com/a/26741814
has answer: http://stackoverflow.com/a/26741725
has answer: http://stackoverflow.com/a/26741834
has answer: http://stackoverflow.com/a/26741860
downvote count: 0
has answer: http://stackoverflow.com/a/26741851
has title: Java: How to find index of last element of partially initialized sorted array
type: Question

file-io
tags question: http://stackoverflow.com/q/26725408
tags question: http://stackoverflow.com/q/26718921
tags question: http://stackoverflow.com/q/26691561
tags question: http://stackoverflow.com/q/26674079
tags question: http://stackoverflow.com/q/26815158
tags question: http://stackoverflow.com/q/26823076
type: Tag
tags question: http://stackoverflow.com/q/26828793
tags question: http://stackoverflow.com/q/26723322
tags question: http://stackoverflow.com/q/26751930
tags question: http://stackoverflow.com/q/26696253
tags question: http://stackoverflow.com/q/26705927
tags question: http://stackoverflow.com/q/26787278
tags question: http://stackoverflow.com/q/26761518
tags question: http://stackoverflow.com/q/26740725
tags question: http://stackoverflow.com/q/26751006
tags question: http://stackoverflow.com/q/26762034
tags question: http://stackoverflow.com/q/26826437
tags question: http://stackoverflow.com/q/26826249
tags question: http://stackoverflow.com/q/26727620
tag name: file-io
tags question: http://stackoverflow.com/q/26700540
tags question: http://stackoverflow.com/q/26695354
tags question: http://stackoverflow.com/q/26681867
tags question: http://stackoverflow.com/q/26805308
tags question: http://stackoverflow.com/q/26686566
tags question: http://stackoverflow.com/q/26808847
tags question: http://stackoverflow.com/q/26750946
tags question: http://stackoverflow.com/q/26807705

http://stackoverflow.com/comment/42176068
has text: @Bohemian actually, you are wrong, because spaces are allowed in classname. In css
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26801129

http://stackoverflow.com/q/26732388
has answer: http://stackoverflow.com/a/26734167
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26732759
has title: How to fix the layout in OnConfigurationChanged when i do not want the activity to restart
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/42052168
has comment: http://stackoverflow.com/comment/42052255
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42052412
has body: So i fixed my activity restart on changing orientation (i needed to do that for client requirement) but now i am having issues fixing the display layouts.I have tried a lot of combinations of layout_height and layout_weight but failed. I just need some guidance in how to fix this. My layout xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!-- /* Session screen layout Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ --&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/session_root_view" android:background="#F7FE2E" &gt; &lt;!-- childs are specified bottom-up so that we have a correct z-order in our final layout --&gt; &lt;android.inputmethodservice.KeyboardView android:id="@+id/extended_keyboard" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:visibility="gone" /&gt; &lt;com.freerdp.freerdpcore.presentation.ScrollView2D android:id="@+id/sessionScrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@id/extended_keyboard" android:scrollbars="horizontal|vertical" android:layout_alignParentTop="true" android:fillViewport="true" android:background="#FF0040" android:drawingCacheQuality="high" android:isScrollContainer="true" &gt; &lt;com.freerdp.freerdpcore.presentation.SessionView android:id="@+id/sessionView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:focusable="true" android:focusableInTouchMode="true" android:drawingCacheQuality="high" /&gt; &lt;/com.freerdp.freerdpcore.presentation.ScrollView2D&gt; &lt;com.freerdp.freerdpcore.presentation.TouchPointerView android:id="@+id/touchPo…
score: 0
has comment: http://stackoverflow.com/comment/42051942
tagged with: android

http://stackoverflow.com/comment/42049117
type: QuestionComment
has text: @SanKrish yes i am getting 404 error and the css folder is outside the web-inf
comment on: http://stackoverflow.com/q/26730663
score: 0
type: Comment

http://stackoverflow.com/comment/42180726
score: 0
comment on: http://stackoverflow.com/a/26782231
type: Comment
has text: @JustinPowell I haven't ironed out all the details yet. But I was reading [Troy Hunt's excellent article](http://www.troyhunt.com/2013/04/the-beginners-guide-to-breaking-website.html) about Pineapple devices and it demonstrates how readily a computer (and I presume also a phone) would connect to SSIDs it has stored. My app would probably introduce some MAC address checking as a first defence. Possibly more defences once I've given it more thought.
type: AnswerComment

http://stackoverflow.com/comment/42074419
type: QuestionComment
comment on: http://stackoverflow.com/q/26744228
score: 0
has text: no, the question is more related to the MVP pattern. It seems like in mvp I should just be telling the view to update some a widget with new data, but since in this case the widget needs an adapter, I am not sure if the adapter belongs in the view or the presenter. I am not sure it really matters, but it's gnawing at my brain
type: Comment

http://stackoverflow.com/q/26737981
tagged with: java
has comment: http://stackoverflow.com/comment/49133438
accepted answer: http://stackoverflow.com/a/30557591
answer count: 1
downvote count: 0
tagged with: interceptor
favorite count: 0
tagged with: filter
tagged with: spring
has title: How to Read httpservletresponse inside Spring interceptor?
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30557591
has body: I'm working on task that log api request and response in database. I need to autowire spring beans to access database and we can not autowire spring beans inside filter. Problem is we can read response multiple times only in filter using HttpServletResponseWrapper. Is there any way to read response multiple times in spring interceptor? Here is my code using Filter. It can retrieve all information but can't autowire beans in ApiActivityManager to insert data in database. If I read response in Interceptor once then in controller response is null. public class ApiActivityInterceptor implements Filter { ApiActivityManager apiActivityManager = new ApiActivityManager(); @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { MyRequestWrapper requestWrapper = new MyRequestWrapper((HttpServletRequest)request); MyResponseWrapper responseWrapper = new MyResponseWrapper((HttpServletResponse)response); InputStream inputStream = requestWrapper.getInputStream(); StringBuilder stringBuilder = new StringBuilder(); BufferedReader bufferedReader = null; if (inputStream != null) { bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); char[] charBuffer = new char[128]; int bytesRead = -1; while ((bytesRead = bufferedReader.read(charBuffer)) &gt; 0) { stringBuilder.append(charBuffer, 0, bytesRead); } } else { stringBuilder.append(""); } String requestText = stringBuilder.toString(); log.info(requestText); chain.doFilter((ServletRequest)requestWrapper,(ServletResponse)responseWrapper); String responseText = new String(responseWrapper.getCopy(),responseWrapper.getCharacterEncoding()); log.info(responseText); //for log details in database activityLogDetails.setActivityLog(requestText,responseText); } @Override public void destroy() { } } Thanks
has comment: http://stackoverflow.com/comment/49169365
upvote count: 1
has comment: http://stackoverflow.com/comment/42065283
type: Question
score: 1

http://stackoverflow.com/a/26801026
upvote count: 1
answers question: http://stackoverflow.com/q/26792533
has body: The simply answer is, cause you are using the wrong groupId. org.apache.tomcat.maven tomcat-maven-plugin 2.2
has comment: http://stackoverflow.com/comment/42189056
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26794226
tagged with: cdata
has comment: http://stackoverflow.com/comment/42163439
type: AnsweredQuestion
upvote count: 0
has body: I want to read XML file with multi level tags and CDATA by using Java. The sample XML is: <?xml version="1.0" encoding="UTF-8"?> INCEPTION 2010 8.8 Christopher Nolan Leonardo DiCaprio Joseph Gordon-Levitt Ellen Page The expected result is: Film Code = INCEPTION Film Name = INCEPTION 2010 IMDB = 8.8 Director = Christopher Nolan Actors = Leonardo DiCaprio, Joseph Gordon-Levitt, Joseph Gordon-Levitt Does anyone can guide me how to do? Many thanks.
has title: How to parse XML file with multi level tags and CDATA by using java?
type: Question
has answer: http://stackoverflow.com/a/26794756
accepted answer: http://stackoverflow.com/a/26794756
tagged with: java
score: -1
tagged with: xml-parsing
downvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26813095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42198375
has comment: http://stackoverflow.com/comment/42224845
has answer: http://stackoverflow.com/a/26815892
has title: Having an issue in determining which class to carry out method in java code for Blackjack game. Very basic, new to programming
score: 1
has comment: http://stackoverflow.com/comment/42219921
tagged with: java
has comment: http://stackoverflow.com/comment/42202642
tagged with: methods
has comment: http://stackoverflow.com/comment/42225127
type: Question
has body: I'm attempting to make a simple Blackjack game written in Java and consisting of a Blackjack (Tester), Card, Deck, Dealer, Player, and Game class. My code is still very much incomplete, but I'm having difficulty determining, once I've created a deck of cards, which class I should be dealing the cards in and how I should be storing the Card objects in both the player and the dealer's hand (arrayLists). For example, I thought I could solve the issue by using hand.add(deck.draw()); to the player class, thereby adding the Card drawn from my array cards to the arraylist hand. However, in order to do this I have to create a deck object in my player class, which is then different than the deck object that I create in my Game class. However, if I draw the card in the Game class using deck.draw(), I'm unsure of how to take that value and store it in the arraylist hand within my Player class. Hopefully this is making sense! Essentially, my question is if I use my deck.draw method in the Game class which returns a Card, how do I then take that Card and store it in my private arraylist hand in the Player class? Or is this the wrong approach entirely? Thank you for any guidance you can provide!!!
has answer: http://stackoverflow.com/a/26813677
tagged with: class
tagged with: arraylist
upvote count: 3
downvote count: 2
answer count: 3
tagged with: arrays
has comment: http://stackoverflow.com/comment/42198505
favorite count: 0
has answer: http://stackoverflow.com/a/26814144

http://stackoverflow.com/comment/42359528
comment on: http://stackoverflow.com/a/26853384
type: Comment
has text: Thanks, I have been wiping data since start and kindly check the UPDATE-2
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42205106
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26817224
has text: I am altering an app that I don't have access to the sources of.

http://stackoverflow.com/comment/45612160
comment on: http://stackoverflow.com/a/26809599
type: Comment
score: 0
type: AnswerComment
has text: Sooner rather than later, please. I really don't want that Hangouts link there.

text-size
tag name: text-size
type: Tag
tags question: http://stackoverflow.com/q/26702389

http://stackoverflow.com/comment/78540410
type: Comment
comment on: http://stackoverflow.com/a/26812963
score: 0
has text: @DBS Didn't try it, but should be the same
type: AnswerComment

http://stackoverflow.com/a/26811313
downvote count: 0
has comment: http://stackoverflow.com/comment/42195178
has comment: http://stackoverflow.com/comment/42307417
has comment: http://stackoverflow.com/comment/42291010
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42238803
upvote count: 2
has comment: http://stackoverflow.com/comment/42289270
has comment: http://stackoverflow.com/comment/42240684
has comment: http://stackoverflow.com/comment/42195336
has comment: http://stackoverflow.com/comment/42291121
answers question: http://stackoverflow.com/q/26811228
accepted answer of: http://stackoverflow.com/q/26811228
has comment: http://stackoverflow.com/comment/42240432
type: AcceptedAnswer
has body: In the SQLiteDatabase.query() method, set selection and selectionArgs parameters to null. see the following code for example: String[] projection = { COLUMN_NAME } Cursor cursor = mSQLiteDb.query(TABLE_NAME, projection, null, null, null, null, null); ArrayList&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;(); if (cursor != null &amp;&amp; cursor.getCount() != 0) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { values.add(cursor.getInt(cursor.getColumnIndex(COLUMN_NAME))); cursor.moveToNext(); } }

http://stackoverflow.com/a/26684332
accepted answer of: http://stackoverflow.com/q/26684292
has body: As long as you process your file line by line and you assemble some statistics, it doesn't really matter what tool you choose. Java has some advantage in terms of speed, compared to scripting languages, but in the end it will be a difference only by a constant factor. What matters the most is the algorithm that you use to process the file.
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26684292
type: AcceptedAnswer

http://stackoverflow.com/comment/42066326
comment on: http://stackoverflow.com/a/26739793
score: 0
type: AnswerComment
has text: That doesn't do it either since the JSPs are included into other JSPs. I need the actual filesystem path, not pull it out of the request URI.
type: Comment

http://stackoverflow.com/comment/42026455
type: AnswerComment
comment on: http://stackoverflow.com/a/26711120
has text: I've corrected my question, same thing i'm doing in my actual code but running into issues
type: Comment
score: 0

http://stackoverflow.com/comment/42070624
type: QuestionComment
has text: Can you find out the user's 1. kernel architecture (`uname -m`), 2. java architecture (`java -version`), and 3. any unmet linker dependencies for liblwjgl*.so (`ldd native/linux/liblwjgl*.so`)?
comment on: http://stackoverflow.com/q/26740055
score: 0
type: Comment

http://stackoverflow.com/comment/62406966
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26822127
has text: Did you get a solution to this, we are facing the same error
type: Comment

http://stackoverflow.com/a/26764715
has comment: http://stackoverflow.com/comment/42135319
has comment: http://stackoverflow.com/comment/42135038
has comment: http://stackoverflow.com/comment/42128112
has comment: http://stackoverflow.com/comment/42286385
upvote count: 21
has body: This answer assumes your tasks are short Is this kind of pattern better then creating new Threads in code? It's better, but it's still far from ideal. You are still creating threads for short tasks. Instead you just need to create a different type of thread pool - for example by Executors.newScheduledThreadPool(int corePoolSize). What's the difference in behaviour? A FixedThreadPool will always have a set of threads to use and if all threads are busy, a new task will be put into a queue. A (default) ScheduledThreadPool, as created by the Executors class, has a minimum thread pool that it keeps, even when idle. If all threads are busy when a new task comes in, it creates a new thread for it, and disposes of the thread 60 seconds after it is done, unless it's needed again. The second one can allow you to not create new threads by yourself. This behaviour can be achieved without the "Scheduled" part, but you will then have to construct the executor yourself. The constructor is public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) The various options allow you to fine-tune the behaviour. If some tasks are long... And I mean long. As in most of your application lifetime (Realtime 2-way connection? Server port? Multicast listener?). In that case, putting your Runnable in an executor is detrimental - standard executors are not designed to cope with it, and their performance will deteriorate. Think about your fixed thread pool - if you have 5 long-running tasks, then any new task will spawn a new thread, completely destroying any possible gains of the pool. If you use a more flexible executor - some threads will be shared, but not always. The rule of thumb is If it's a short task - use an executor. If it's a long task - make sure your executor can handle it (i.e. it either doesn't have a max pool size, or enough max threads to deal with 1 more thread being gone for a while) If it's a parallel p…
answers question: http://stackoverflow.com/q/26763835
has comment: http://stackoverflow.com/comment/42135930
score: 21
accepted answer of: http://stackoverflow.com/q/26763835
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42133523
type: Answer

http://stackoverflow.com/comment/42038742
comment on: http://stackoverflow.com/q/26724431
type: Comment
type: QuestionComment
score: 0
has text: i am very new to this, can you please further explain how to work the string into this? thanks

http://stackoverflow.com/a/26820555
score: 0
has body: You need to initialize err array before assigning any value. In dvdaction.java, initialize it as String err[]=new String[5]; and then set it's value otherwise it will throw java.lang.NullPointerException
type: Answer
has comment: http://stackoverflow.com/comment/42267077
answers question: http://stackoverflow.com/q/26820393
has comment: http://stackoverflow.com/comment/42210881

http://stackoverflow.com/q/26717105
has answer: http://stackoverflow.com/a/26717290
linked to: http://stackoverflow.com/q/8563294
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26717370
score: 0
tagged with: java
has title: Is there a way to choose a specific line from file and change strings or int, double in console?
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26717370
has comment: http://stackoverflow.com/comment/42024672
has body: I've trying to choose a specific line from file and I sort of got it, but I can't think of a way to change Strings or ints in console. For example there is a name and age: Tom 19 Jennifer 22 I choose line number 1 and I want to change something like, making Tom older, but i just can't figure it out, please help. Sorry for waisting your time if it's easy. Thank you. FileReader fr = null; LineNumberReader lnr = null; String str; int i; int currLine = 1; System.out.print("Which line to print?: "); Scanner scan = new Scanner(System.in); int d = scan.nextInt(); // create new reader fr = new FileReader("test.txt"); lnr = new LineNumberReader(fr); // read lines till the end of the stream while ((str = lnr.readLine()) != null) { if (currLine == d) { // if current line number is 4, print // prints string System.out.println(str); } currLine++; } // closes the stream and releases system resources if (fr != null) fr.close(); if (lnr != null) lnr.close(); }
possible better answer: http://stackoverflow.com/a/26717290

http://stackoverflow.com/comment/42031461
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26716474
has text: The error states clearly why. The file isn't there... If it is in your class path prefix with `classpath:`.
type: Comment

http://stackoverflow.com/a/26713376
downvote count: 0
answers question: http://stackoverflow.com/q/26712568
has body: why not use this logic. its pretty straight forward and you will not need any substitution or replacement.i assume that you will be able to convert this into code very easily into Java. i have not tested the regex but you get the basic idea. 1.use scanner(or any other way) to get the input ranges for the start and the end limit. 2.create a directory listing scanning every file in the directory. use a for loop here. 3.define a regular expression to fetch only the starting data for the file . start pattern = (^[0-9]{0,2})[a-zA-Z].+[0-9]{0,2}$ use grouping in regular expression to fetch this group1 4.When you get the values from group1 check the file name if it starts with group1 data. 5 if this data falls in between the ranges that you want to search then create a arraylist and store the matched file in the arraylist. 6.carry on the process till end of the directory. The final arraylist would contain your files in the given ranges. hope this helps
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26760055
answers question: http://stackoverflow.com/q/26747789
has body: I have a working solution. As ever it a combination of changes got me to the place I want to be. In rough order of importance I think they are: Only querying the state of a @Page once in any given test. The first test of Ajaxed content won. The subsequent ones found the wrong value. Making the assert call to test that the ajax element is what it ought to be from the test object rather than within the page object. The broken version is commented out in the code below as this was unexpected. Using @AjaxElement and then querying the content of those elements. One web page had a missing id tag on the element I was looking for (wouldn't have accounted for all the problems). Amongst other little changes along the way I am now testing heading h1 elements and list elements, rather than the div that contains them; and the different versions of the h1 have different id values. Haven't (yet) regression checked how significant this was. The test code is now: import org.fluentlenium.adapter.util.SharedDriver; import org.fluentlenium.core.annotation.Page; import static org.junit.Assert.assertTrue; import org.junit.Test; @SharedDriver(deleteCookies=true) public class UserControllerTest extends JSTest { @Page HomePage home; @Page LoginPage login; @Test public void test_cantLoginBeforeReg() { // try to login without being registered goTo(login); login.fillOutReg("test_cantLoginUntilReg"); login.chooseLogin(); isErrorResult(); goTo(home); home.isNotLoggedIn(); } @Test public void test_registerLogout() { goTo(login); login.fillOutReg("test_registerLogout"); login.chooseRegister(); isWelcomeResult(); login.chooseLogout(); home.isAt(); home.isNotLoggedIn(); } // tests etc public void isWelcomeResult() { assertTrue(login.getWelcomeText(), login.getWelcomeText().contains("Welcome")); } public void isErrorResult() { assertTrue(login.getErrorText(), login.getErrorText().contains("Failed")); } } And the page class: import org.fluentlenium.core.annotation.AjaxElement; import org.fluentlenium.…
type: Answer
score: 0

http://stackoverflow.com/a/26852552
answers question: http://stackoverflow.com/q/26720156
score: 1
has body: Creating a Sliding Drawer MainActivity.java: import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity { // Within which the entire activity is enclosed DrawerLayout mDrawerLayout; // ListView represents Navigation Drawer ListView mDrawerList; // ActionBarDrawerToggle indicates the presence of Navigation Drawer in the action bar ActionBarDrawerToggle mDrawerToggle; // Title of the action bar String mTitle=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = (String) getTitle(); // Getting reference to the DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.drawer_list); // Getting reference to the ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close){ /** Called when drawer is closed */ public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); } /** Called when a drawer is opened */ public void onDrawerOpened(View drawerView) { getActionBar().setTitle("Select a river"); invalidateOptionsMenu(); } }; // Setting DrawerToggle on DrawerLayout mDrawerLayout.setDrawerListener(mDrawerToggle); // Creating an ArrayAdapter to add items to the listview mDrawerList ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( getBaseContext(), R.layout.drawer_list_item , getResources().getStringArray(R.array.rivers) ); // …
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/26748946
answers question: http://stackoverflow.com/q/26748026
has body: Here is a short and sweet version :) private static boolean hasDistinctDigits(int number) { int numMask = 0; int numDigits = (int) Math.ceil(Math.log10(number+1)); for (int digitIdx = 0; digitIdx &lt; numDigits; digitIdx++) { int curDigit = (int)(number / Math.pow(10,digitIdx)) % 10; int digitMask = (int)Math.pow(2, curDigit); if ((numMask &amp; digitMask) &gt; 0) return false; numMask = numMask | digitMask; } return true; } It works in a pretty simply way. numMask is an integer used to store what digits have already been encountered (since a decimal system number has only 10 digits and an integer gives use 16-bits, we have enough bits to store each decimal digit as it occurs). We loop over all digits in the number. For each digit index, we get the actual digit in curDigit. Let's say the current digit is 5. We then check it the 5th bit is raised in out numMask: if it is, then we have already encounter a 5 in the past, so we can immediately tell that the number does not have all distinct digits and return false; otherwise, we modify numMask and raise the 5th bit. If we make it to the end, then no dupicate digits were encountered.
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/26748026

instantiation
type: Tag
tags question: http://stackoverflow.com/q/26749357
tag name: instantiation
tags question: http://stackoverflow.com/q/26734456

http://stackoverflow.com/a/26764455
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26764376
upvote count: 5
answers question: http://stackoverflow.com/q/26764376
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42109842
has body: No, you cannot. Xamarin allows you to consume native libraries via bindings, but you cannot consume Xamarin libraries from native code.

http://stackoverflow.com/a/26698835
has comment: http://stackoverflow.com/comment/41992273
type: Answer
has comment: http://stackoverflow.com/comment/41992081
has comment: http://stackoverflow.com/comment/41992350
has body: You can use ArrayList for it. It will help you really much and you should make your veriables private. private String first; private String last; private String number; private ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); for(String pointer : list){ } or you can make contact saver ArrayList private ArrayList&lt;Contact&gt; list = new ArrayList&lt;Contact&gt;(); public Contact(String first, String last, String number) { this.first=first; this.last = last; this.number=number; } public void add(String first, String last, String number){ c=new Contact(first,last,number); list.add(c); } and you can access all veriables like that list.get(i).first. You can save your contact class and contracts array in arraylist and it will give you more power to access. If you want to display your ArrayList, which index is not important, you need only ++i for it. I changed your class look this: public class PhoneBook { public static final int MAX = 10; public String name; String[] contracts = new String[MAX]; // i created an array of strings Contact c; private int count = 0;// saved last index of array public PhoneBook(String name) { this.name = name; } public String getName() { return name; } public void add(String first, String last, String number) { c = new Contact(first, last, number); contracts[count] = c.toString(); // save your String inside of last index++ count++; } public String first() { return get(1); } public String get(int i) { String s = contracts[i].toString(); return s; } public String toString() { for (int i = 0; i &lt; MAX; i++) { if (contracts[i] != null) System.out.println(contracts[i].toString()); } return ""; } public String find(String needle) { return null; } } public class Contact { public String first; public String last; public String number; public Contact(String first, String last, String number) { this.first = first; this.last = last; this.number = number; } @Override public String toString() { return "Contact [first=" + first + ", last=" +…
has comment: http://stackoverflow.com/comment/41992047
answers question: http://stackoverflow.com/q/26698627
has comment: http://stackoverflow.com/comment/41991947
score: 0
accepted answer of: http://stackoverflow.com/q/26698627
has comment: http://stackoverflow.com/comment/41991752
has comment: http://stackoverflow.com/comment/41992449
type: AcceptedAnswer

http://stackoverflow.com/comment/42041303
score: 0
type: AnswerComment
has text: I'm not sure what to do. Since url1 is a variable in another file
type: Comment
comment on: http://stackoverflow.com/a/26726104

http://stackoverflow.com/comment/41982878
score: 0
type: Comment
has text: No, not yet, but isn't it something you could start with? Probably text() is missing in the XPath.
type: AnswerComment
comment on: http://stackoverflow.com/a/26693179

http://stackoverflow.com/comment/41953051
comment on: http://stackoverflow.com/q/26676857
has text: or you can use event bus (Green Robot), need to register for the event in first Activity and get the call back in second Activity to update there.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26692418
tagged with: android-listview
tagged with: android-activity
possible better answer: http://stackoverflow.com/a/26692471
has answer: http://stackoverflow.com/a/26692601
tagged with: android
has body: I have problem, I want to display my activity segregate_waste_activity.xml in class SegregateWasteActivity.java <?xml version="1.0" encoding="utf-8"?> <EditText android:id="@+id/searchText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"/> <TextView android:id="@+id/TextView1" android:layout_width="fill_parent" android:layout_height="20dp" android:layout_weight="1" android:text="A"/> <ListView android:id="@+id/mainListView" android:layout_width="match_parent" android:layout_height="120dp" /> and I want to display data from classNames in my ListView with segregate_waste_activity.xml If I want to invoke to segregate_waste_activity I get error. public class SegregateWasteActivity extends ListActivity { /* protected EditText searchText; protected SQLiteDatabase db; protected Cursor cursor; protected ListAdapter adapter;*/ String classNames[] = {"Test"}; ListView myList; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,classNames)); } @Override protected void onListItemClick(ListView lv, View v, int position, long id){ super.onListItemClick(lv, v, position, id); String openClass = classNames[position]; try{ Class selected = Class.forName("com.odpad.odpadygdansk." + openClass); Intent selectedIntent = new Intent(this, selected); startActivity(selectedIntent); }catch(ClassNotFoundException e){ e.printStackTrace(); } } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); finish(); } }
type: AnsweredQuestion
tagged with: java
type: Question
has title: Display my activity and not the list itself Android
tagged with: android-layout
accepted answer: http://stackoverflow.com/a/26692601
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26692471

http://stackoverflow.com/comment/42110795
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26762623
has text: Following up on the conversation about how to set the name, I wouldn't consider the private fields to be a "problem." Assuming there are public or protected get/set methods, it would generally be preferable to use those (i.e. this.setName(name)) rather than directly modifying the fields. See some discussion about that here: http://stackoverflow.com/questions/2279662/java-protected-fields-vs-public-getters
score: 0

http://stackoverflow.com/a/26730467
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/26730388
has body: The MyService interface is annotated with @Service You must annotate the implementation of your interface. Not the interface itself.
answers question: http://stackoverflow.com/q/26730388
score: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26790373
score: 4
type: Answer
upvote count: 4
downvote count: 0
has body: It seems like the only purpose of this class is having a shortcut. Instead of doing Map&lt;String, Map&lt;String, Map&lt;String, Map&lt;String, Object&gt;&gt;&gt;&gt; myMap = new HashMap&lt;String, HashMap&lt;String, HashMap&lt;String, HashMap&lt;String, Object&gt;&gt;&gt;&gt;(); (which is bad to read) you could use MapHelper myHelper = new MapHelper(new MapHelper(new MapHelper(new MapHelper()))); since MapHelper will exactly limit the generic type attributes to be String and Object Finally imagine, you want to check if ANY element equals "1" while not knowing the depth - You could call a recursive method over and over again - or implement it once on the MapHelper. if (myHelper.contains("1"));
answers question: http://stackoverflow.com/q/26790248

http://stackoverflow.com/a/26755905
downvote count: 0
answers question: http://stackoverflow.com/q/26755820
type: Answer
score: 1
upvote count: 1
has body: You forgot the assignment: s = s.replace(" ", ""); EDIT: for the comments stating that == is not working. I wanted to say that it does work for Java 7

http://stackoverflow.com/comment/41949187
type: AnswerComment
comment on: http://stackoverflow.com/a/26674760
has text: This is no longer true in Java 8, where if too many elements go into the same bucket, it will switch to using a red-black tree.
type: Comment
score: 7

http://stackoverflow.com/comment/42137185
type: Comment
comment on: http://stackoverflow.com/a/26777352
score: 0
type: AnswerComment
has text: But in this case i would have to let Tomcat run the program, and i want it the other way arround, something like an embedded web server inside my application.

http://stackoverflow.com/comment/42140544
score: 0
type: AnswerComment
has text: That's wrong, there is a default access which is not private, protected or public. Actually is pretty close to the protected one.
type: Comment
comment on: http://stackoverflow.com/a/26781611

http://stackoverflow.com/q/26700542
has comment: http://stackoverflow.com/comment/41994713
has body: I'm pretty new in java and I'm doing a simple program but I don't know why I get different values, i.e., if I use getX, getY and getZ I get (6,5,8) but if I use toString I get different values for X and Y (3, 4, 8), so can anyone explain me why it happens because as far as I understand it should get the same values in both cases or what I'm doing wrong? public class Coordinates { private double coorX, coorY; Coordinates() { coorX = 1; coorY = 1; } Coordinates(double x, double y) { coorX = x; coorY = y; } void setX(double x) { coorX = x; } void setY(double y) { coorY = y; } double getX() { return coorX; } double getY() { return coorY; } public String toString() { String myString = "(" + coorX + " , " + coorY + ")"; return myString; } public class Coordinates3D extends Coordinates{ private double coorZ; Coordinates3D() { super(); coorZ = 1; } Coordinates3D(double x, double y, double z) { super(x,y); coorZ = z; } public void setZ(double z) { coorZ = z; } double getZ() { return coorZ; } @Override public String toString() { String myString = "(" + coorX + " , " + coorY + " , " + coorZ + ")" ; return myString; } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Coordinates test1 = new Coordinates(3,4); System.out.println(test1.toString()); System.out.println(test1.getX()); System.out.println(test1.getY()); Coordinates3D test2 = test1.new Coordinates3D(6,5,8); System.out.println(test2.toString()); ---&gt; here is the problem System.out.println(test2.getX()); System.out.println(test2.getY()); System.out.println(test2.getZ()); } }
has comment: http://stackoverflow.com/comment/41994665
has comment: http://stackoverflow.com/comment/41994662
has answer: http://stackoverflow.com/a/26700629
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26700605
has comment: http://stackoverflow.com/comment/41994679
possible better answer: http://stackoverflow.com/a/26700629
has comment: http://stackoverflow.com/comment/41994720
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26700605
has title: toString return different values
type: Question

http://stackoverflow.com/comment/41990300
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26697832
has text: @AndreSchoultz mark the answer for the sake of the others, if it is helpful.

http://stackoverflow.com/comment/42103081
has text: Did you try with Swedish locale?
comment on: http://stackoverflow.com/a/26756975
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42081637
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26725556
has text: Dici, I initialized pizza01 incorrectly, I fixed that and the program worked just fine. Thank you very much.
score: 0

http://stackoverflow.com/q/26720303
has body: I have next problem. I want to create page with title (at top of page) and menu (at center of page). There is my code: package org.crabar.views; import com.vaadin.annotations.Theme; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener; import com.vaadin.ui.*; import org.crabar.ViewController; /** * Created by Crabar on 01.11.2014. */ @Theme("mytheme") public class StartView extends VerticalLayout implements View { public StartView() { setSizeFull(); setMargin(true); createTitle(); createMenu(); } private void createMenu() { VerticalLayout menu = new VerticalLayout(); menu.setSpacing(true); menu.setWidth(150, Unit.PIXELS); menu.setHeightUndefined(); addComponent(menu); setComponentAlignment(menu, Alignment.MIDDLE_CENTER); Button startGameButton = new Button("Start game", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ViewController.getInstance().changeView(ViewController.GAME_VIEW); } }); startGameButton.setWidth(100, Unit.PERCENTAGE); menu.addComponent(startGameButton); Button achievementsButton = new Button("Achievements", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // } }); achievementsButton.setEnabled(false); achievementsButton.setDescription("The achievements will be soon..."); achievementsButton.setWidth(100, Unit.PERCENTAGE); menu.addComponent(achievementsButton); } private void createTitle() { Label label = new Label("Craberoid 2.0"); label.setStyleName("title-style"); addComponent(label); label.setWidth(null); label.setHeight(null); setComponentAlignment(label, Alignment.TOP_CENTER); } } All fine except menu's position at screen. It looks next: So it not in center of the screen but between center and bottom. I spent few hours but didn't find how to set the menu at center and the title at top.
upvote count: 1
accepted answer: http://stackoverflow.com/a/26721618
type: AnsweredQuestion
score: 1
tagged with: java
has title: Components positions in Layout with Vaadin
tagged with: vaadin
type: Question
has answer: http://stackoverflow.com/a/26721618
answer count: 1
downvote count: 0
favorite count: 0

date
tags question: http://stackoverflow.com/q/26748616
tags question: http://stackoverflow.com/q/26712834
tags question: http://stackoverflow.com/q/26686813
tag name: date
tags question: http://stackoverflow.com/q/26700997
tags question: http://stackoverflow.com/q/26708372
tags question: http://stackoverflow.com/q/26733738
tags question: http://stackoverflow.com/q/26798023
tags question: http://stackoverflow.com/q/26831978
tags question: http://stackoverflow.com/q/26795275
tags question: http://stackoverflow.com/q/26824020
tags question: http://stackoverflow.com/q/26761570
tags question: http://stackoverflow.com/q/26772836
tags question: http://stackoverflow.com/q/26728401
tags question: http://stackoverflow.com/q/26713909
tags question: http://stackoverflow.com/q/26732874
tags question: http://stackoverflow.com/q/26761130
tags question: http://stackoverflow.com/q/26830044
tags question: http://stackoverflow.com/q/26816181
tags question: http://stackoverflow.com/q/26782264
tags question: http://stackoverflow.com/q/26718422
tags question: http://stackoverflow.com/q/26691715
type: Tag
tags question: http://stackoverflow.com/q/26832267
tags question: http://stackoverflow.com/q/26778780
tags question: http://stackoverflow.com/q/26737026
tags question: http://stackoverflow.com/q/26760106
tags question: http://stackoverflow.com/q/26678030
tags question: http://stackoverflow.com/q/26786098
tags question: http://stackoverflow.com/q/26686583
tags question: http://stackoverflow.com/q/26674354
tags question: http://stackoverflow.com/q/26699413
tags question: http://stackoverflow.com/q/26762376
tags question: http://stackoverflow.com/q/26731065
tags question: http://stackoverflow.com/q/26754164

http://stackoverflow.com/comment/42133271
has text: @Selvin I'm kind of new to Android/Java, I'm reading about callbacks and I think I'll understand how to do it now I know what I was looking for. Thank you!
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26777368

http://stackoverflow.com/q/26771832
score: 0
tagged with: android
has body: I am able to detect the fling gesture of libgdx using the below snippet @Override public boolean fling(float velocityX, float velocityY, int button) { // TODO Auto-generated method stub Gdx.app.log(TAG, "velocity in X direction is : " + velocityX); // System.out.println("OSR"); return true; } However, how should I detect the point of first contact and the subsequent points during the fling action? I need this because I am applying the fling action on an image on the screen and would like it to move in the respective direction depending on the velocities.
answer count: 0
has comment: http://stackoverflow.com/comment/42132959
type: UnansweredQuestion
has title: libgdx fling point of contact detection
has comment: http://stackoverflow.com/comment/42164751
tagged with: libgdx
tagged with: java
type: Question

http://stackoverflow.com/q/26761583
tagged with: java
has answer: http://stackoverflow.com/a/26765988
accepted answer: http://stackoverflow.com/a/26765988
type: Question
has body: I'm trying to upload an excel file and read it. I can read the file when i give an absulute path, but doesn't want to work when I upload it. I've tried diffrent things but can't find a solution. I'm not using jsp and servlets, but html/controller/service html page &lt;h:form enctype="multipart/form-data"&gt; &lt;h:panelGrid&gt; &lt;h:outputLabel value="Upload file: " style="font-weight:bold" /&gt; &lt;h:inputFile value="#{uploadController.path}" /&gt; &lt;h:commandButton value="Excel lezen en opslaan" action="# {uploadController.excelOpslaan}"/&gt; &lt;/h:panelGrid&gt; &lt;/h:form&gt; Controller private String path; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public void excelOpslaan(){ PuntenService.getExcel(path); } Service public List&lt;String&gt; getExcel(String path); Service impl private List&lt;String&gt; list = new ArrayList&lt;String&gt;(); @Override public List&lt;String&gt; getExcel(String path){ FileInputStream file = null; OPCPackage pkg = null; try { file = new FileInputStream(path); // create a new OPC Package to obtain a workbook pkg = OPCPackage.open(file); //Create Workbook instance holding reference to .xlsx file XSSFWorkbook workbook = new XSSFWorkbook(pkg); //Get first/desired sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); //Iterate through each rows one by one Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through all the columns if (row.getRowNum() &lt;= 5) { continue;// skip to read the first 7 row of file } Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: list.add(cell.getStringCellValue()); break; } } //System.out.println(""); } file.close(); } catch (Exception e) { e.printStackTrace(); } return list; }
tagged with: upload
tagged with: controller
score: 0
answer count: 1
tagged with: path
tagged with: file
type: AnsweredQuestion
has title: get directory of uploaded file java

http://stackoverflow.com/q/26777941
has comment: http://stackoverflow.com/comment/42135435
tagged with: portlet
answer count: 1
has comment: http://stackoverflow.com/comment/42134328
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42134880
has comment: http://stackoverflow.com/comment/42136623
tagged with: liferay-6
has body: Does anybody know how to get the instance id in Liferay in a class without using the request object? exampleportlet_WAR_myportlet_INSTANCE_wI7pYPyS30be I need the wI7pYPyS30be part Thanks
tagged with: java
has title: How to get the instance id in Liferay
has answer: http://stackoverflow.com/a/26829407
type: Question
has comment: http://stackoverflow.com/comment/42134655
score: 0
tagged with: liferay

http://stackoverflow.com/q/26710151
answer count: 1
favorite count: 0
upvote count: 1
tagged with: valuestack
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2659952
score: 1
has answer: http://stackoverflow.com/a/26711592
tagged with: java
type: Question
has body: I am new to Spring MVC. In my project I print the java object values in JSP using JSTL. I assign the values in map object like below. Map&lt;String, Object&gt; result =HashMap&lt;String,Object&gt;(); In Struts2 I get the java object value from ValueStack and print them in JSP using Struts2 tag. My Questions are: Is there any ValueStack available in Spring MVC like it is in Struts2 ? If yes, which is its maximum capacity ? Which is the right language for displaying values to JSPin Spring MVC ?
downvote count: 0
tagged with: jsp
tagged with: struts2
accepted answer: http://stackoverflow.com/a/26711592
has title: Is there anything similar to Struts2's ValueStack in Spring MVC?

api
tags question: http://stackoverflow.com/q/26731276
tags question: http://stackoverflow.com/q/26698914
type: Tag
tags question: http://stackoverflow.com/q/26744985
tags question: http://stackoverflow.com/q/26798868
tags question: http://stackoverflow.com/q/26676405
tags question: http://stackoverflow.com/q/26706987
tag name: api
tags question: http://stackoverflow.com/q/26759454
tags question: http://stackoverflow.com/q/26758185
tags question: http://stackoverflow.com/q/26745355
tags question: http://stackoverflow.com/q/26706680

http://stackoverflow.com/comment/42076342
score: 1
has text: Why do you want to embed */ in comments?
comment on: http://stackoverflow.com/q/26745395
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26757099
has comment: http://stackoverflow.com/comment/42128010
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42255044
type: Question
has body: We are implementing a RestSerivce and we have an issue that Jersey handles JsonMappingException What we would like to do is wrapping all exceptions to a specific class RestError. But the problem is that the Jersey JsonMappingException won't be catched in the ExceptionMapper The RestError class @XmlRootElement(name = "error") @XmlAccessorType(XmlAccessType.FIELD) public class RestError { private int statusCode; private RestErrorCode errorCode; private String message; private List&lt;String&gt; fullStackTrace; } The ExeceptionMapper class @Provider @Priority(Priorities.USER) public class ThroawableExceptionMapper implements ExceptionMapper&lt;Throwable&gt; { @Override public Response toResponse(Throwable throwable) { //Wrapping to RestError won't catch JsonMappingException } } The stacktrace of the exception on server side says it's cause is a org.glassfish.jersey.server.internal.process.MappableException:
has answer: http://stackoverflow.com/a/26847108
tagged with: java
upvote count: 2
has title: Catch JsonMappingException in ExceptionMapper<Throwable>
tagged with: jersey
answer count: 1
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/48834162

swt
tags question: http://stackoverflow.com/q/26732227
tags question: http://stackoverflow.com/q/26801704
tags question: http://stackoverflow.com/q/26794777
tags question: http://stackoverflow.com/q/26685635
tags question: http://stackoverflow.com/q/26821099
tags question: http://stackoverflow.com/q/26758451
tags question: http://stackoverflow.com/q/26673121
tags question: http://stackoverflow.com/q/26733927
tags question: http://stackoverflow.com/q/26687513
tags question: http://stackoverflow.com/q/26682384
tags question: http://stackoverflow.com/q/26703000
tags question: http://stackoverflow.com/q/26680052
tags question: http://stackoverflow.com/q/26813672
tags question: http://stackoverflow.com/q/26743921
tags question: http://stackoverflow.com/q/26680241
tags question: http://stackoverflow.com/q/26731652
type: Tag
tags question: http://stackoverflow.com/q/26831211
tags question: http://stackoverflow.com/q/26709984
tags question: http://stackoverflow.com/q/26831407
tags question: http://stackoverflow.com/q/26735746
tags question: http://stackoverflow.com/q/26722107
tag name: swt
tags question: http://stackoverflow.com/q/26718046
tags question: http://stackoverflow.com/q/26789279
tags question: http://stackoverflow.com/q/26707515

http://stackoverflow.com/q/26802657
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26802720
has body: I inherited a Java-Application with many many hardcoded Strings that should have been localized. THe code-base is huge and I need an overview about all the used hardcoded String values in the code. Is there a tool (or an IDE-function; I use Eclipse and IntelliJ IDEA) that extracts all strings from Java-classes?
tagged with: java
type: Question
answer count: 2
has title: Find hardcoded Strings in legacy application
score: 0
possible better answer: http://stackoverflow.com/a/26802720
accepted answer: http://stackoverflow.com/a/26802835
duplicate of: http://stackoverflow.com/q/160382
has comment: http://stackoverflow.com/comment/42178669
linked to: http://stackoverflow.com/q/160382
has answer: http://stackoverflow.com/a/26802835
tagged with: internationalization

http://stackoverflow.com/comment/111142581
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/53946876
type: Comment
has text: Link is broken. This one seems to work: https://cwiki.apache.org/confluence/display/NUTCH/Nutch+1.X+RESTAPI .

http://stackoverflow.com/q/26698454
tagged with: javascript
has body: This is what I have in my Servlet. @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("Initializing..."); ExecutorService executorService = Executors.newFixedThreadPool(1); executorService.execute(new Runnable() { public void run() { System.out.println("Inside Thread!!!"); for(int i=1; i&lt;5; i++){ System.out.println("Date: " + new Date()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); executorService.shutdown(); // Some more piece of code is there } What I am doing here: I have created a separate thread where the date gets printed after 5 sec in the console. What I want to do: When I run this code, I get this output printed in the console: Initializing... Inside Thread!!! Date : Sat Nov 01 15:57:57 GMT 2014 Date : Sat Nov 01 15:58:02 GMT 2014 Date : Sat Nov 01 15:58:07 GMT 2014 Date : Sat Nov 01 15:58:12 GMT 2014 I want the same set of messages to be printed in a jsp page in such a way that the Date gets printed in an interval of 5 sec (by sending multiple response to the browser whenever a Syetem.out.println() method is executed int he above code). Reason for pushing message from server: In the above example, I am printing simple messages in a loop. But in real scenario, there are some calculations, hence the messages will be available at different time frames (i.e. not after every 5 sec, some messages will be available in quick time while the other messages might take some more time). Hence if I push from the server, then I can push the messages whenever it is available. Unable to understand: I am not sure how to send multiple response to the browser from a separate thread (i.e. from ExecutorService in the above code). I was looking into the setInterval method present in javascript but am not sue how to frame this code using it. I am free to use jQuery or javascript to get this work. Please advise.
tagged with: servlets
score: 0
answer count: 1
tagged with: jsp
tagged with: jquery
accepted answer: http://stackoverflow.com/a/26698493
has title: Displaying messages on regular intervals on browser
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26698493
tagged with: java

http://stackoverflow.com/comment/42209574
type: Comment
has text: You don't need (and shouldn't) escape `.` inside character class. `"[\\s,.:]+"` is enough.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26819587

http://stackoverflow.com/q/26791028
type: UnansweredQuestion
tagged with: android
tagged with: animation
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/26679801
has body: Really need some help on this... Please take a look to this simple FadeIn animation of an ImageView, using full java code. Recreate it using API's 21, 18, 17, 16.. works perfect. Now try it with API 19 (android 4.4.2), funny mask created (see explanation bellow): public class _ExampleAnimationNotWorking extends Activity { Common common; // my own class to read assets FrameLayout fl; ImageView iv; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.common = new Common(this,this); this.fl = new FrameLayout(this); this.iv = new ImageView(this); FrameLayout.LayoutParams flparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT); LayoutParams lparam = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); iv.setImageBitmap(common.newImage("iv_image.png", ImageFormat.RGB565).getBitmap()); iv.setX(50); iv.setY(0); fl.addView(iv, lparam); this.setContentView(fl, flparam); AlphaAnimation animation = new AlphaAnimation(0,1); animation.setDuration(3000); iv.setAnimation(animation); // may skip frames if not used in API19 (thats another problem) iv.startAnimation(animation); } .... During animation, Android 4.4.2 (API19) is creating a black mask outside the ImageView size boundary, starting at x/y coordinates (0 + imageWidth / 0 + imageHeight), so if you initially place the image outside that coordinate, you don’t see any animation, just the original image at the end of the animation.To recreate the issue, I have placed the image in x = 50 . You would see that the half right side of the image is black during Android 4.4.2 animation. You can recreate using emulator with any size of screen setup that you prefer. Changing "lparam" from WRAP_CONTENT to MATCH_PARENT or other width/height is not the solution. It should the same way that in other versions (Note i try it also in 4.4.3 and 4.4.4 and works perfect). This maybe a bug on 4.4.2 java code animation, because if …
has title: Android 4.4.2 creates a black mask outside view object boundary, only during full Java code animations
type: Question
has answer: http://stackoverflow.com/a/26812621
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/42157963
tagged with: android-4.4-kitkat
answer count: 1
favorite count: 0

security
tags question: http://stackoverflow.com/q/26795578
tags question: http://stackoverflow.com/q/26774525
tags question: http://stackoverflow.com/q/26716213
tags question: http://stackoverflow.com/q/26758932
tags question: http://stackoverflow.com/q/26687211
tags question: http://stackoverflow.com/q/26743331
tags question: http://stackoverflow.com/q/26678938
tags question: http://stackoverflow.com/q/26717796
tags question: http://stackoverflow.com/q/26781257
tags question: http://stackoverflow.com/q/26817596
tags question: http://stackoverflow.com/q/26718522
tags question: http://stackoverflow.com/q/26744883
tags question: http://stackoverflow.com/q/26800703
tags question: http://stackoverflow.com/q/26715954
tags question: http://stackoverflow.com/q/26778413
tags question: http://stackoverflow.com/q/26737284
tags question: http://stackoverflow.com/q/26790508
tags question: http://stackoverflow.com/q/26773709
type: Tag
tag name: security

http://stackoverflow.com/comment/42052018
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26730597
has text: Yes, but make sure it is not opened and used by another programm.

http://stackoverflow.com/a/26743892
has comment: http://stackoverflow.com/comment/42073847
has comment: http://stackoverflow.com/comment/42075195
has comment: http://stackoverflow.com/comment/42073496
answers question: http://stackoverflow.com/q/26743601
upvote count: 2
has comment: http://stackoverflow.com/comment/42075580
has comment: http://stackoverflow.com/comment/42074329
has comment: http://stackoverflow.com/comment/42073964
type: Answer
has body: It seems that for each row in your result set, you want to create a String tuple that represents the row. I'd make use of Android's Pair class. You could do something like: List&lt;Pair&lt;String, String&gt;&gt; data_list = new ArrayList&lt;Pair&lt;String, String&gt;&gt;(); Cursor c = db.getAllRecords(); if (c.moveToFirst()) { do { data_list.add(new Pair&lt;String, String&gt;(c.getString(0), c.getString(1))); //DisplayRecord(c); } while (c.moveToNext()); } And then define your ArrayAdapter like so (overriding getView to set your first and second TextView text correctly): ArrayAdapter&lt;Pair&lt;String, String&gt;&gt; aa = new ArrayAdapter&lt;Pair&lt;String, String&gt;&gt;(getApplicationContext(), R.layout.row, data_list) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); TextView tvItem1 = (TextView)v.findViewById(R.id.item1); TextView tvItem2 = (TextView)v.findViewById(R.id.item2); Pair&lt;String, String&gt; itemAtPosition = getItem(position); tvItem1.setText(itemAtPosition.first); tvItem2.setText(itemAtPosition.second); return v; } };
score: 2
downvote count: 0

http://stackoverflow.com/comment/41948936
score: 0
comment on: http://stackoverflow.com/q/26674747
type: QuestionComment
type: Comment
has text: I know there is no key, only records in my arraylist have field which is unique key ..

http://stackoverflow.com/q/26733946
downvote count: 0
possible better answer: http://stackoverflow.com/a/54332764
tagged with: tomcat
tagged with: build-process
has answer: http://stackoverflow.com/a/54332764
favorite count: 0
has answer: http://stackoverflow.com/a/26734332
upvote count: 11
type: AnsweredQuestion
tagged with: maven
score: 11
type: Question
has title: java.lang.VerifyError: Expecting a stackmap frame at branch target
tagged with: ant
tagged with: java
accepted answer: http://stackoverflow.com/a/26734332
answer count: 2
has body: Successfully compiled the project and build as well with Maven. This is my first maven project. But I have no idea why I'm getting the below error. Deployeed the war on tomcat and hit my url and the below error shown in my browser. java.lang.VerifyError: Expecting a stackmap frame at branch target 72 Exception Details: Location: com/ebetinc/frontend/presentation/components/Login.isToteAvailable(Ljava/lang/String;Lcom/ebetinc/frontend/dao/DatabaseDao;)Z @46: lookupswitch Reason: Expected stackmap frame at this location. Bytecode: 0000000: 043d 2bb9 03a4 0100 4e2a c601 1c13 03a6 0000010: 2ab8 03aa 9900 0803 3da7 010d 2db8 03ad 0000020: 9900 692a 3a04 0236 0519 04b6 03b1 ab00 0000030: 0000 003a 0000 0002 0000 0626 0000 002c 0000040: 0000 0644 0000 001a 0019 0413 03b3 b603 0000050: b599 0017 0336 05a7 0011 1904 1303 b7b6 0000060: 03b5 9900 0604 3605 1505 ab00 0000 001c 0000070: 0000 0002 0000 0000 0000 001a 0000 0001 0000080: 0000 001a 033d a700 a02d b803 ba99 0099 0000090: 2a3a 0402 3605 1904 b603 b1ab 0000 006a 00000a0: 0000 0004 0000 af34 0000 0029 0000 af4c 00000b0: 0000 003a 0000 af4d 0000 004b 0015 51cb 00000c0: 0000 005c 1904 1303 bcb6 03b5 9900 3903 00000d0: 3605 a700 3319 0413 03be b603 b599 0028 00000e0: 0436 05a7 0022 1904 1303 c0b6 03b5 9900 00000f0: 1705 3605 a700 1119 0413 03c2 b603 b599 0000100: 0006 0636 0515 05aa 0000 001f 0000 0000 0000110: 0000 0003 0000 001d 0000 001d 0000 001d 0000120: 0000 001d 033d 1cac Stackmap Table: append_frame(@28,Integer,Object[#931]) append_frame(@73,Object[#200],Integer) same_frame(@90) same_frame(@104) same_frame(@132) chop_frame(@134,2) same_frame(@137) append_frame(@196,Object[#200],Integer) same_frame(@213) same_frame(@230) same_frame(@247) same_frame(@261) same_frame(@292) chop_frame(@294,2) Can anyone throw some inputs ? Thanks for any help. Configuration: Java 1.7 Maven 3+

http://stackoverflow.com/q/26798282
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/42170645
has body: In production, at a location, Tomcat is running, port 8081. And when I deploy war at webapps there, I can run the application by visiting URL mysweeper.com:8081/myApp Now there another tomcat is running at 8080, location at machine is different. There, I want to deploy my war for some reason. It is running also. but when I run localhost:8080 there, it does not work. Is there any 'othername:8080'? How to know that or where to find that?
answer count: 1
has answer: http://stackoverflow.com/a/26798494
type: UnansweredQuestion
tagged with: dns
has title: Apache tomcat domain localhost or other :8080 ,how to find that?
tagged with: localhost
has comment: http://stackoverflow.com/comment/42170612
tagged with: java
has comment: http://stackoverflow.com/comment/42170647
type: Question

http://stackoverflow.com/comment/42128530
has text: @MadProgrammer (sorry could not understand NIC???) - some really and unique identifier, for unambiguous identification
score: 0
comment on: http://stackoverflow.com/q/26774587
type: Comment
type: QuestionComment

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/26675242
type: Tag
tags question: http://stackoverflow.com/q/26795236

http://stackoverflow.com/comment/41977169
type: Comment
type: QuestionComment
has text: Note that your output method of removing all characters that distinguish one byte from the other may not be easy to revert. Also note that you should indicate a mode of encryption and padding method together with the block cipher.
comment on: http://stackoverflow.com/q/26689123
score: 0

http://stackoverflow.com/comment/41987885
score: 0
comment on: http://stackoverflow.com/q/26696592
has text: Show some if your tries and let us know what has not worked.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26820110
score: 2
has comment: http://stackoverflow.com/comment/42210961
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42210287
downvote count: 0
has comment: http://stackoverflow.com/comment/42211022
has comment: http://stackoverflow.com/comment/42210476
accepted answer of: http://stackoverflow.com/q/26819914
upvote count: 2
has comment: http://stackoverflow.com/comment/42210033
type: Answer
answers question: http://stackoverflow.com/q/26819914
has comment: http://stackoverflow.com/comment/42210518
has comment: http://stackoverflow.com/comment/42209994
has comment: http://stackoverflow.com/comment/42209833
has comment: http://stackoverflow.com/comment/42210820
has comment: http://stackoverflow.com/comment/42210189
has body: Your issue is going to be found here (in a couple places): As you loop through, you will keep advancing current until you find two instances where the data is equal and then remove it. Your remove won't work because you're not actually removing the node you want, it's the next node you're removing, which won't necessarily be equal because you've already iterated over the list and lost the previous equal node. current = current.getNext(); if(current.getData().equals(temp.getData())) { if(found == true) { // remove element current.setNext(current.getNext().getNext()); // this isn't actually removing 'current'... listCount--; break; } else if(found == false) { found = true; } } First thing, you're not resetting found after not finding an equal node. After the if (equals) block, add: else { found = false; } Assuming you fix that, here's where you'd end up. Take the following example: [3] -&gt; [4] -&gt; [4] -&gt; [5] -&gt; [6] In your algorithm you will iterate over each element in this list like so: Pass 1: found = false [3] -&gt; [4] -&gt; [4] -&gt; [5] -&gt; [6] ^ current found = false Pass 2: found = false [3] -&gt; [4] -&gt; [4] -&gt; [5] -&gt; [6] ^ current found = true Pass 3: found = true [3] -&gt; [4] -&gt; [4] -&gt; [5] -&gt; [6] ^ current When you get here, you are setting current.next to current.next.next, which is effectively removing [5] from the list, not 4. (consequently, this is also causing your NPE... consider the effects when you get to the end of the list and there is no next.next) What you want to do is either find the index of your duplicate node and call your existing method to remove an element by the index, or keep a previous node to hold the value of the node that comes before current and when you remove, set previous.setNext(current.getNext()) which will effectively delete current. Second, you've made use of the equals method for Object, which uses the most discriminating method for determining equality, in that it will only return true for c…
has comment: http://stackoverflow.com/comment/42211006
has comment: http://stackoverflow.com/comment/42210365
has comment: http://stackoverflow.com/comment/42210470

http://stackoverflow.com/a/26951030
has comment: http://stackoverflow.com/comment/42443542
has comment: http://stackoverflow.com/comment/42443669
has comment: http://stackoverflow.com/comment/42443563
answers question: http://stackoverflow.com/q/26682013
score: 0
type: Answer
has body: Since you have only a list on your new scene, with no buttons, when the scene gains the focus, as the only focusable node is the list, its first item gets selected. Adding some OK/Cancel buttons may help since they can gain the focus instead, but for that they need to gain first the focus. Any of these two options will work: Put first the button, so its the first focusable node: listView.setItems(listChoices); Button button = new Button("Ok"); VBox rootPane = new VBox(10, button, listView); Stage newDialog = new Stage(StageStyle.UTILITY); newDialog.initModality(Modality.APPLICATION_MODAL); newDialog.setTitle("New"); Scene newDialogScene = new Scene(rootPane); newDialog.setScene(newDialogScene); newDialog.show(); Remove temporaly the focusable property of the list: listView.setItems(listChoices); listView.setFocusTraversable(false); Button button = new Button("Ok"); VBox rootPane = new VBox(10, listView, button); Stage newDialog = new Stage(StageStyle.UTILITY); newDialog.initModality(Modality.APPLICATION_MODAL); newDialog.setTitle("New"); Scene newDialogScene = new Scene(rootPane); newDialog.setScene(newDialogScene); newDialog.show(); listView.setFocusTraversable(true); In any case, both require an extra node. Anyway you will need it to close the modal stage, right? If you still want to go without buttons, you could use JDK 8u40 early versions where the problem has already been fixed, as @wzberger points out, or if this is not possible, use ControlsFX new Dialogs API (a fork of the API that will ship in JDK 8u40), and you won't have any problem. listView.setItems(listChoices); final Dialog dialog = new Dialog(); dialog.getDialogPane().setContent(listView); Optional&lt;ButtonType&gt; result = dialog.showAndWait();
has comment: http://stackoverflow.com/comment/42443628

http://stackoverflow.com/comment/42271396
type: AnswerComment
score: 0
type: Comment
has text: @Courtney Don't forget that `lengthA` is still `0` if you call `getLengthA()` the first time. Therefore you're calculating `Math.pow(x, 0)` which returns `1`. And `angleA = lengthA = lengthB + lengthC - (lengthB * lengthC);` doesn't look good, too. Are you sure, that you want to set `lengthA` to the same value as `angleA`?
comment on: http://stackoverflow.com/a/26819976

http://stackoverflow.com/q/26764532
has comment: http://stackoverflow.com/comment/42226245
linked to: http://stackoverflow.com/q/2712345
has answer: http://stackoverflow.com/a/61182905
has comment: http://stackoverflow.com/comment/64034811
tagged with: bean-validation
upvote count: 56
tagged with: jpa
has body: I have a spring boot project that has a CrudRepository, an Entity and a Controller. I am basically trying to persist an entity based on the data passed to the Controller. To do this, I am using spring-boot-starter-jpa. My Entity is annotated with JSR-303 annotations, which are checked in the controller before the data gets passed to the CrudRepository for persistence. Controller method: @RequestMapping(value = "users", method = { RequestMethod.POST }) public SuccessfulResponse&lt;User&gt; addUser(@Valid @RequestBody User user, BindingResult validation) { if (validation.hasErrors()) { throw new ValidationException(validation); } User saved = this.users.save(user); return new SuccessfulResponse&lt;User&gt;(saved); } Entity: @Entity /* JPA */ public class User { @Id /* JPA */ @Column(name="email_address", nullable=false, length=255) /* JPA */ @UserUnique private String emailAddress; } The cause of my issues is the UserUnique annotation. Its validator looks like this: public class UserUniqueValidator implements ConstraintValidator&lt;UserUnique, String&gt; { private UserRepository users; @Autowired public UserUniqueValidator(UserRepository users) { this.users = users; } @Override public void initialize(UserUnique annotation) {} @Override public boolean isValid(String value, ConstraintValidatorContext context) { return users.findOne(value) == null; } } What seems to be happening is, the validation is getting run twice. Once in the controller via the @Valid annotation, and once when Hibernate tries to persist the object. However, when Hibernate tries to persist the object, it throws: javax.validation.ValidationException: HV000064: Unable to instantiate ConstraintValidator: class test.UserUniqueValidator` This seems to be because its not spring-aware and cant inject the dependency into the constructor. So, what I want to do is disable Hibernate validation completely (as its redundant and already happening in the controller). There seems to be a property called javax.persis…
favorite count: 0
has comment: http://stackoverflow.com/comment/42191102
answer count: 5
has comment: http://stackoverflow.com/comment/42231685
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/65137817
possible better answer: http://stackoverflow.com/a/58486426
has answer: http://stackoverflow.com/a/26809261
downvote count: 0
accepted answer: http://stackoverflow.com/a/26809261
score: 56
tagged with: java
tagged with: hibernate
has title: How to disable Hibernate validation in a Spring Boot project
type: Question
has answer: http://stackoverflow.com/a/77962382
tagged with: spring-boot
has answer: http://stackoverflow.com/a/58486426
has comment: http://stackoverflow.com/comment/42126263

http://stackoverflow.com/a/26742393
downvote count: 0
has comment: http://stackoverflow.com/comment/42070654
has body: Try this : SUBSCRIPTION = SUBSCRIPTION.replaceAll("PRICING", String.valueOf(PRICE));
answers question: http://stackoverflow.com/q/26742241
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26742241
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/42070086
comment on: http://stackoverflow.com/a/26741694
type: AnswerComment
score: 0
has text: @RealSkeptic Oh yeah, my bad... Been a while since I touched java. Still, if you want event to be triggered when something happens to a Queue, you should probably extend the Queue instead of adding Runnables...
type: Comment

jruby
tags question: http://stackoverflow.com/q/26820052
type: Tag
tags question: http://stackoverflow.com/q/26758641
tag name: jruby
tags question: http://stackoverflow.com/q/26823040

http://stackoverflow.com/a/26795911
has comment: http://stackoverflow.com/comment/84310845
type: Answer
has comment: http://stackoverflow.com/comment/63619314
has comment: http://stackoverflow.com/comment/63599407
upvote count: 3
downvote count: 2
has body: About the if there is a Design Pattern to model the request objects and response objects the standard way, you can consider is Command design pattern. Since it allows you to encapsulate a command request as an object. And thereby letting you parameterize clients with different requests, queue or log requests, responses and support undoable operations etc. As sample implementation: abstract class Request{ public abstract void Execute(); public abstract void UnExecute(); } class AccountAndBookRequest extends Request{ Account account; List&lt;Book&gt; books; }
answers question: http://stackoverflow.com/q/26788608
has comment: http://stackoverflow.com/comment/84353049
score: 1

http://stackoverflow.com/comment/42223976
has text: Thank you,new knowledge for me
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26826715

http://stackoverflow.com/q/26806494
type: Question
tagged with: jakarta-ee
downvote count: 0
has body: I'm trying to develop a web-based user interface for a Google App Engine application. The Google App Engine application uses Google Modules. I've read from other users that GWT is a good choice for the user interface. I've also had experience with GWT from the Google Plugin for Eclipse. I suspect that a Google Module conforms to a J2EE convention of modules. I found a site that says there are 4 types of J2EE modules. QUESTION 1 What's the difference between a GWT Module and a Google Module? Is there ANY relationship? I suspect no. QUESTION 2 Is there any relationship between any of the 4 types of J2EE modules and GWT Module?
upvote count: 1
answer count: 1
has title: GWT modules are different from Google App Engine Modules, right?
favorite count: 0
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/26810006
tagged with: gwt
accepted answer: http://stackoverflow.com/a/26810006
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/11877299
tagged with: java

http://stackoverflow.com/a/26722695
accepted answer of: http://stackoverflow.com/q/26721835
score: 1
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26721835
type: Answer
upvote count: 1
has body: I've seen how to do this with a number variable, but I seem to be having some trouble with String variables It's exactly the same process but instead you use setString, as described in the JavaDocs and Using Prepared Statements public String getIngredientByName(@QueryParam("name") String theName) throws SQLException, ClassNotFoundException { //Obtaining an ingredient from the database String connectStr = "jdbc:mysql://localhost:3306/fooddb"; String username = "root"; String password = "csci330pass"; String driver = "com.mysql.jdbc.Driver"; Class.forName(driver); String result = ""; try (Connection con = DriverManager.getConnection(connectStr, username, password)) { try (PreparedStatement stmt = con.prepareStatement("SELECT id, name, category FROM ingredient WHERE name =?")) { stmt.setString(1, theName); try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { int theId3 = rs.getInt("id"); String theName3 = rs.getString("name"); String theCategory = rs.getString("category"); result += "id: " + theId3 + " , name: " + theName3 + "(" + theCategory + ")" + "\n" + "\n"; } } } } return result; }//END METHOD You're also not managing your resources, you need to make sure that once you have competed using the resources, that you close them, this would cause issues with the database if you're not careful Take a look at The try-with-resources Statement
has comment: http://stackoverflow.com/comment/42052950

http://stackoverflow.com/comment/42155842
type: QuestionComment
score: 1
has text: There are so many things wrong with this post.
comment on: http://stackoverflow.com/q/26789819
type: Comment

http://stackoverflow.com/comment/41980968
type: Comment
score: 0
type: AnswerComment
has text: Thanks, I did these. I think the problem is that Eclipse can't find my Main.java. In run configuration, what should I write in Main Class part? I use a package named ceng.ceng351.cpl.
comment on: http://stackoverflow.com/a/26692626

http://stackoverflow.com/a/26719615
answers question: http://stackoverflow.com/q/26719480
upvote count: 3
score: 3
has body: what laiello says is correct! String text = args[0]; String word = args[1]; and when executing the program you do: java Search "this is the sentence containing words" "words"
downvote count: 0
type: Answer

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/26736735
tags question: http://stackoverflow.com/q/26710315

http://stackoverflow.com/comment/42127892
type: AnswerComment
has text: yes , It's a mistake ; as you say , It can work now .
comment on: http://stackoverflow.com/a/26774039
type: Comment
score: 0

http://stackoverflow.com/q/26711267
has comment: http://stackoverflow.com/comment/42014259
has comment: http://stackoverflow.com/comment/42014324
tagged with: unit-testing
tagged with: dbunit
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26713088
type: Question
accepted answer: http://stackoverflow.com/a/26713088
score: 0
answer count: 1
has title: HSQL and DBUnit - The given schema 'SA' does not exist
tagged with: hsqldb
has body: I try to write some unit tests with DBUnit. I want to use the in-memory database HSQL. First in my Hibernate properties I use create to create the tables from my entities. Then I configure my datasource like this (file test-hibernate-config.xml): org.hsqldb.jdbcDriver jdbc:hsqldb:mem:test;sql.syntax_ora=true SA And then my test class look like this: @Override protected String[] getConfigLocations() { return new String[] {"batch-spring-daos.xml", "test-hibernate-config.xml", "batch-spring-transactionManager.xml"}; } public void setLivraisonDAO(ILivraisonDAO livraisonDAO) { this.livraisonDAO = livraisonDAO; } @Test(expected=IllegalArgumentException.class) @InsertDBUnitData(dataLocations={ "data/data_release" } ) public void shouldThrowIllegalArgumentExceptionWhenReleaseDoesntExists(){ livraisonDAO.getAllLivraisons("1"); } @Test @InsertDBUnitData(dataLocations={ "data/data_release", "data/data_livraison"} ) public void shouldRetrieveOneRelease(){ List<LivraisonEntity> allLivraisons = livraisonDAO.getAllLivraisons("2.5.0.0"); assertTrue(!allLivraisons.isEmpty()); } The file batch-spring-dao.xml and batch-spring-transactionManager.xml are those that I use in my application. But when I try to run my test, I got those logs: [2014-11-03 10:06:41,349] ERROR [main] org.hibernate.tool.hbm2ddl.SchemaExport.create:348 : Unsuccessful: alter table IMPACTPARAMDEFECT add constraint FK7327F18F2A1C61A foreign key (IDPARAMETRAGE) references PARAMETRAGE [2014-11-03 10:06:41,349] ERROR [main] org.hibernate.tool.hbm2ddl.SchemaExport.create:349 : a FOREIGN KEY constraint already exists on the set of columns: FK7327F18F2A1C61A in statement [alter table IMPACTPARAMDEFECT add constraint FK7327F18F2A1C61A foreign key (IDPARAMETRAGE) references PARAMETRAGE] [2014-11-03 10:06:41,349] ERROR [main] org.hibernate.tool.hbm2ddl.SchemaExport.create:348 : Unsuccessful: alter table IMPACTPARAMDEFECT add constraint FK7327F1848CCEB7F foreign key (IDPARAMETRAGE) references PARAMETRAGE [2014-11-03 10:06:41,…

http://stackoverflow.com/q/26715313
has answer: http://stackoverflow.com/a/26715412
favorite count: 0
tagged with: android
has body: Since I updated to the Android Support V7 revision 21 I get a NPE when calling setSupportProgressBarIndeterminateVisibility(). It seems that the progress inside an action bar is no longer supported this way. What is the best alternative or workaround for that?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26715412
type: Question
has answer: http://stackoverflow.com/a/26715532
accepted answer: http://stackoverflow.com/a/26715532
answer count: 2
upvote count: 1
has title: setSupportProgressBarIndeterminateVisibility throws NPE (Support V7 rev 21.0.1)

http://stackoverflow.com/comment/41991140
score: 2
comment on: http://stackoverflow.com/q/26698494
type: Comment
type: QuestionComment
has text: It is absurd to look for the complexity of a print function.

http://stackoverflow.com/q/26724013
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26724142
has answer: http://stackoverflow.com/a/26724123
score: 1
has title: Android - How to display keyboard input in TextView as it is typed
tagged with: java
has comment: http://stackoverflow.com/comment/42037661
downvote count: 1
type: Question
has body: In part of my android application I am trying to show the text I am typing as it is being typed WITHOUT a button/button listener. In other words I want to see the text in an EditText sent in real time to a TextView. Is this possible?
has answer: http://stackoverflow.com/a/65008865
answer count: 3
tagged with: user-interface
tagged with: textview
favorite count: 0

http://stackoverflow.com/comment/42010516
type: Comment
score: 0
has text: I figured it out - I made it an abstract class, so when you click on it it uses an abstract method that gets defined when the object is created
comment on: http://stackoverflow.com/q/26696126
type: QuestionComment

http://stackoverflow.com/a/26812693
downvote count: 0
has comment: http://stackoverflow.com/comment/42198349
has comment: http://stackoverflow.com/comment/42197852
has comment: http://stackoverflow.com/comment/42197996
type: Answer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26812096
has comment: http://stackoverflow.com/comment/42197928
has body: It will not be as fast as the one with limit(2) but you can use it as list.stream().filter(...).map(...).collect(singleOrEmpty()) static &lt;T&gt; Collector&lt;T, ?, Optional&lt;T&gt;&gt; singleOrEmpty() { return Collectors.collectingAndThen( Collectors.mapping( Optional::of, Collectors.reducing((a, b) -&gt; Optional.empty()) ), o -&gt; o.orElseGet(Optional::empty) ); } Stream.empty().collect(singleOrEmpty()); // Optional.empty Stream.of(1).collect(singleOrEmpty()); // Optional[1] Stream.of(1, 1).collect(singleOrEmpty()); // Optional.empty Stream.of(1, 1).skip(1).collect(singleOrEmpty()); // Optional[1] For what it's worth, unless this is really performance critical code, I would personally prefer the less clever but much clearer implementation static&lt;T&gt; Collector&lt;T,?,Optional&lt;T&gt;&gt; singleOrEmpty() { return Collectors.collectingAndThen( Collectors.toList(), lst -&gt; lst.size() == 1 ? Optional.of(lst.get(0)) : Optional.empty() ); }
answers question: http://stackoverflow.com/q/26812096
has comment: http://stackoverflow.com/comment/42198582
has comment: http://stackoverflow.com/comment/42205350
has comment: http://stackoverflow.com/comment/42205347
type: AcceptedAnswer

http://stackoverflow.com/q/26723972
type: Question
score: 3
upvote count: 3
tagged with: scala
answer count: 1
has answer: http://stackoverflow.com/a/26724017
has comment: http://stackoverflow.com/comment/42037464
tagged with: java
has title: Scala: 'val' without initializing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42037484
has body: In Java I can easily do something like this: final String str; if (p() == true) { str = "foo"; } else { str = "bar"; } How can I archive something like this in Scala? The 'obvious' is, of course, not possible: val str: String if (p) { str = "foo" } else { str = "bar" } Is there anything equivalent to the thing I can do in Java?
downvote count: 0
has comment: http://stackoverflow.com/comment/42037457
favorite count: 0
accepted answer: http://stackoverflow.com/a/26724017

http://stackoverflow.com/a/26755445
answers question: http://stackoverflow.com/q/26755269
score: 0
type: Answer
has body: JAXB is actually have several polymorphic mechanisms. You can use @XmlDescriminatorNode/@XmlDescrimintatorValue (Eclipse MOXy) or substitution groups. Here is some details and code examples: substitution groups, descriminators

http://stackoverflow.com/comment/41972322
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26685721
has text: should I use classes from java.sql.* instead of com.mysql.jdbc.* ?

http://stackoverflow.com/comment/42160472
comment on: http://stackoverflow.com/q/26792510
score: 0
type: Comment
type: QuestionComment
has text: that's perfectly okay, as soon it'll work on some basic level...but how can I get around it? :)

http://stackoverflow.com/comment/42029639
type: QuestionComment
comment on: http://stackoverflow.com/q/26719669
has text: @HotLicks c = "id" in json string.
score: 0
type: Comment

http://stackoverflow.com/a/26746249
has comment: http://stackoverflow.com/comment/42077764
has body: Use toCharArray(); - for example: char c[]= "0123".toCharArray(); this is exactly same to char c[]={'0','1','2','3'} ;
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26746231
answers question: http://stackoverflow.com/q/26746231
type: Answer
score: 4

http://stackoverflow.com/a/26725791
has body: How about this: labelData(); firstNames.forEach(this::reportData); Sometimes the simpler answer is better.
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26721890
downvote count: 0

http://stackoverflow.com/comment/41986365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26693470
score: 1
has text: MySQL wire protocol docs are [available](http://dev.mysql.com/doc/internals/en/client-server-protocol.html). Searching for "mysql java proxy" also turns this up: https://github.com/MPjct/JMPjct which you might want to take a look at.

http://stackoverflow.com/comment/42261357
type: AnswerComment
comment on: http://stackoverflow.com/a/26750918
has text: What would be the best way to migrate 100+ bundles from PDE to bndtools? I saw https://github.com/duckAsteroid/bndtools-pde-migration but it does not seem up-to-date.
type: Comment
score: 0

http://stackoverflow.com/comment/41998874
comment on: http://stackoverflow.com/q/26702747
score: 0
type: Comment
type: QuestionComment
has text: So? Just parse it as JSON then.

http://stackoverflow.com/comment/42115745
type: AnswerComment
has text: its a specific, what i am trying to do is get the data from the database and add it to the JTable List but at the moment every time i search for an item from a text field it gets added to the JTable. however when i try to add another item to the JTable list it replaces the old one and shows the new one. but i want both of the items to be listed to the JTable.
score: 0
comment on: http://stackoverflow.com/a/26767367
type: Comment

http://stackoverflow.com/q/26724001
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/42050847
tagged with: java
upvote count: 1
tagged with: gradle
type: Question
has title: Nexus has index of jar in Maven Central, but won't download it
has comment: http://stackoverflow.com/comment/42037855
downvote count: 0
has comment: http://stackoverflow.com/comment/42059660
favorite count: 0
has body: So I am setting up a Nexus instance and our build requires an apache jar, that is in the maven central repository. There is an index for it, however nexus will not download the jar, causing my gradle build to fail. I have tried expiring the caches and rebuilding the metadata numerous times. I have also tried restarting nexus. I even tried downloading the jar and uploading it to the releases, but to no avail. How can I resolve this issue/ is there a different direction I can go? EDIT: I should provide some backstory, I am creating a secondary CI system to test things out (Jenkins, nexus, gradle). The primary CI system works perfectly, and I am sure that the issue is that - for whatever reason- my secondary nexus has an index for a certain jar, but it is not on the local storage. And when my build system reaches out to nexus for this jar, it will not download it. When I turn discovery on for the Central repo, I get- Status: Unsuccessful. Message: Missing authtoken
tagged with: nexus
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42046130
tagged with: maven

http://stackoverflow.com/a/26742353
has comment: http://stackoverflow.com/comment/42070614
upvote count: 1
answers question: http://stackoverflow.com/q/26742241
has comment: http://stackoverflow.com/comment/42070583
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42070533
has body: PRICE need to be STRING not double. You can try this: String price = String.valueOf(PRICE) SUBSCRIPTION = SUBSCRIPTION.replaceAll("PRICING",price);

http://stackoverflow.com/q/26824029
score: 0
type: Question
has answer: http://stackoverflow.com/a/26824056
has body: // This code lets the computer select the first random number from your array int rn1 = boarduser[new Random().nextInt(boarduser.length)]; System.out.println("Computer's Value: " + rn1); // This code lets the computer select the second random number from your array int rn2 = boarduser[new Random().nextInt(boarduser.length)]; while (rn2 == rn1) // this code checks for another value in the array if the number generated was previously selected { rn2 = boarduser[new Random().nextInt(boarduser.length)]; } System.out.println("Computer's Value: " + rn2); // This code lets the computer select the third random number from your array int rn3 = boarduser[new Random().nextInt(boarduser.length)]; while (rn3 == rn1 || rn3 == rn2) { rn3 = boarduser[new Random().nextInt(boarduser.length)]; } System.out.println("Computer's Value: " + rn3); // turning the tokens chosen face down on the grid (changing their values to 0) { rn1 = 0; rn2 = 0; rn3 = 0; } Basically I'm trying to have rn1 = 0 set the random value generated from the array to 0, but when I print the array it seems the number still stays like it was. Any idea? Thanks
tagged with: java
has title: How to put an int back into an array in Java
possible better answer: http://stackoverflow.com/a/26824056
has answer: http://stackoverflow.com/a/26824055
tagged with: random
answer count: 2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26824055
type: AnsweredQuestion

http://stackoverflow.com/a/34881599
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26729799
score: 3
has comment: http://stackoverflow.com/comment/60281396
has body: We ran into this in this same error with data containing quotes in otherwise unquoted input. I.e.: some cell|this "cell" caused issues|other data It was hard to find, but in Apache's docs, they mention the withQuote() method which can take null as a value. We were getting the exact same error message and this (thankfully) ended up fixing the issue for us.

android-fragments
tags question: http://stackoverflow.com/q/26685231
tags question: http://stackoverflow.com/q/26740519
tags question: http://stackoverflow.com/q/26722825
tags question: http://stackoverflow.com/q/26716811
tags question: http://stackoverflow.com/q/26704981
tags question: http://stackoverflow.com/q/26687382
tags question: http://stackoverflow.com/q/26690028
type: Tag
tags question: http://stackoverflow.com/q/26825021
tags question: http://stackoverflow.com/q/26761090
tags question: http://stackoverflow.com/q/26753462
tags question: http://stackoverflow.com/q/26785843
tags question: http://stackoverflow.com/q/26772455
tags question: http://stackoverflow.com/q/26811325
tags question: http://stackoverflow.com/q/26739737
tags question: http://stackoverflow.com/q/26735084
tags question: http://stackoverflow.com/q/26779273
tags question: http://stackoverflow.com/q/26790102
tags question: http://stackoverflow.com/q/26794595
tags question: http://stackoverflow.com/q/26762917
tags question: http://stackoverflow.com/q/26769632
tags question: http://stackoverflow.com/q/26831550
tags question: http://stackoverflow.com/q/26701567
tags question: http://stackoverflow.com/q/26822516
tags question: http://stackoverflow.com/q/26728684
tags question: http://stackoverflow.com/q/26722555
tags question: http://stackoverflow.com/q/26822697
tags question: http://stackoverflow.com/q/26674973
tags question: http://stackoverflow.com/q/26787650
tags question: http://stackoverflow.com/q/26751168
tags question: http://stackoverflow.com/q/26702633
tag name: android-fragments
tags question: http://stackoverflow.com/q/26813744
tags question: http://stackoverflow.com/q/26747828
tags question: http://stackoverflow.com/q/26808231

http://stackoverflow.com/comment/42224583
type: Comment
has text: You need to copy the libs too.
comment on: http://stackoverflow.com/q/26823044
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42074409
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26738107
has text: @mmc18 had a quick look at the article. It basically underlines the difference between what it calls "object level locking" (which seems to include both object locking and instance locking) and class level locking. There are also other idioms unspoken of there, such as using an actual `java.util.concurrent.locks.Lock`, etc. It all depends on the context and what you want to achieve, really.

http://stackoverflow.com/q/26823283
type: AnsweredQuestion
has body: What is the best way convert a JPA entity to JSON that does not include the related objects but the database columns. Consider: public class Question implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) private Integer id; @Basic(optional = false) @NotNull @Size(min = 1, max = 255) @Column(name = "question_title") private String questionTitle; @Size(max = 500) @Column(name = "question_desc") private String questionDesc; @JoinColumn(name = "requires_question_id", referencedColumnName = "id") @ManyToOne private Question requiredQuestion; ... } Converting a Question directly to json may look like this: { "id": 1, "questionTitle": "Q1", "questionDesc": "A Question 123" "requiredQuestion": { "id": 2, "questionTitle": "Q2", "questionDesc": "A Question 456" } } However a more desirable result may look like this: { "id": 1, "question_title": "Q1", "question_desc": "A Question 123" "required_question_id": 2 } What is the best way to obtain the desirable result? Create a hashmap with String keys like "question_title", etc and manually assign the object properties, then convert the map to json?
tagged with: jpa
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26823603
favorite count: 0
has answer: http://stackoverflow.com/a/26824677
type: Question
has title: How to format JPA entity as JSON with database columns?
accepted answer: http://stackoverflow.com/a/26823603
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26824731
has answer: http://stackoverflow.com/a/26824731
tagged with: java

http://stackoverflow.com/comment/42028419
has text: yes @Thomas but some how its working correctly can you make a better code than this..?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26717260

http://stackoverflow.com/q/26822030
has comment: http://stackoverflow.com/comment/42213946
has comment: http://stackoverflow.com/comment/42213721
has answer: http://stackoverflow.com/a/26822451
tagged with: collections
has body: I have a doubly linked list in my case. And I want to find the max and min element. So I want to use the Collections to find it. Here is my code below for Node first: public class Node&lt;T&gt; { Node&lt;T&gt; prev; Node&lt;T&gt; next; T data; public Node(T _data) { data = _data; prev = null; next = null; } public Node(T _data, Node&lt;T&gt; _prev, Node&lt;T&gt; _next) { data = _data; prev = _prev; next = _next; } T getData() { return data; } public void setNext(Node&lt;T&gt; _next) { next = _next; } public void setPrev(Node&lt;T&gt; _prev) { prev = _prev; } public Node&lt;T&gt; getNext() { return next; } public Node&lt;T&gt; getPrev() { return prev; } } And here is my Doubly Linked List class: public class DoublyLinkedList&lt;T&gt; { private Node&lt;T&gt; head; private Node&lt;T&gt; tail; int listCount = 0; public void traverseF() { Node&lt;T&gt; temp = head; while(temp != null) { System.out.print(temp.getData() + " "); temp = temp.getNext(); } } public void traverseB() { Node&lt;T&gt; temp = tail; while(temp != null) { System.out.print(temp.getData() + " "); temp = temp.getPrev(); } } public void insertFirst(T data) { Node&lt;T&gt; temp = new Node&lt;T&gt;(data); if(head == null) { head = temp; tail = temp; temp.setNext(null); temp.setPrev(null); } else { temp.setNext(head); head.setPrev(temp); head = temp; } } } So, my main code is: import java.util.Collections; public class glavna { public static void main(String[] args) { DoublyLinkedList&lt;Integer&gt; DLL = new DoublyLinkedList&lt;Integer&gt;(); DLL.insertFirst(32); DLL.insertFirst(22); DLL.insertFirst(55); DLL.insertFirst(10); DLL.traverseF(); Integer max = Collections.max(DLL); } } How exactly do I call the Collections.max or Collections.min method? Isn't the list only necessary to find the max/min elements? public T getMin() { Node&lt;T&gt; temp = head; T min = head.getData(); while(temp.getNext() != null) { if(temp.getData() &lt; min) // error { //min = temp.getData(); } } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42213670
tagged with: java
has answer: http://stackoverflow.com/a/26822232
has comment: http://stackoverflow.com/comment/42213859
type: Question
tagged with: min
tagged with: max
accepted answer: http://stackoverflow.com/a/26822451
has comment: http://stackoverflow.com/comment/42213542
has comment: http://stackoverflow.com/comment/42213548
has comment: http://stackoverflow.com/comment/42214172
has answer: http://stackoverflow.com/a/26822066
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26822066
has comment: http://stackoverflow.com/comment/42213425
has comment: http://stackoverflow.com/comment/42214187
tagged with: linked-list
has title: How to find the max/min element of linked list
has comment: http://stackoverflow.com/comment/42213787

http://stackoverflow.com/comment/42156924
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26722300
type: QuestionComment
has text: @trashgod @ I uploaded three of the images to IMGUR and i have edited the post to include URL to the images, you can as well download them to your computer and link them as necessary. Hope i have understood you clearly.

http://stackoverflow.com/comment/42191920
comment on: http://stackoverflow.com/q/26809588
score: 0
has text: Factor out a function, like `boolean isPerfectNumber(int number)`. If you did so, the error you have won't be even possible.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26694743
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26694612
has body: Advice: your best bet would be to get a textbook on Java and OO programming. You aren't likely to learn this stuff properly by just trying to write programs. This applies to anyone else who is looking for answers to questions like this. Anyway, I was wondering if it's at all possible to access a variable declared in the main method (or class if that's easier) from a completely different class and if so how? A variable declared in the main method is a local variable, and it cannot be accessed from anywhere else1. A variable can be declared as in the class (say C) that contains the main method. An instance variable (aka a field) can be accessed from another class (modulo the visibility rules ... see below) provided you have created an instance of C. A static variable doesn't require an instance of C ... but the flipside is that the variable has only one instance. The visibility rules say whether or not another class is permitted to access a variable (or method). A private field is not visible at all. A public field is visible to every class. The protected and package private visibilities are between no visibility and full visibility. It is permitted to declare all of your fields as public so that everything can see and (typically) modify the state. However it is a bad idea, because it breaks down the "abstraction boundaries" that are need to main large-scale OO program understandable and maintainable. 1 - This is not strictly true. A method's local variables are potentially in-scope and visible to nested classes or lambdas that are declared within the method. However, said variables must be final or effectively final (depending on Java version). Besides, I doubt that this will be the right solution for a first-steps programmming exercise ...

http://stackoverflow.com/q/26716239
has comment: http://stackoverflow.com/comment/42023266
upvote count: 1
has comment: http://stackoverflow.com/comment/42022804
has comment: http://stackoverflow.com/comment/42022646
favorite count: 0
has comment: http://stackoverflow.com/comment/42023196
tagged with: double
possible better answer: http://stackoverflow.com/a/26716431
has body: While studying programming in Java lately, I found out that the double type can only return up to limited decimal places (of course I could code to return more, e.g. by typing %.20f, but it would just return 0 behind the certain decimal places). Is there no way to return more specific numbers in more decimal places? Here is an example code. public class DoubleCalculation { public static void main(String args[]) { int a = 1000; double b = 2.54643; System.out.printf("%.20f\n", a/b); } } and it would return 392.70665205797920000000.
has comment: http://stackoverflow.com/comment/42022683
has answer: http://stackoverflow.com/a/26716431
type: AnsweredQuestion
has title: How to return more specific double value in Java
has comment: http://stackoverflow.com/comment/42022795
accepted answer: http://stackoverflow.com/a/26716396
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26716396
score: -1
answer count: 2
downvote count: 2

http://stackoverflow.com/comment/41977123
type: AnswerComment
comment on: http://stackoverflow.com/a/26679563
has text: I use NetBeans (7.4 & 8.01) not Eclipse.
type: Comment
score: 0

http://stackoverflow.com/comment/42119740
type: QuestionComment
comment on: http://stackoverflow.com/q/26769641
score: 0
has text: Do you have more of that error message? Usually there is another stacktrace labelled "Caused by".
type: Comment

http://stackoverflow.com/q/26818959
has answer: http://stackoverflow.com/a/26849071
accepted answer: http://stackoverflow.com/a/26849071
tagged with: java
has answer: http://stackoverflow.com/a/26873242
tagged with: mysql
has comment: http://stackoverflow.com/comment/42208036
type: Question
has comment: http://stackoverflow.com/comment/42227444
has comment: http://stackoverflow.com/comment/42255409
has comment: http://stackoverflow.com/comment/42264808
has body: What I am trying to do is get the values from a column in my SQL table, specifically a column named SubjectName. Once I have these values I want to create JButtons named for each value in the ResultSet. My current code connects to my database and as far as I can tell the query to the table also works, however when I attempt to generate and add these buttons to my display the try/catch only returns that my statement failed. The code causing the problem lies somewhere here: try ( Statement initializeDisplay = connect.createStatement() ){ ArrayList&lt;String&gt; buttonList = new ArrayList&lt;String&gt;(); try { ResultSet rs = initializeDisplay.executeQuery("SELECT SubjectName from subjectpacktable order by SubjectID"); buttonList = new ArrayList&lt;String&gt;(); while(rs.next()) { buttonList.add(rs.getString(1)); } ArrayList&lt;JButton&gt; listOfButtons = new ArrayList&lt;JButton&gt;(); for (int i=0; i &lt; 10; i++) { String temp2 = rs.getString(l); JButton button1 = new JButton(temp2); listOfButtons.add(button1); l++; } l = 0; while(listOfButtons.get(l) != null) { JButton tempButton = listOfButtons.get(l); AddCardPanel1.add(tempButton); l++; } while(buttonList.get(l) != null) { System.out.println(buttonList.get(l)); l++; } l = 0; } catch(SQLException e1) { System.err.println("Initial Display Failed"); }} catch (SQLException e2) { System.err.println("Initial Display Failed"); } I'm wondering if the problem lies in actually retrieving the values from the table or somewhere else in the code are values not being assigned properly. Any help is appreciated.
answer count: 2
possible better answer: http://stackoverflow.com/a/26873242
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42207743
upvote count: 2
has title: Creating a Panel of JButtons with values from a SQL table;
has comment: http://stackoverflow.com/comment/42235336
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26776407
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42137932
answers question: http://stackoverflow.com/q/26770537
type: Answer
has body: This is basically a comment to Christopher Schultz's answer, but since it involves some code snippets please excuse my putting it here It's unfortunate that httpclient doesn't have a simple API like "here's the path to my keystore file, now use it" or "here are the bytes for my keystore, use those" (if you wanted to load the keystore from the ClassLoader or whatever), but that seems to be the case This is how one can configure Apache HttpClient 4.3 to use a specific trust store for SSL context initialization. SSLContext sslContext = SSLContexts.custom() .loadTrustMaterial(trustStore) .build(); CloseableHttpClient client = HttpClients.custom() .setSslcontext(sslContext) .build(); One can load trust material from a resource like that URL resource = getClass().getResource("/com/mycompany/mystuff/my.truststore"); KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream inputStream = resource.openStream(); try { trustStore.load(inputStream, null /*usually not password protected*/); } finally { inputStream.close(); }
score: 1

http://stackoverflow.com/a/26727877
type: Answer
answers question: http://stackoverflow.com/q/26725011
score: 2
downvote count: 0
upvote count: 2
has body: You need to set the hibernate.hbm2ddl.auto property with value create. If so, when you run the applications first time, the tables will be created.

http://stackoverflow.com/q/26787863
has answer: http://stackoverflow.com/a/26787986
type: UnansweredQuestion
has title: How I Loop/Repeat the program base on the value of user input?
has body: Example i have the simple program as below: Scanner guess = new Scanner(System.in); Scanner play = new Scanner(System.in); int count =0; int sum=0; int num, N; int ply, T; System.out.println("How many times will you play?"); T = play.nextInt(); System.out.println("How many numbers will you enter?"); N = guess.nextInt(); for(count =0; count &lt; N; count++) { System.out.println("Enter a number"); num = guess.nextInt(); sum +=num; } System.out.println("The sum of the numbers entered is:"+sum); how do i repeat/loop the program start from "enter a number", base on the "how many times will you play?" that means the program will repeat base on the value user input before. example, user input want play 5 times then the program will repeat/loop 5 times start from enter a number. pls... help me... thanks guy.. u guy are genius.!
type: Question
tagged with: java
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26787946

http://stackoverflow.com/comment/42076938
comment on: http://stackoverflow.com/q/26744524
has text: I updated to 8 but still have the same problem....
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26739313
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26740090
favorite count: 0
linked to: http://stackoverflow.com/q/11965929
has comment: http://stackoverflow.com/comment/42064568
has comment: http://stackoverflow.com/comment/42064466
type: UnansweredQuestion
has body: I just started to learn Java and i think this a very basic question but i didn't find the right answer yet so i try in here. I just want to show in my console the names and descriptions of some animals, but i don't know how to manipulate variables from a class of a class. I guess i have to use parameters but i don't find how to use them in a class... My "Animal.java" public class Animal { private String nom; public static String DESCRIPTION; public String toString(){ return "Je suis " + this.nom; } public void direNom(){ System.out.println(toString()); } public void direDESCRIPTION(){ System.out.println("Description: " + this.DESCRIPTION); } public String getNom(){ return nom; } public void setNom(String nom){ this.nom = nom; } class Vertebre{ int nbrVertebre; class Mammifere{ class Ours{ String nom = "Poumba"; String DESCRIPTION = "Description de Poumba"; } class Chimpanze{ String nom = "Cheeta"; String DESCRIPTION = "Description de Cheeta"; } class Rats{ String nom = "Ratata"; String DESCRIPTION = "Description de Ratata"; } } class Poisson{ class Requins{ String nom = "Jaws"; String DESCRIPTION = "Description de Jaws"; } class Raies{ String nom = "Raimonta"; String DESCRIPTION = "Description de Raimonta"; } class Truites{ String nom = "Truita"; String DESCRIPTION = "Description de Truita"; } } class Reptile{ class Tortue{ String nom = "Tortega"; String DESCRIPTION = "Description de Tortega"; } class Serpent{ String nom = "Serpento"; String DESCRIPTION = "Description de Serpento"; } } } } My "TestZoo.java" public class TestZoo { public static void main(String[] args){ Animal unAnimal = new Animal(); unAnimal.setNom("Jaws"); unAnimal.direNom(); unAnimal.direDESCRIPTION(); unAnimal.setNom("Cheeta"); unAnimal.direNom(); unAnimal.direDESCRIPTION(); unAnimal.setNom("Ham"); unAnimal.direNom(); unAnimal.direDESCRIPTION(); } }
downvote count: 1
has title: How to manipulate variables in deep class
type: Question
tagged with: parameters
tagged with: nested-class
has comment: http://stackoverflow.com/comment/42064450
tagged with: java
score: -1
tagged with: class

http://stackoverflow.com/comment/42019758
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26714361
has text: @chrylis if CPU of Java higher than 100%, openfire server not works. Nobody can connect or send messages. I tried to increase CPU Power but does not changed.

http://stackoverflow.com/a/26765291
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26764459
has body: If you have a double and you need to make a BigDecimal out of it, without adding all the extra precision, try something like double d = 19.89; // or something else bd = new BigDecimal(d, new MathContext(15)); This tells it to keep only 15 digits of precision (which is about how many digits of precision a double supports). This creates a BigDecimal whose toString() returns "19.8900000000000" which isn't quite perfect, since all the trailing zeroes will show up, but it doesn't give you the extra non-zero digits you're getting.

http://stackoverflow.com/comment/42140459
score: 0
comment on: http://stackoverflow.com/q/26779014
type: QuestionComment
has text: Thanks for advises. But I still looking for answer of my question. I don't know Vaadin so well (and Java too), but as I know it generates JS+HTML according to Java code (through using GWT). So I looking for a way using client-side Canvas to draw some simple interactive graphic.
type: Comment

http://stackoverflow.com/comment/42134599
comment on: http://stackoverflow.com/a/26778111
type: AnswerComment
score: 0
has text: If that were required, wouldn't it make more sense to just instantiate the constructor directly and not use the factory pattern?
type: Comment

http://stackoverflow.com/comment/42065392
has text: thanks for the answer but i doesn't update textview ,but i get the date correct from fragment B. option 3 how do you pass a bundle on popBackStack()?
comment on: http://stackoverflow.com/a/26739427
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26806050
accepted answer: http://stackoverflow.com/a/26806950
type: Question
has title: Android Sax Parser HttpClient vs Url what are the differences
score: 0
tagged with: saxparser
answer count: 1
has body: Hi everyone I'm quite new in Android developement, I want to know if there's any difference between passing the stream to the parser in this way SAXParserFactory saxPF = SAXParserFactory.newInstance(); SAXParser saxP = saxPF.newSAXParser(); XMLReader xmlR = saxP.getXMLReader(); URL url = new URL("http://www.xmlfiles.com/examples/cd_catalog.xml"); // URL XMLHandler myXMLHandler = new XMLHandler(); xmlR.setContentHandler(myXMLHandler); xmlR.parse(new InputSource(url.openStream())); Or in this way HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://www.xmlfiles.com/examples/cd_catalog.xml"); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); SAXParserFactory saxPF = SAXParserFactory.newInstance(); SAXParser saxP = saxPF.newSAXParser(); XMLReader xmlR = saxP.getXMLReader(); XMLHandler myXMLHandler = new XMLHandler(); xmlR.setContentHandler(myXMLHandler); xmlR.parse(new InputSource(entity.getContent())); There's any advantage in the second? Which of the two use less memory?
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: sax
has answer: http://stackoverflow.com/a/26806950

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/26762573
type: Tag

http://stackoverflow.com/comment/59749047
score: 0
type: Comment
has text: Welcome to Stack Overflow! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
comment on: http://stackoverflow.com/a/36050229
type: AnswerComment

http://stackoverflow.com/a/26782119
downvote count: 0
has body: The subclass can only override instance methods which are inherited by it. Since private and final methods are not inherited, they cannot be overridden. The return type of an overriding method should be same as, or a subclass of, the return type declared in the overridden superclass method. The argument list of overriding method should be same as that of overridden superclass method. This is important as different argument list results in overloading rather than overriding. The access modifier of overriding method should be same or less restrictive than that of superclass method. It cannot be more restrictive. The overriding method cannot throw exceptions that are new or broader than those declared by overridden superclass method. However, it can throw narrower or fewer exception than superclass method. Static methods cannot be overridden.
answers question: http://stackoverflow.com/q/26781825
upvote count: 2
type: Answer
score: 2

akka
type: Tag
tags question: http://stackoverflow.com/q/26791069
tags question: http://stackoverflow.com/q/26803018
tag name: akka
tags question: http://stackoverflow.com/q/26715216

http://stackoverflow.com/comment/42185042
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26805838
has text: Sorry, my edit and comment had become obsolete in light of your `ClassNotFoundException`.
score: 0

http://stackoverflow.com/q/26678539
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26678604
tagged with: java
linked to: http://stackoverflow.com/q/19694471
type: Question
upvote count: 15
has title: How can I move a file to a non-empty directory?
score: 15
tagged with: nio
has comment: http://stackoverflow.com/comment/52384961
answer count: 2
has answer: http://stackoverflow.com/a/26678604
has body: I'm new to Java's nio package and I can't figure out how to get a file from one directory into another. My program is supposed to read through a directory and its subdirectories and process files based on certain conditions. I can get all the files using Files.walkFileTree but when I try to move them I get a java.nio.file.AccessDeniedException. If I try to copy them, I get a DirectoryNotEmptyException. I haven't been able to find any help on Google. I'm sure there must an easy way to move a file from one directory to another, but I can't figure it out. This is what I'm trying that gets the DirectoryNotEmptyException: private static void findMatchingPdf(Path file, ArrayList cgbaFiles) { Iterator iter = cgbaFiles.iterator(); String pdfOfFile = file.getFileName().toString().substring(0, file.getFileName().toString().length() - 5) + ".pdf"; while (iter.hasNext()){ Path cgbaFile = (Path) iter.next(); if (cgbaFile.getFileName().toString().equals(pdfOfFile)) { try { Files.move(file, cgbaFile.getParent(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException ex) { ex.printStackTrace(); } } } } I'm iterating through a list of files, trying to match a .meta file with a .pdf of the same name. Once I find the match, I move the metadata file to the directory that has the pdf. I get this exception: java.nio.file.DirectoryNotEmptyException: C:\test\CGBA-RAC\Part-A at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:372) at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287) at java.nio.file.Files.move(Files.java:1347) at cgba.rac.errorprocessor.ErrorProcessor.findMatchingPdf(ErrorProcessor.java:149) at cgba.rac.errorprocessor.ErrorProcessor.matchErrorFile(ErrorProcessor.java:81) at cgba.rac.errorprocessor.ErrorProcessor.main(ErrorProcessor.java:36)
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41957551
has answer: http://stackoverflow.com/a/26679752
accepted answer: http://stackoverflow.com/a/26679752

http://stackoverflow.com/q/26788464
has body: I've updated my SDK to API 21 and now the back/up icon is a black arrow pointing to the left. I would like it to be grey. How can I do that? In the Play Store, for example, the arrow is white. I've done this to set some styles. I have used @drawable/abc_ic_ab_back_mtrl_am_alpha for homeAsUpIndicator. That drawable is transparent (only alpha) but the arrow is displayed in black. I wonder if I can set the color like I do in the DrawerArrowStyle. Or if the only solution is to create my @drawable/grey_arrow and use it for homeAsUpIndicator. My solution so far has been to take the @drawable/abc_ic_ab_back_mtrl_am_alpha, which seems to be white, and paint it in the color I desire using a photo editor. It works, although I would prefer to use @color/actionbar_text like in DrawerArrowStyle.
tagged with: colors
tagged with: android
linked to: http://stackoverflow.com/q/28620883
has answer: http://stackoverflow.com/a/66235204
has answer: http://stackoverflow.com/a/31413647
has comment: http://stackoverflow.com/comment/82706787
favorite count: 0
has answer: http://stackoverflow.com/a/39508362
score: 211
tagged with: android-styles
has answer: http://stackoverflow.com/a/61460127
has answer: http://stackoverflow.com/a/26788957
downvote count: 0
has answer: http://stackoverflow.com/a/42267599
linked to: http://stackoverflow.com/q/29041027
possible better answer: http://stackoverflow.com/a/27517878
has answer: http://stackoverflow.com/a/29114008
has answer: http://stackoverflow.com/a/35192656
has answer: http://stackoverflow.com/a/40217359
has answer: http://stackoverflow.com/a/60012351
has answer: http://stackoverflow.com/a/34180711
has title: How to change color of the back arrow in the new material theme?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32582254
has comment: http://stackoverflow.com/comment/73328545
has answer: http://stackoverflow.com/a/68684213
has answer: http://stackoverflow.com/a/35482603
tagged with: java
has answer: http://stackoverflow.com/a/41055677
linked to: http://stackoverflow.com/q/52678315
has answer: http://stackoverflow.com/a/26821268
type: Question
has answer: http://stackoverflow.com/a/39104056
has answer: http://stackoverflow.com/a/58854391
answer count: 25
has answer: http://stackoverflow.com/a/69357501
upvote count: 211
has comment: http://stackoverflow.com/comment/56972414
has answer: http://stackoverflow.com/a/26837072
has answer: http://stackoverflow.com/a/42325863
accepted answer: http://stackoverflow.com/a/26837072
has answer: http://stackoverflow.com/a/46520443
linked to: http://stackoverflow.com/q/31590714
tagged with: user-interface
has answer: http://stackoverflow.com/a/27517878
has answer: http://stackoverflow.com/a/31103586
has answer: http://stackoverflow.com/a/36907618

http://stackoverflow.com/q/26730983
has comment: http://stackoverflow.com/comment/42167985
has comment: http://stackoverflow.com/comment/42602080
has answer: http://stackoverflow.com/a/27089910
type: Question
linked to: http://stackoverflow.com/q/13968271
answer count: 2
linked to: http://stackoverflow.com/q/5174070
has comment: http://stackoverflow.com/comment/42609100
score: 0
accepted answer: http://stackoverflow.com/a/27089910
has comment: http://stackoverflow.com/comment/42049619
has comment: http://stackoverflow.com/comment/42615558
possible better answer: http://stackoverflow.com/a/26732186
has comment: http://stackoverflow.com/comment/42050275
has answer: http://stackoverflow.com/a/26732186
tagged with: jeditorpane
tagged with: swing
type: AnsweredQuestion
has body: I have the following class: import java.awt.*; import javax.swing.*; import javax.swing.text.html.HTMLEditorKit; public class test { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { // now add it all to a frame JFrame j = new JFrame("Test"); WorkBench right = new WorkBench(); j.getContentPane().add(right, BorderLayout.CENTER); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); right.addPortal(getPortal()); // center the jframe, then make it visible j.setSize(800, 600); j.setLocationRelativeTo(null); j.setVisible(true); } }); } public static JPanel getPortal() { JEditorPane swingbox = new JEditorPane(); swingbox.setEditorKit(new HTMLEditorKit()); swingbox.setOpaque(true); swingbox.setContentType("text/html"); String htmlString = " \n" + " \n" + " Welcomfve! sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " This is an H2 header. sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " This is some sample text sdsdsdsdsd sdsdsd sdsd sdsd sdsd \n" + " devdaily blog \n" + " \n"; swingbox.setText(htmlString); swingbox.setBackground(Color.WHITE); JPanel p = new JPanel(new BorderLayout()); p.setBackground(Color.WHITE); JLabel title = new JLabel("Heading " ); title.setBackground(Color.WHITE); p.add(title, BorderLayout.NORTH); p.add(swingbox, BorderLayout.CENTER); return p; } public static class WorkBench extends JPanel { private Box current = null; public WorkBench() { setLayout(new BorderLayout()); current = Box.createVerticalBox(); //** Scenario A - no vertical scrolling ** add(current, BorderLayout.CENTER); //** Scenario B - no line wrapping ** //JScrollPane sp = new JScrollPane(current ); //sp.setViewportView(current ); //add(sp, BorderLayout.CENTER); } public void addPortal(JPanel portal) { current.add(portal); validate(); } } } I want to add multiple JP…
has title: Swing - JEditorPane inside JScrollPane - lines not being "wrapped"
tagged with: java

http://stackoverflow.com/q/26693722
has answer: http://stackoverflow.com/a/26693964
tagged with: algorithm
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/26694285
has comment: http://stackoverflow.com/comment/41989785
type: Question
has body: I'm stuck with relatively simple sorting problem. I have to write a method sort_points(Point[] points) that sorts a Point array based only the Points x coordinates; and it is known that their x coordinates can only be either 1 or 2. Their y coordinates are irrelevant; and I cannot use extra arrays to help. For example, the following {(1, 3), (2, 2), (2, 1), (1, 1), (1, 2)} should become this {(1, 3), (1, 1), (1, 2), (2, 2), (2, 1)} after sorting. The challenging part is that I have to sort in time complexity of O(array.length), which (correct me if I'm wrong) means that I have to sort the array in one iteration of initial point array. My initial idea was to append any points element where x is 2 to the end of the array, but that means deleting an element in the array while at the same time iterating over it, which gives a lot of problems in Java. Can anyone suggest how to approach this?
has comment: http://stackoverflow.com/comment/41983041
has answer: http://stackoverflow.com/a/26694039
tagged with: arrays
answer count: 6
tagged with: sorting
has answer: http://stackoverflow.com/a/26694285
has answer: http://stackoverflow.com/a/26693937
has answer: http://stackoverflow.com/a/26703403
favorite count: 0
possible better answer: http://stackoverflow.com/a/26693934
downvote count: 2
upvote count: 1
type: AnsweredQuestion
has title: Sorting algorithm of only two different elements
has comment: http://stackoverflow.com/comment/41983666
has answer: http://stackoverflow.com/a/26693934

http://stackoverflow.com/comment/42836501
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27045334
has text: Depends what kind of till you use but most tills are plugged in via the printer so you can sent a command to the printer and it opens the till.

updates
tags question: http://stackoverflow.com/q/26692423
tag name: updates
type: Tag

http://stackoverflow.com/comment/42116932
type: Comment
comment on: http://stackoverflow.com/a/26767098
has text: Thanks Steve, I actually forgot to mention that I had used DatatypeConverter (printBase64Binary method) and had some luck, but oddly, all special characters were stripped from the data. No spaces, commas, anything like that. Any ideas?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42017114
score: 0
comment on: http://stackoverflow.com/a/26710301
type: AnswerComment
has text: @RobinChang unfortunately from your code i can't understand how you activate it, and when i do it, the code run as expected.
type: Comment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26813826
tags question: http://stackoverflow.com/q/26781461
tags question: http://stackoverflow.com/q/26680206
tags question: http://stackoverflow.com/q/26716398
type: Tag

http://stackoverflow.com/q/26816798
has body: I am trying to make web services but there are two situations I am getting. There are two types of xsd file 1st one is: &lt;xsd:element name="signupRequest"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="name" type="xsd:string"/&gt; &lt;xsd:element name="email" type="xsd:string"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element &lt;xsd:element name="signupResponse"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="signup" type="tns:Signup"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:simpleType name="Signup"&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:enumeration value="Success"/&gt; &lt;xsd:enumeration value="DuplicateEmail"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; in that case jaxb generates signuprequest signupresponse and signup classes so i can easily make services for example in this case: public Signup signupResponse(String name,String mobile); but if I set signupresponse directly like this: &lt;xsd:element name="signupResponse"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:enumeration value="Success"/&gt; &lt;xsd:enumeration value="DuplicateMail"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; jaxb only generate sinuprequest class and do not generate signupresponse and signup classes instead it makes entry in ObjectFactory class like this private final static QName _SignupResponse_QNAME = new QName("http://www.example.com", "signupResponse"); and method is: @XmlElementDecl(namespace = "http://www.example.com", name = "signupResponse") public JAXBElement&lt;String&gt; createSignupResponse(String value) { return new JAXBElement&lt;String&gt;(_SignupResponse_QNAME, String.class, null, value); so please guide me how to make services for these types of xsd architecture.
upvote count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: xsd
has title: ObjectFactory methods generated by jaxb
score: 1
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26843226
answer count: 1
has comment: http://stackoverflow.com/comment/47454535

http://stackoverflow.com/q/26702647
type: AnsweredQuestion
type: Question
tagged with: jframe
has answer: http://stackoverflow.com/a/26702687
has body: Ok here is my problem... I have this jframe with a jpanel inside. And in that jpanel there is about 30 jbuttons stacked under eachother. But only 17 can be veiwed at a time. Is there a way i can scroll down worts to see the rest? Btw im not looking for JScrollPane
accepted answer: http://stackoverflow.com/a/26702687
score: 0
tagged with: java
tagged with: scroll
has comment: http://stackoverflow.com/comment/41998749
answer count: 1
tagged with: jbutton
has title: Java scrolling through jbuttons
tagged with: jpanel

http://stackoverflow.com/q/26755820
tagged with: notnull
tagged with: java
tagged with: methods
type: Question
has title: Java: Validating a string
has answer: http://stackoverflow.com/a/26756153
has answer: http://stackoverflow.com/a/26755890
upvote count: 0
possible better answer: http://stackoverflow.com/a/26755867
tagged with: string
has answer: http://stackoverflow.com/a/26755867
has answer: http://stackoverflow.com/a/26755905
has answer: http://stackoverflow.com/a/26755934
has comment: http://stackoverflow.com/comment/42093903
answer count: 7
linked to: http://stackoverflow.com/q/767372
has body: So I am working on a project in java and I have just a quick question. I have a method that is receiving a string and I want to strip out the spaces and check that is is not empty. So far I have the below in place however it doesn't seem to be working properly. public static Boolean isValid(String s) { s.replace(" ", ""); if (s == ""){ return false; } else { return true; } } Any help would be appreciated :) Ta
favorite count: 0
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/26755884
has answer: http://stackoverflow.com/a/26756141
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26755934

http://stackoverflow.com/comment/42033466
type: Comment
has text: @RokIvartnik Wait, hold on, what? The words don't need to do anything, you need to do something. Are you just saying you need each `ArrayList` to be composed solely of strings of a particular length?
type: AnswerComment
comment on: http://stackoverflow.com/a/26721570
score: 0

http://stackoverflow.com/comment/43292861
score: 0
has text: I get the same error while running the stock example for WordCount
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26728504

anonymous-inner-class
tags question: http://stackoverflow.com/q/26791044
tag name: anonymous-inner-class
type: Tag

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/26703786
type: Tag
tags question: http://stackoverflow.com/q/26769565
tags question: http://stackoverflow.com/q/26823195
tags question: http://stackoverflow.com/q/26700100

http://stackoverflow.com/comment/41991585
comment on: http://stackoverflow.com/q/26698625
has text: If the VM is shutting down, it has to terminate threads *whatever* they may be doing. Otherwise it can't shutdown. Surely this is obvious?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26794596
has answer: http://stackoverflow.com/a/26794705
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26794622
tagged with: recursion
has body: I have some trouble understanding the following recursive code: public class recursive { public static void main(String[] args){ helper(0) ; } public static void helper(int i){ int a=3; if(i==a){ System.out.println("yes:"+i); return; }else{ for(;i&lt;a;i++){ System.out.println("no:"+i); helper(i+1); System.out.println("end:"+i); } } } } The Output is as follows: no:0 no:1 no:2 yes:3 end:2 //why this is 2? end:1 //why this is 1? no:2 yes:3 end:2 end:0 no:1 no:2 yes:3 end:2 end:1 no:2 yes:3 end:2 I do not understand why the first end is 2. Can anyone explain how does the recursion work in this simple program?
tagged with: java
type: Question
answer count: 2
has title: Can anyone explain how does the following recursion work?

http://stackoverflow.com/comment/42043136
comment on: http://stackoverflow.com/q/26727137
score: 0
type: Comment
type: QuestionComment
has text: DId you check whether actual folders are exist on the disk?

http://stackoverflow.com/q/26761770
has body: I already can get the bytestream of the operation system standard input device. I now want to change the input device while the program is already running. That is the code to get the targetDataLine/input stream of the standard input device (it works): dataLineInfo = new DataLine.Info( TargetDataLine.class , getAudioFormat() ) ; targetDataLine = (TargetDataLine)AudioSystem.getLine( dataLineInfo ) ; targetDataLine.open( getAudioFormat() ); targetDataLine.start(); I also can get the list of all available input devices and give them out in a combobox to select another input device (it works): Mixer.Info[] mixerInfo; mixerInfo = AudioSystem.getMixerInfo(); Line.Info targetDLInfo = new Line.Info(TargetDataLine.class); for(int cnt = 0; cnt &lt; mixerInfo.length; cnt++) { Mixer currentMixer = AudioSystem.getMixer(mixerInfo[cnt]); if( currentMixer.isLineSupported(targetDLInfo) ) { combo1.addItem(mixerInfo[cnt].getName()); } } That is the code how I change the input device (it doesn't work) if(e.getSource() == combo1){ System.out.println("Gewählter Input: " + combo1.getSelectedItem()); Mixer.Info[] mixerInfo; mixerInfo = AudioSystem.getMixerInfo(); Line.Info targetDLInfo = new Line.Info(TargetDataLine.class); for(int cnt = 0; cnt &lt; mixerInfo.length; cnt++) { Mixer currentMixer = AudioSystem.getMixer(mixerInfo[cnt]); if( mixerInfo[cnt].getName() == combo1.getSelectedItem().toString()) { System.out.println("Gewählter Input gefunden"); targetDataLine.close(); dataLineInfo = new DataLine.Info( TargetDataLine.class , getAudioFormat() ) ; try { targetDataLine = (TargetDataLine) currentMixer.getLine(dataLineInfo) ; targetDataLine.open( getAudioFormat() ); targetDataLine.start(); } catch (LineUnavailableException e1) { e1.printStackTrace(); } }} } In fact I think I only made a small mistake with the last part but I don't know what mistake. If I switch to another audio input device I just hear a small beep and then nothing. If I switch back to the primary audio device I can hear t…
upvote count: 1
type: Question
tagged with: audio
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/39943064
type: UnansweredQuestion
tagged with: microphone
tagged with: input
has title: How to change the audio input device while the java program is executing?

http://stackoverflow.com/q/26826151
has answer: http://stackoverflow.com/a/26826227
has answer: http://stackoverflow.com/a/26826219
upvote count: 1
accepted answer: http://stackoverflow.com/a/26826219
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42220537
favorite count: 0
answer count: 3
tagged with: io
possible better answer: http://stackoverflow.com/a/26826363
has comment: http://stackoverflow.com/comment/42220723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42220758
has comment: http://stackoverflow.com/comment/42220771
score: 1
has answer: http://stackoverflow.com/a/26826363
tagged with: java
has title: summing column by column in java
has body: i have file txt in desktop : 1 5 23 2 5 25 3 30 36 i want sum column by column 1 + 2 + 3 =... and 5 + 5...n and 23,...n Scanner sc = new Scanner (file("patch"); while (sc.hasNextLine) { //each sum by column } help me please thanks
type: Question

http://stackoverflow.com/q/26769643
upvote count: 10
has body: Trying to find a way to get rid of this error on eclipse. DataNucleus Enhancer (version 3.1.1) : Enhancement of classes Encountered a problem: Unexpected exception Here is the log java.lang.RuntimeException: Unexpected exception at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76) at com.google.appengine.tools.enhancer.Enhance.&lt;init&gt;(Enhance.java:71) at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74) ... 2 more Caused by: java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.datanucleus.enhancer.asm.ASMClassEnhancer.getClassNameForFileName(ASMClassEnhancer.java:272) at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:727) at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525) at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258) ... 7 more I have two versions of java, one is 1.8.0_25, the other is 1.7.0_46 this is my path C:\Program Files (x86)\Java\jre7\bin;;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\ProgramData\Oracle\Java\javapath; and as a default I use the jre7 on eclipse, dont know what else to mention here. I found no solutions clearly explained here or on the other websites rather than trying to change the java version, tried all java instances on my computer, uninstalled and installed again. I am guessing it may be about java and datanucleus compability issue, bu…
type: Question
tagged with: datanucleus
linked to: http://stackoverflow.com/q/28864274
has comment: http://stackoverflow.com/comment/42143637
downvote count: 0
accepted answer: http://stackoverflow.com/a/27053228
has answer: http://stackoverflow.com/a/29601146
answer count: 3
has answer: http://stackoverflow.com/a/29490841
possible better answer: http://stackoverflow.com/a/29601146
favorite count: 0
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/58890506
has answer: http://stackoverflow.com/a/27053228
type: AnsweredQuestion
has title: Google App Engine DataNucleus 3.1.1 Unexpected Exception Error
has comment: http://stackoverflow.com/comment/42148002
tagged with: java
score: 10

http://stackoverflow.com/a/26759587
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26759408
answers question: http://stackoverflow.com/q/26759408
has comment: http://stackoverflow.com/comment/42100501
type: AcceptedAnswer
downvote count: 0
has body: Call scrollRectToVisible method on desired component (JPanel in your case) but on JScrollPane object. private JPanel panel; ... private void moveLeft() { Rectangle rec = panel.getVisibleRect(); rec.setLocation((int) (rec.getX() + 1000), (int) rec.getY()); System.out.println(rec); panel.scrollRectToVisible(rec); System.out.println(panel.getVisibleRect()); }

http://stackoverflow.com/comment/42485103
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26817884
has text: Sure i updated a post above.

http://stackoverflow.com/comment/42419179
comment on: http://stackoverflow.com/a/26824648
has text: Thanks Bharat, I will surely try it
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26714788
has title: Connect to remote GridGain node from Java Application
tagged with: gridgain
tagged with: java
type: Question
has body: I am trying to connect to an existing grid of GridGain nodes configured as computing nodes, however I haven't managed to find a way to connect to the cluster without having to programmatically start and in-memory node. I even tried to replicate the config in my Java app but still no progress: List&lt;String&gt; addressList = new ArrayList&lt;String&gt;(); addressList.add("127.0.0.1:47500..47509"); GridTcpDiscoveryVmIpFinder gridTcpDiscoveryVmIpFinder = new GridTcpDiscoveryVmIpFinder(); gridTcpDiscoveryVmIpFinder.setAddresses(addressList); GridTcpDiscoverySpi gridTcpDiscoverySpi = new GridTcpDiscoverySpi(); gridTcpDiscoverySpi.setIpFinder(gridTcpDiscoveryVmIpFinder); Collection&lt;GridNode&gt; remoteNodes = gridTcpDiscoverySpi.getRemoteNodes(); Is there a way to connect to an existing grid without having to start an in-memory node? EDIT: I've also tried to connect to running nodes by using the UUID and again no luck: Grid grid = GridGain.grid(UUID.fromString("186FFB45-2686-4A69-BAF0-791E4C0B5E69")); Also what I'm trying to achieve is to make a remote computation with a Java Future: GridCompute gridCompute = gridNode.grid().compute(); AsyncObject asyncObject = new AsyncObject(); GridFuture gf = gridCompute.call(asyncObject); Where AsyncObject is a class that implements the Callable interface and returns the sum of two numbers.
has answer: http://stackoverflow.com/a/26729230
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26729230
score: 0
answer count: 1

http://stackoverflow.com/a/26743933
has comment: http://stackoverflow.com/comment/42073783
upvote count: 1
answers question: http://stackoverflow.com/q/26743820
has body: Use yyyy-MM-dd HH:mm:ss as your simple date format. I know you don't have hours, minutes and seconds, but I don't believe that it accepts it without them.
type: Answer
has comment: http://stackoverflow.com/comment/42073953
downvote count: 0
score: 1

http://stackoverflow.com/a/26776422
has comment: http://stackoverflow.com/comment/42132067
downvote count: 0
has body: I am not really confident in using a debugger to see how hibernate actually maps association. It uses special collections that it populates on-demand, because populating a collection causes an extra request and Hibernate tries to give a good mix between simplicity and performance. So when you ask for *the person owning Pussicat`, Hibernate only does the query on table Person unless you eagerly load child table, an will only do the queries on child tables if you list the cats and dogs of that person in code an not in debugger. And you know you cannot eagerly load all association. If you did, any simply query could load all the database ... IMHO when you say Hibernate did not populate cats Set, it is only because in the debugger the set is not initially null nor empty and so the debugger does not ask hibernate to issue the query. But if you asked in the code for the list of cats, you would get it correctly.
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26775252
has comment: http://stackoverflow.com/comment/42136776

optaplanner
tags question: http://stackoverflow.com/q/26787617
tag name: optaplanner
tags question: http://stackoverflow.com/q/26714618
tags question: http://stackoverflow.com/q/26769963
tags question: http://stackoverflow.com/q/26794063
type: Tag

http://stackoverflow.com/comment/52384961
comment on: http://stackoverflow.com/q/26678539
score: 0
type: QuestionComment
type: Comment
has text: possible duplicate of [How to copy a file to a directory in Java 7](http://stackoverflow.com/questions/19694471/how-to-copy-a-file-to-a-directory-in-java-7)

http://stackoverflow.com/a/26694045
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26693851
has body: You've put your strings in an array, so you just add an element from the array to your hand string: hand += cards[player[i]] + " "; There is, however, still a problem with your code. You obtain the random numbers as follows: player[i] = (int) (Math.random() * (6 - 1) + 1); You probably expect this to be a number from 1 to 6. However, Math.random() returns a double from 0 (inclusive) to 1 (exclusive). That means that player[i] will never be assigned 6. This error kind of solves another error: since Java arrays are zero-based, the element with index 6 does not exist. (Thus, if 6 would have been chosen, your program would have aborted with an error message.) But still, the number 0 and thus the word "Nine" will never appear in your solution. So you have to change the two lines to: hand += cards[player[i] - 1] + " "; and player[i] = (int) (Math.random() * 6 + 1); respectively. Consider making the cards array a static class member; then you don't need to pass the array to the playerHand method as an argument.
has comment: http://stackoverflow.com/comment/41984328
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41989447
accepted answer of: http://stackoverflow.com/q/26693851

http://stackoverflow.com/q/26741568
score: 1
has answer: http://stackoverflow.com/a/26741799
favorite count: 0
has title: Is free memory consuming less power on android devices?
tagged with: android
has answer: http://stackoverflow.com/a/26741861
accepted answer: http://stackoverflow.com/a/26742422
upvote count: 2
tagged with: battery
has body: For instance we have two same android devices with 2GB RAM each (the energy-dependant memory). Device 1: 1GB RAM is busy by running applications and 1GB RAM is free. Device 2: 2GB RAM are busy by running applications. Imagine that CPU is not used by the apps runing or is used just a little. The memory also remains unchanged (not rewriting frequently). Will the device 2 lose power (to 0% battery charge) much faster than device 1? Please explain this issue to me, I am really curious about java-android memory power usage.
possible better answer: http://stackoverflow.com/a/26741861
downvote count: 1
has comment: http://stackoverflow.com/comment/42077617
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42077805
tagged with: ram
has comment: http://stackoverflow.com/comment/42068969
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/26742422
answer count: 3

http://stackoverflow.com/q/26703031
favorite count: 0
has title: Java math help imaginary number
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41999403
type: Question
has comment: http://stackoverflow.com/comment/42012920
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41999492
score: -1
has comment: http://stackoverflow.com/comment/42015927
has answer: http://stackoverflow.com/a/26712574
has body: Im doing this math for my assignment where you have to find the imaginary number. double dem = (b*b-4*a*c)*-1; double dem2 = Math.sqrt(dem); realPart = (-b/(2*a)); imagine = (dem2)/(2*a); imagineneg = (dem2)/(2*a); So basically Im trying to get it that the number inside the square root isnt negative. So lets say I enter a: 1, b: -1, c: 4.25. When you do the discriminant it would be -16 but I want that to be positive so I multiple it by -1 (thats the dem part). Then I sqaure root the whatever the answer is and then go to the imagine and imagineneg part where you find the imaginary number. My problem is that instead of it being -16*-1 to get 16, some how I get 15. Does anyone know how to fix this problem?
answer count: 1

http://stackoverflow.com/comment/42208316
type: Comment
comment on: http://stackoverflow.com/a/26818814
has text: Okay, wonderful. I understand how it works and it would have been fairly easy if I had it all under the same class. but the objext xx is defined in the main class. Therefore im not able to use that if statement in the Human class. It says: Cannot find symbol
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42115590
score: 0
has text: From the description, that sounds like nlerp. To get it, linearly interpolate each of the components of the quaternion, and then normalize it.
type: QuestionComment
comment on: http://stackoverflow.com/q/26765655
type: Comment

http://stackoverflow.com/a/26675877
downvote count: 1
has body: Try this code: for(int i=a;i&lt;=b;i++){ if(i%2 == 0 || i%3 == 0 || i%5 == 0){ c++; } }
answers question: http://stackoverflow.com/q/26675725
has comment: http://stackoverflow.com/comment/41950875
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/a/26818341
type: Answer
answers question: http://stackoverflow.com/q/26813452
score: 1
upvote count: 1
has body: Remove android:id="@android:id/list" Replace it with android:id="@+id/list" &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="0dp" android:divider="@color/list_divider" android:dividerHeight="1dp" android:layout_weight="1" android:listSelector="@drawable/list_row_selector" /&gt;
accepted answer of: http://stackoverflow.com/q/26813452
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26711891
possible better answer: http://stackoverflow.com/a/26715086
has title: Spring declare component in xml
has answer: http://stackoverflow.com/a/26715086
has comment: http://stackoverflow.com/comment/42014983
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42015045
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26714875
tagged with: spring-mvc
tagged with: java
has body: I am mostly using @Autowired and @Component annotations in my project. However, I am going to use DataSource class for database actions. So, I use this is in my dispatcher-servlet.xml : &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt; &lt;property name="url" value="jdbc:mysql://localhost:3306/market"/&gt; &lt;property name="username" value="root"/&gt; &lt;property name="password" value=""/&gt; &lt;/bean&gt; In my dao class, My setter for the dataSource is : @Autowired private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; this.jdbcTemplateObject = new JdbcTemplate(dataSource); } However this is not doing the trick. My jdbcTemplateObject is null. If I dont use "context:component scan ..." and use classical spring beans instead, without utilizing @Autowired annotation, all works good. I can use my database. However, I dont want to declare all the beans one by one in my xml file. As the project grows, it is not going to be practical. How can I solve this problem ? Is it possible to declare dataSource in my dispatcher-servlet.xml as component, so @Autowired works on dataSource ?
tagged with: mysql
tagged with: datasource
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26714875
has comment: http://stackoverflow.com/comment/42015222
type: Question
has comment: http://stackoverflow.com/comment/42015180

xml-parsing
tags question: http://stackoverflow.com/q/26715644
tags question: http://stackoverflow.com/q/26786246
tags question: http://stackoverflow.com/q/26719503
tag name: xml-parsing
type: Tag
tags question: http://stackoverflow.com/q/26817645
tags question: http://stackoverflow.com/q/26794226
tags question: http://stackoverflow.com/q/26825957
tags question: http://stackoverflow.com/q/26805800

http://stackoverflow.com/comment/42043895
comment on: http://stackoverflow.com/q/26727502
score: 0
type: Comment
type: QuestionComment
has text: when user input the Roman number, it will check if it legit or not, which in the first method. so if it legit it will return what user input

http://stackoverflow.com/comment/42012159
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26710309
type: Comment
has text: But this support is removed from java 8 .Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitV erifier; support was removed in 8.0

http://stackoverflow.com/q/26759060
tagged with: android
has answer: http://stackoverflow.com/a/26759247
type: AnsweredQuestion
tagged with: java
tagged with: timertask
has body: I'm trying to capture raw video-data from Android Camera. I'm using Timer+TimerTask pattern. long lastT = System.currentTimeMillis(); long curT = System.currentTimeMillis(); timertask = new TimerTask() { @Override public void run() { curT = System.currentTimeMillis(); Log.d(TAG_VIDEO,"&gt;&gt;\t" + (curT - lastT) + "\t::\t");// + data.length); lastT = curT; } }; timer.scheduleAtFixedRate(timertask, 0L, 1000L/15L); But LogCat says inner tread launches every 3-170 ms. Omg why? How to fix it? The other methods (Handler, Thread) give the same result. The log: 11-05 17:54:27.550: &gt;&gt; 67 :: 11-05 17:54:27.620: &gt;&gt; 65 :: 11-05 17:54:27.685: &gt;&gt; 66 :: 11-05 17:54:27.750: &gt;&gt; 66 :: 11-05 17:54:27.815: &gt;&gt; 66 :: 11-05 17:54:27.880: &gt;&gt; 67 :: 11-05 17:54:27.945: &gt;&gt; 65 :: 11-05 17:54:28.015: &gt;&gt; 66 :: 11-05 17:54:28.080: &gt;&gt; 66 :: 11-05 17:54:28.145: &gt;&gt; 66 :: 11-05 17:54:28.250: &gt;&gt; 66 :: 11-05 17:54:28.280: &gt;&gt; 68 :: 11-05 17:54:28.450: &gt;&gt; 168 :: 11-05 17:54:28.450: &gt;&gt; 3 :: 11-05 17:54:28.475: &gt;&gt; 25 :: 11-05 17:54:28.550: &gt;&gt; 77 :: 11-05 17:54:28.650: &gt;&gt; 95 :: 11-05 17:54:28.675: &gt;&gt; 26 :: 11-05 17:54:28.740: &gt;&gt; 66 :: 11-05 17:54:28.805: &gt;&gt; 66 :: 11-05 17:54:28.930: &gt;&gt; 76 :: 11-05 17:54:28.940: &gt;&gt; 57 :: 11-05 17:54:29.125: &gt;&gt; 95 :: 11-05 17:54:29.130: &gt;&gt; 95 :: 11-05 17:54:29.160: &gt;&gt; 30 :: 11-05 17:54:29.280: &gt;&gt; 69 :: 11-05 17:54:29.280: &gt;&gt; 51 :: 11-05 17:54:29.380: &gt;&gt; 103 :: 11-05 17:54:29.470: &gt;&gt; 48 :: 11-05 17:54:29.470: &gt;&gt; 41 :: 11-05 17:54:29.575: &gt;&gt; 105 :: 11-05 17:54:29.670: &gt;&gt; 44 :: 11-05 17:54:29.670: &gt;&gt; 50 :: 11-05 17:54:29.765: &gt;&gt; 91 :: 11-05 17:54:29.855: &gt;&gt; 49 :: 11-05 17:54:29.865: &gt;&gt; 54 :: 11-05 17:54:29.950: &gt;&gt; 87 :: 11-05 17:54:30.005: &gt;&gt; 52 :: 11-05 17:54:30.085: &gt;&gt; 79 :: 11-05 17:54:30.130: &gt;&gt; 46 :: 11-05 17:54:30.280: &gt;&gt; 153 :: …
type: Question
has title: Timer and TimerTask period is wrong
accepted answer: http://stackoverflow.com/a/26759247
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/18739748
tagged with: timer

http://stackoverflow.com/q/26716157
favorite count: 0
has comment: http://stackoverflow.com/comment/42023590
has comment: http://stackoverflow.com/comment/42022644
has comment: http://stackoverflow.com/comment/42023683
has title: Exclude files in ant build
has comment: http://stackoverflow.com/comment/42022672
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: ant
has answer: http://stackoverflow.com/a/26716221
linked to: http://stackoverflow.com/q/3808612
accepted answer: http://stackoverflow.com/a/26716221
answer count: 1
downvote count: 0
has body: I have the following ant file, <include name="*.jar"/> <include name="*.jar"/> <include name="*.jar"/> <mkdir dir="classes"/> <mkdir dir="bin"/> <exclude name="/src/web/DaemonSocket.java"/> <classpath refid="build-classpath"/> <classpath refid="build-classpath"/> <delete dir="classes"/> <delete dir="bin"/> At the exclude line with the code, <exclude name="/src/web/DaemonSocket.java"/> <classpath refid="build-classpath"/> I expect the file DaemonSocket.java not to be compiled into the classes folder. However everytime I run ant compile, the DaemonSocket.java file is compiled into both the classes and the bin folder. Why might the exclude not be working in this case?

http://stackoverflow.com/comment/42091262
score: 0
type: Comment
has text: -> Could you please elaborate on that as to how it can be done in my code? Another thing that I would like to point out that for such cases should I be using threads? Thanks for pointing the client problem. It would be great if you could write a code snippet to articulate what you are saying.
type: AnswerComment
comment on: http://stackoverflow.com/a/26751869

http://stackoverflow.com/comment/42195230
comment on: http://stackoverflow.com/a/26810999
has text: What color is the actual background of the Activity? Unless you are setting one explicitly, it's going to default to the one specificed by your theme.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42008682
type: Comment
has text: +1 for not assigning `null` in the declaration, so the compiler will warn you if you forget to properly initialize it before using it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26707783
score: 0

http://stackoverflow.com/comment/42146202
type: AnswerComment
has text: @KalaJ yeah my previous answer caused confusion. You keep your view as in `View view = inflater.inflate(R.layout.collection, null);`, and you give your original `RadioGroup` in your original xml file an id, and then you find that id through `ViewGroup group = view.findViewById(...);`, and then you loop and set listener on that `ViewGroup`.
comment on: http://stackoverflow.com/a/26782845
type: Comment
score: 0

http://stackoverflow.com/comment/42095413
type: AnswerComment
comment on: http://stackoverflow.com/a/26748581
type: Comment
has text: I think that the title and the description are clear. All I need is to implement that visual basic encryption in Java.
score: 0

http://stackoverflow.com/q/26696766
has body: I tried to get data from the second activity so I use startActivity method to achieve this goal. final EditText editText=(EditText)findViewById(R.id.edit); final String text=editText.getText().toString(); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(); intent.setData(Uri.parse(text); setResult(RESULT_OK,intent); finish(); } }); What confuse me is when I put the "text" in Uri.parse(),it doesn't work,so I change to Uri.parse(editText.getText().toString),it just works. So what exactly is the difference between them?
answer count: 2
has title: Why startActivityForResult() method doesn't work in this case
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26696787
favorite count: 0
has answer: http://stackoverflow.com/a/26696787
upvote count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/26696822
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26696822

http://stackoverflow.com/comment/42111699
type: AnswerComment
has text: Thanks for your reply! Sorry but I am not getting your point The parity is just the last bit which tells about even or odd number of 1's how does it play any role in this example, how did you figure out that changing that letter just changed the parity bit? I also tried some another change at odd number of place and replace the character by next character and the new key also worked.
comment on: http://stackoverflow.com/a/26743627
score: 0
type: Comment

http://stackoverflow.com/q/26684562
has answer: http://stackoverflow.com/a/26684710
downvote count: 3
has answer: http://stackoverflow.com/a/59834135
score: 990
has answer: http://stackoverflow.com/a/26684582
has answer: http://stackoverflow.com/a/46627214
type: Question
has comment: http://stackoverflow.com/comment/85324611
has answer: http://stackoverflow.com/a/34332065
has answer: http://stackoverflow.com/a/76314417
has answer: http://stackoverflow.com/a/37120688
has answer: http://stackoverflow.com/a/59105341
has comment: http://stackoverflow.com/comment/99686124
has answer: http://stackoverflow.com/a/55185129
linked to: http://stackoverflow.com/q/46288915
possible better answer: http://stackoverflow.com/a/26684582
has answer: http://stackoverflow.com/a/51278088
has answer: http://stackoverflow.com/a/49297863
has answer: http://stackoverflow.com/a/52248643
has body: In Java 8, what's the difference between Stream.map() and Stream.flatMap() methods?
has answer: http://stackoverflow.com/a/26684611
accepted answer: http://stackoverflow.com/a/26684710
has answer: http://stackoverflow.com/a/70585039
linked to: http://stackoverflow.com/q/60539486
answer count: 21
upvote count: 993
has answer: http://stackoverflow.com/a/52484577
favorite count: 0
has answer: http://stackoverflow.com/a/42447211
has answer: http://stackoverflow.com/a/44535287
has comment: http://stackoverflow.com/comment/41967341
has answer: http://stackoverflow.com/a/51360374
has comment: http://stackoverflow.com/comment/77267808
has answer: http://stackoverflow.com/a/42157396
tagged with: java-8
has title: What's the difference between map() and flatMap() methods in Java 8?
has answer: http://stackoverflow.com/a/46969926
has comment: http://stackoverflow.com/comment/77397998
has comment: http://stackoverflow.com/comment/77374110
has answer: http://stackoverflow.com/a/45310257
type: AnsweredQuestion
tagged with: java-stream
tagged with: java

http://stackoverflow.com/q/26762917
accepted answer: http://stackoverflow.com/a/26763040
has comment: http://stackoverflow.com/comment/42107157
score: 4
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-studio
tagged with: android
has answer: http://stackoverflow.com/a/26763040
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
upvote count: 4
has title: Implementing Up navigation on fragment
has body: I have a MainActivity which contains FragmentA. When I click on FragmentA, this happens: getFragmentManager().beginTransaction().replace(R.id.container,new PrefFragment()).addToBackStack("back").commit(); I have this in my manifest: &lt;activity&gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.myfirstapp.MainActivity" /&gt; &lt;/activity&gt; and this in MainActivity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_head_sound); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new FragmentA) .commit(); } getActionBar().setDisplayHomeAsUpEnabled(true); } But the Up Button navigation is always visible. FragmentB contains this code: @Override public boolean onOptionsItemSelected(MenuItem item) { int id=item.getItemId(); switch (id) { case android.R.id.home: getFragmentManager().popBackStack(); Toast.makeText(getActivity(),"CLick",Toast.LENGTH_SHORT).show(); break; } return super.onOptionsItemSelected(item); } This code doesn't run. I need to implement Up navigation only in FragmentB. How can I do that?

http://stackoverflow.com/comment/42396923
comment on: http://stackoverflow.com/a/26853384
score: 0
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64923/discussion-between-muneeb-mirza-and-jeff-bailey).
type: AnswerComment

http://stackoverflow.com/comment/42085607
type: QuestionComment
score: 8
has text: That entirely depends on what `someFunction()` returns.
type: Comment
comment on: http://stackoverflow.com/q/26750916

http://stackoverflow.com/a/26722210
answers question: http://stackoverflow.com/q/26721820
upvote count: 1
has comment: http://stackoverflow.com/comment/42034594
has comment: http://stackoverflow.com/comment/42034430
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42034750
has body: I can see that Button instances are not the same. Make sure that you get the same object in the same layout. The first 2 buttons in your code belong to layout R.layout.score_viewpager, the last one belongs to R.layout.score_collection (in MyAdapter).

http://stackoverflow.com/comment/41987816
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26696482
has text: Well, it seems to me that you want your program to do four different things. (1) Print a message that asks the user for a number. (2) Read the number from the keyboard. (3) Check whether the number is in the required range. (4) Print a message that shows the result of the check. You're doing three of those four things already, but you need to make sure that your program does them in the right order. So think carefully about what the order should be, and re-arrange some of the things that your program does. As far as the steps that you've missed, or that you're not doing correctly, ...

awt
tags question: http://stackoverflow.com/q/26738259
tags question: http://stackoverflow.com/q/26679417
tags question: http://stackoverflow.com/q/26758872
tags question: http://stackoverflow.com/q/26701424
tag name: awt
tags question: http://stackoverflow.com/q/26767833
tags question: http://stackoverflow.com/q/26808528
tags question: http://stackoverflow.com/q/26819396
tags question: http://stackoverflow.com/q/26801535
tags question: http://stackoverflow.com/q/26828462
tags question: http://stackoverflow.com/q/26807643
type: Tag
tags question: http://stackoverflow.com/q/26785277
tags question: http://stackoverflow.com/q/26707124

http://stackoverflow.com/comment/42096094
has text: Please provide the FXML and CSS you use to produce your layout.
comment on: http://stackoverflow.com/q/26756224
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26740725
has comment: http://stackoverflow.com/comment/42067544
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42068013
tagged with: java
has comment: http://stackoverflow.com/comment/42067324
has body: I have taken in a text file and converted it into a binary by writing the objects to a binary file, then i am attempting to read from the binary file, which works all the way through till the last record and then it throws the IO exception and never gets to my last print statement. Below is my code that is triggering the error try { ObjectInputStream objinputStream2 = new ObjectInputStream(new FileInputStream("binaryFile")); for (int run = 0; run&lt;count;count++) { Record readone = (Record) objinputStream2.readObject(); System.out.print(readone); System.out.println(""); } System.out.println("Reading completed for all" + count + " records. "); // objinputStream2.close(); } catch(FileNotFoundException e){ // Catches object System.out.println("Sorry File not found"); // Error Message } catch(ClassNotFoundException e){ // Catches object System.out.println("Sorry class not found"); // Error Message } catch(IOException e){ // Catches object System.out.println("Problem with file output."); // Error Message e.printStackTrace(); } any help is appreciated Stack trace: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at bluej.runtime.ExecServer$3.run(ExecServer.java:730)
possible better answer: http://stackoverflow.com/a/26741027
has comment: http://stackoverflow.com/comment/42067494
tagged with: bluej
has answer: http://stackoverflow.com/a/26741027
has title: My program keeps throwing IO exception after reading from binary file
has comment: http://stackoverflow.com/comment/42067395
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26740997
tagged with: file-io
type: Question
accepted answer: http://stackoverflow.com/a/26740997

http://stackoverflow.com/a/26819892
has comment: http://stackoverflow.com/comment/42209528
has comment: http://stackoverflow.com/comment/42210404
has comment: http://stackoverflow.com/comment/42209471
has comment: http://stackoverflow.com/comment/42210616
score: 0
answers question: http://stackoverflow.com/q/26819798
type: Answer
has comment: http://stackoverflow.com/comment/42209736
has comment: http://stackoverflow.com/comment/42210164
has comment: http://stackoverflow.com/comment/42209437
has comment: http://stackoverflow.com/comment/42209636
has comment: http://stackoverflow.com/comment/42210219
has body: An obvious way to do this would be to cycle through all ClientHandlers in clients and send the message to each of them: for (ClientHandler ch : clients){ ch.sendMessage(message); //Or something }

http://stackoverflow.com/q/26690547
has comment: http://stackoverflow.com/comment/41987297
has comment: http://stackoverflow.com/comment/41980910
has comment: http://stackoverflow.com/comment/41978181
has comment: http://stackoverflow.com/comment/41981533
has comment: http://stackoverflow.com/comment/42021842
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41980659
has comment: http://stackoverflow.com/comment/42029201
type: Question
tagged with: libgdx
tagged with: java
has title: StretchViewPort is not working properly
has comment: http://stackoverflow.com/comment/41980996
has body: I am using Virtual Viewport Size 855*540 My code is like In gamePlay Screen public void show() { gameStage=new GameStage(); //Constants.VIEWPORT_WIDTH=855; Constants.VIEWPORT_HEIGHT=540; gameStage.setViewport(new FillViewport(Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT)); hudStage=new HudStage(); hudStage.setViewport(new StretchViewport(Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT)); } public void resize(int width, int height) { Gdx.app.log("Gameplay", "in gameplay resize"); gameStage.getViewport().update(width, height, false); hudStage.getViewport().update(width, height, false); } In HUdStage public HudStage(GameStage controller) { //virtual size int width=855; int height=540; Drawable imageUpAK=new TextureRegionDrawable(atlas.findRegion("ak_IconEnable")); ImageButton topButton= new ImageButton(imageUpAK, imageUpAK); topButton.setPosition(0,height*.8f); addActor(topButton); ImageButton buttonBottom= new ImageButton(imageUpAK, imageUpAK); buttonBottom.setPosition(0,0); addActor(buttonBottom); Label resolution=new Label(Gdx.graphics.getWidth()+"x"+Gdx.graphics.getHeight(), style); resolution.setAlignment(Align.right); resolution.setPosition(0,height*.45f); addActor(resolution); } The response i get in return is shown in image on different resolution. My Question:- Am i getting desired result?if not what i am doing wrong.If right what should i do to avoid cutting of cutting elements. I want the position of hud element should be like My Virtual Scrrensize i.e (*855X580) in other scrren resolution. Thanks in advance.

http://stackoverflow.com/comment/42037503
type: AnswerComment
comment on: http://stackoverflow.com/a/26723520
has text: I'll try to explain better: ListActivity is a default android activity that contains only one ListView, and it has the method "getListView()" if you want to get a reference to it. In your activity you have buttons and other stuff so you have to create your own activity. Replace "getListView()" with "listView1" or "listView2" (I don't know what you need there).
type: Comment
score: 0

http://stackoverflow.com/q/26750272
has comment: http://stackoverflow.com/comment/78634876
has comment: http://stackoverflow.com/comment/42084622
answer count: 0
has comment: http://stackoverflow.com/comment/78678049
type: UnansweredQuestion
tagged with: android
has title: ProGuard config
has comment: http://stackoverflow.com/comment/42084816
score: 3
has comment: http://stackoverflow.com/comment/42084861
tagged with: java
tagged with: ksoap2
has body: I use ksoap2 library in my android project. When I use ProGuard to build my app, some of ksoap2 features not work any more. As you know progaurding app when it contains ksoap2 library makes some conflicts. For resolving this issue I used 3 different proguard-configs and then delete xmlpull in library but still soap objects in ksoap2 not working after proguarding. So My problem is this: "ksoap2 not work correctly after proguard" and I want :"a proguard-config or some suggestion for this issue" Here are part of codes that I used for proguard-comfig: -libraryjars libs\ksoap2-android-assembly.jar -dontwarn org.kobjects.** -dontwarn org.ksoap2.** -dontwarn org.kxml2.** -dontwarn org.xmlpull.v1.** then I add this too: -keep class org.kobjects.** { *; } -keep class org.ksoap2.** { *; } -keep class org.kxml2.** { *; } -keep class org.xmlpull.** { *; } then I add this too: -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontoptimize -dontpreverify and I try deleting xmlpull too, but still ksoap2 doesn't work correctly after proguarding app. Edit: 1- I have no error and building signed apk with using ProGuard done. 2- Every thing works correct when I run app or sign apk without proguard.
downvote count: 1
has comment: http://stackoverflow.com/comment/42084749
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42085040
has comment: http://stackoverflow.com/comment/42084724
has comment: http://stackoverflow.com/comment/42084883
has comment: http://stackoverflow.com/comment/42085341
tagged with: obfuscation
tagged with: proguard
favorite count: 0

http://stackoverflow.com/comment/42122839
score: 0
comment on: http://stackoverflow.com/q/26771364
has text: Post the exact error messages here.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26817105
has body: You should declare a max variable and initialize it with some very low value. For example Double.MIN_VALUE. Then in every iteration of the loop you could update your maximum like this: max = Math.max(max, valueYouWantToCompare); Finding the correct Java syntax is your task now :-) Good luck!
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26817047
has comment: http://stackoverflow.com/comment/42204780
answers question: http://stackoverflow.com/q/26817047
type: Answer

http://stackoverflow.com/comment/42111404
comment on: http://stackoverflow.com/a/26764997
has text: consider uploading an image of the end result
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26714060
tagged with: java
tagged with: hibernate
tagged with: eclipse
has body: I need to make some structural modifications to an existing set of Hibernate entity classes. E.g. adding new fields, removing fields, adding/changing relationships etc. My first approach was to just go in and make the changes manually in the classes. But this seems a bit of an error-prone approach when making multiple modifications - for example, a @OneToMany has a corresponding @ManyToOne relationship in a different class - if lots of updates are made it would be easy for some of these to be missed. Is there a tool I could be using to update the classes? Or, failing that, is there a tool or "strict mode" that could validate whether updates have been made in all the right places - e.g. the code still compiles and builds if a @ManyToOne is missed but it would be nice to be picked up on this.
type: Question
has comment: http://stackoverflow.com/comment/42495307
score: 0
has comment: http://stackoverflow.com/comment/42439875
tagged with: validation
type: UnansweredQuestion
tagged with: annotations
has title: How to ensure structural modifications to Hibernate entities are consistent with each other?
answer count: 0

http://stackoverflow.com/comment/41965565
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26681537
type: Comment
has text: You should provide configuration for the action, i.e. in `struts.xml`.

http://stackoverflow.com/a/26816521
upvote count: 3
has body: It's fine to start lots of threads, as long as not too many of them are alive at the same time. "Finished" threads are no longer alive, so they won't cause issues. Having said that, in Java threads are rather expensive to create (this can be different in other languages, like Erlang), and you usually don't want / don't need to create lots of threads during the course of your app's life. You may want to use a Thread Pool. This will re-use threads instead of starting a new one many times.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26816336
score: 3

http://stackoverflow.com/a/26724195
has comment: http://stackoverflow.com/comment/42037918
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26723753
answers question: http://stackoverflow.com/q/26723753
has comment: http://stackoverflow.com/comment/42038221
upvote count: 1
type: AcceptedAnswer
has body: change Class.forName("ceng.mysql.jdbc.Driver"); to Class.forName("com.mysql.jdbc.Driver"); There is a package called com.mysql.jdbc in the jar you have added and inside that a class named Driver is there.
type: Answer

http://stackoverflow.com/comment/42091726
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26754300
has text: So the use of one or of the other depends on the DBMS Driver, right? Anyway executeQuery returns a ResultSet (SELECT x FROM y), if you try to execute an update you will not have a ResultSet so an Exception is thrown
type: AnswerComment

http://stackoverflow.com/comment/42207747
comment on: http://stackoverflow.com/q/26811861
score: 0
type: QuestionComment
type: Comment
has text: this description really does not tell us enough about your success criteria. I cannot tell from your description whether your two sample lists match each other or not. Could you take some time in your description to give some sample matches and match failures and explain why they succeed or fail? Or maybe you could show us some sample code of what you have tried that didn't work?

http://stackoverflow.com/a/28042254
accepted answer of: http://stackoverflow.com/q/26674928
upvote count: 3
has comment: http://stackoverflow.com/comment/67866488
answers question: http://stackoverflow.com/q/26674928
score: 3
has body: Paros hasnt been updated for many years. You should try OWASP ZAP: https://www.owasp.org/index.php/ZAP Its a fork of Paros that is very actively maintained. Simon (ZAP Project Lead)
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26820113
has answer: http://stackoverflow.com/a/26827525
score: 0
tagged with: paypal
answer count: 1
tagged with: java
tagged with: paypal-rest-sdk
has body: When I try to update the state of a Billing Plan using the PayPal REST API on a Spring MVC based application, I encounter a ProtocolException. My stacktrace is as below: Caused by: java.net.ProtocolException: Invalid HTTP method: PATCH at java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:428) at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestMethod(HttpsURLConnectionImpl.java:374) at com.paypal.core.DefaultHttpConnection.createAndconfigureHttpConnection(DefaultHttpConnection.java:83) at com.paypal.core.rest.PayPalResource.execute(PayPalResource.java:364) How do I work around this problem? Edit: Here is my controller code: Plan createdPlan = plan.create(accessToken); //Create a Billing Plan createdPlan.setState("ACTIVE"); //Change state of created plan to 'ACTIVE' createdPlan.update(accessToken); //Call update method of com.paypal.api.payments.Plan class Plan.java PayPal REST API allows only PATCH requests for updating a Billing Plan as documented here
has comment: http://stackoverflow.com/comment/42211139
has comment: http://stackoverflow.com/comment/42222845
accepted answer: http://stackoverflow.com/a/26827525
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42211822
type: Question
has title: PayPal - Spring - Invalid HTTP method: PATCH
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/42124876
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26764859
type: AnswerComment
has text: @user3187049 as I said you can use everythung, so this is okay, you just need to take care that you use it only in the thread as a lock object

http://stackoverflow.com/comment/42152513
score: 0
type: Comment
has text: Even using array one I get the Item I've to use the new instance!! Can you make an example ?
comment on: http://stackoverflow.com/a/26787803
type: AnswerComment

http://stackoverflow.com/q/26725638
favorite count: 0
has answer: http://stackoverflow.com/a/26725700
accepted answer: http://stackoverflow.com/a/26725696
upvote count: 1
type: AnsweredQuestion
has body: Why does my code still have the warning: warning: [unchecked] unchecked cast? When I use '-Xlint', the return is as this : demo1.java:31: warning: [unchecked] unchecked cast LinkedList&lt;String&gt; queueB = (LinkedList&lt;String&gt;)(queueA.clone()); ^ required: LinkedList&lt;String&gt; found: Object 1 warning But I do not understand it. I used 'LinkedList'. could anyone give a help ? The below is my code. import java.util.LinkedList; import java.util.Iterator; public class demo1 { public static void main(String[] args) { LinkedList&lt;String&gt; queueA = new LinkedList&lt;String&gt;(); queueA.add("element 1"); queueA.add("element 2"); queueA.add("element 3"); Iterator&lt;String&gt; iterator = queueA.iterator(); while(iterator.hasNext()) { String element = iterator.next(); } for (Object object : queueA) { String element = (String) object; System.out.println("queueA: "+element); } LinkedList&lt;String&gt; queueB = (LinkedList&lt;String&gt;)(queueA.clone()); System.out.println("queueB," + queueB.remove()); } }
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26725697
has answer: http://stackoverflow.com/a/26725696
possible better answer: http://stackoverflow.com/a/26725697
answer count: 3
has title: Why does my code still have the warning: `warning: [unchecked] unchecked cast`?
downvote count: 0

http://stackoverflow.com/comment/96931917
score: 0
type: AnswerComment
has text: You could also apply the regex that is documented for the [`valueOf(String)`](https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#valueOf(java.lang.String)) method.
type: Comment
comment on: http://stackoverflow.com/a/26793096

http://stackoverflow.com/a/26820390
answers question: http://stackoverflow.com/q/26820271
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26820271
type: Answer
has comment: http://stackoverflow.com/comment/42210688
score: 1
has comment: http://stackoverflow.com/comment/42210558
has comment: http://stackoverflow.com/comment/42210732
has body: There are different ways of achieving this. Most of the communication done with the Sockets is through their In/OutputStreams. Simple way of sending a message to the socket would be: OutputStream output = clientSocket.getOutputStream(); output.write(Charset.getDefaultCharset().encode("Hello, world!")); The Charset.getDefaultCharset().encode(String) is for converting a String into a byte array, as is it not possible to send any other data than bytes over a socket easily (look up "serialization")
upvote count: 2

object
tags question: http://stackoverflow.com/q/26814578
tags question: http://stackoverflow.com/q/26692795
tag name: object
tags question: http://stackoverflow.com/q/26820094
tags question: http://stackoverflow.com/q/26781336
tags question: http://stackoverflow.com/q/26702340
tags question: http://stackoverflow.com/q/26832162
tags question: http://stackoverflow.com/q/26721441
tags question: http://stackoverflow.com/q/26741883
tags question: http://stackoverflow.com/q/26749357
tags question: http://stackoverflow.com/q/26686969
tags question: http://stackoverflow.com/q/26828257
tags question: http://stackoverflow.com/q/26793599
tags question: http://stackoverflow.com/q/26792298
tags question: http://stackoverflow.com/q/26709320
tags question: http://stackoverflow.com/q/26792879
tags question: http://stackoverflow.com/q/26826697
tags question: http://stackoverflow.com/q/26797354
tags question: http://stackoverflow.com/q/26818784
tags question: http://stackoverflow.com/q/26704260
tags question: http://stackoverflow.com/q/26755794
tags question: http://stackoverflow.com/q/26701845
tags question: http://stackoverflow.com/q/26769472
tags question: http://stackoverflow.com/q/26718548
tags question: http://stackoverflow.com/q/26789940
tags question: http://stackoverflow.com/q/26744173
tags question: http://stackoverflow.com/q/26729035
tags question: http://stackoverflow.com/q/26808050
tags question: http://stackoverflow.com/q/26814687
tags question: http://stackoverflow.com/q/26769428
tags question: http://stackoverflow.com/q/26696216
tags question: http://stackoverflow.com/q/26824672
tags question: http://stackoverflow.com/q/26787631
tags question: http://stackoverflow.com/q/26761083
tags question: http://stackoverflow.com/q/26782664
tags question: http://stackoverflow.com/q/26747952
tags question: http://stackoverflow.com/q/26821857
tags question: http://stackoverflow.com/q/26785759
tags question: http://stackoverflow.com/q/26799300
tags question: http://stackoverflow.com/q/26696711
tags question: http://stackoverflow.com/q/26684830
type: Tag
tags question: http://stackoverflow.com/q/26739560
tags question: http://stackoverflow.com/q/26707520
tags question: http://stackoverflow.com/q/26811266
tags question: http://stackoverflow.com/q/26746668
tags question: http://stackoverflow.com/q/26826220
tags question: http://stackoverflow.com/q/26822469

http://stackoverflow.com/a/26713958
answers question: http://stackoverflow.com/q/26713909
downvote count: 0
score: 1
has body: try using SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); the SimpleDateFormat look at the given string like it you tell it to, so in your example it look for a string with 2 chars for days, followed by a '/' sign and then 2 chars for month and so on
type: Answer
upvote count: 1

http://stackoverflow.com/q/26776748
has title: Java EE vs Java SE: version mismatch?
favorite count: 0
duplicate of: http://stackoverflow.com/q/2013958
has body: I've been wondering if there is a correlation between versions of Java EE working on top of Java SE. I've found this question, but the answers there are outdated and not satisfying. My question is: is there a tight coupling between EE and SE versions so that java EE 8 will only work with Java 1.8, java ee 7 will work only with java 1.7 and so on? if above is false (i.e. you can mix versions), is above the preferred way? Does it make sense to run java EE 6 on java SE 1.8 (just an example)? I know that Java EE is just a bag of specifications, but do these specifications enforce java SE version anyhow?
has comment: http://stackoverflow.com/comment/42132174
upvote count: 3
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42132293
tagged with: java
has answer: http://stackoverflow.com/a/26777128
has answer: http://stackoverflow.com/a/26777962
has comment: http://stackoverflow.com/comment/42132419
type: Question
tagged with: jakarta-ee
answer count: 2
linked to: http://stackoverflow.com/q/2013958
downvote count: 0

http://stackoverflow.com/comment/42193991
type: Comment
comment on: http://stackoverflow.com/q/26810691
has text: because your loop (`for(i=0;i<5;i++)`) is only looping the line immediately under it, which does not include the `if` statement. Do not omit the curly braces.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26779567
has comment: http://stackoverflow.com/comment/42137052
has body: I read both of this but they do not seem to work Java Spring @Scheduled tasks executing twice Spring @Scheduled is executing task twice when using annotations I do not have @Configurable class, and I do not use applicationConetxt.xml. My ScheduleTasks @EnableScheduling @Component public class ScheduledTasks { @Autowired private ApplicationContext ctx; @Scheduled(fixedRate=5000) public void monitorRoom(){ System.out.println("--------------------"); } } I can see that when I run the app in tomcat, the task prints twice evrey 5 seconds. Somebody says to remove org.springframework.web.context.ContextLoaderListener it works , but I feel this is not a solution. since this should be needed.(at least from the example from google) Here is my web.xml wodinow contextConfigLocation /WEB-INF/dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / dispatcher-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="wodinow.weixin.jaskey" /> /WEB-INF/jsp/ .jsp <mvc:resources mapping="/pages/**" location="/resources/pages/" /> <mvc:resources mapping="/images/**" location="/resources/images/" /> <mvc:annotation-driven/> </beans>
tagged with: java
upvote count: 1
has title: Spring 4 runs schedule task twice, no applicationContext.xml
answer count: 1
has answer: http://stackoverflow.com/a/26779610
linked to: http://stackoverflow.com/q/2942905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42136871
downvote count: 0
score: 1
tagged with: scheduled-tasks
accepted answer: http://stackoverflow.com/a/26779610
favorite count: 0
linked to: http://stackoverflow.com/q/14242310
type: Question
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/26690416
score: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41978528
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41977519
has comment: http://stackoverflow.com/comment/41977635
has body: how can i get an xml file from a url to a file on my desktop using java 8? i tried using the BufferedReader and StringBuilder which downloads the file on the console, is there another way of doing it so that I get the xml file on my desktop and extract the information that I need ? my code: URL url1 = new URL("http://api.eancdn.com/ean-services/rs/hotel/v3/list?cid=55505&amp;minorRev=28&amp;apiKey=m9sur8fsbdemjck7y9yydmfx&amp;locale=en_EN&amp;currencyCode=USD&amp;latitude=42.50631740000001&amp;longitude=1.5218355"); InputStream is1 = url1.openStream(); BufferedReader br1 = new BufferedReader(new InputStreamReader(is1)); StringBuilder sb = new StringBuilder(); String line; while((line=br1.readLine())!=null){ sb.append(line +"\n"); } System.out.println(sb.toString());
has comment: http://stackoverflow.com/comment/41978762
tagged with: java
has answer: http://stackoverflow.com/a/26690577
linked to: http://stackoverflow.com/q/921262
type: Question
has title: Downloading xml from website using java
answer count: 1

http://stackoverflow.com/comment/42041898
type: Comment
type: QuestionComment
has text: 11 buttons are not part of the custom number picker, they in the same view but separate from the picker. Just think of them as separate widgets (they are not widgets but I think of widgets are parts).
comment on: http://stackoverflow.com/q/26726364
score: 0

http://stackoverflow.com/q/26730501
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate
has body: I am using long sessions (conversations) spanning several web requests with Hibernate, where a global interceptor manages opening and closing Hibernate sessions. If a session crashes with a HibernateException (e.g. a ConstraintViolationException), it cannot be used any more because of danger of unpredictable behavior. So the session must be closed and discarded, and a new one opened. However in my design, session management (web request interceptor) and data access code are at different layers, so the interceptor cannot know at the end of request if a HibernateException has occurred in the middle or not. I need some way to test if the session is still valid and if it can be continued to use. Using session.isOpen() won't help: even if returns true, further calling methods on the session may cause another crash. Is there any reliable way to do that? Thanks!
type: Question
upvote count: 2
favorite count: 0
has title: How to check if Hibernate session is still valid after possible corruption
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42025494
has text: java.lang.IllegalStateException: DialogFragment can not be attached to a container view
type: AnswerComment
comment on: http://stackoverflow.com/a/26717041
score: 0
type: Comment

http://stackoverflow.com/q/26797937
favorite count: 0
has body: I have a master/slave setup running on Windows 2008 RC2. The master doesn't really do anything other than being a master. The slave I have then runs the build, which works fine for maven projects (Jenkins maven projects). If I create a free-style project I cannot run mvn.bat using a maven target. The exception is that mvn.bat cannot be resolved (path not found). Maven is installed on the slave through the master, that is, maven was pushed onto the slave through the "install maven" feature. Does anyone have an idea as to how I can resolve this? I'm using the interface for installing as I do not have access to the system through e.g. remote desktop. Thus I can upgrade/change the maven version for one or more projects, so a system property does not solve my problem on the long run.
tagged with: jenkins
has title: Unable to run mvn.bat on Jenkins with master/slave on Windows
accepted answer: http://stackoverflow.com/a/26859070
has comment: http://stackoverflow.com/comment/42179664
tagged with: maven
upvote count: 1
tagged with: master-slave
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42239556
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26859070
has comment: http://stackoverflow.com/comment/42220371
tagged with: windows

http://stackoverflow.com/q/26808193
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26808299
tagged with: jks
type: Question
linked to: http://stackoverflow.com/q/4217107
tagged with: pfx
has title: Import PFX file into Existing JKS file (NOT converting from .pfx to .jks)
linked to: http://stackoverflow.com/q/2846828
accepted answer: http://stackoverflow.com/a/26808299
downvote count: 0
answer count: 1
tagged with: keytool
favorite count: 0
has body: I have Java web service and have implemented X.509 using jks files created by Java Keytool. keytool -genkey -keyalg RSA -sigalg SHA1withRSA -validity 730 -alias myservicekey -keypass skpass -storepass sspass -keystore serviceKeystore.jks -dname "cn=localhost" keytool -genkey -keyalg RSA -sigalg SHA1withRSA -validity 730 -alias myclientkey -keypass ckpass -storepass cspass -keystore clientKeystore.jks -dname "cn=clientuser" To establish trust between client and server I import the server certs to client and client certs to server. Import server public key (certs) to client. keytool -export -rfc -keystore clientKeystore.jks -storepass cspass -alias myclientkey -file MyClient.cer keytool -import -trustcacerts -keystore serviceKeystore.jks -storepass sspass -alias myclientkey -file MyClient.cer -noprompt Import client public key(certs) to server keytool -export -rfc -keystore serviceKeystore.jks -storepass sspass -alias myservicekey -file MyService.cer keytool -import -trustcacerts -keystore clientKeystore.jks -storepass cspass -alias myservicekey -file MyService.cer -noprompt Both Service and Client are written in Java and are working fine. Now I have a .NET client and my understanding is that if I give the same jave client certificates to the .NET client i.e clientKeystore.jks it should work, but the .net client is having issues. The .NET client developer has insisted me to use a .pfx certificate that he generated, how can I import a .pfx certificate into an existing .jks file. The examples I have seen online require me to create a new .jks file. Thank you.
tagged with: x509
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/26735997
has body: I'm building a custom view, in which I override onDraw method. Is there a way to contract canvas (received as an argument in onDraw) by this view padding values? And to answer any possible questions about padding itself - In my case, I cannot use margins. I need to use paddings.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26736247
has title: How can I contract canvas by a view padding?
upvote count: 3
tagged with: android
has answer: http://stackoverflow.com/a/26736247
has answer: http://stackoverflow.com/a/26737094
downvote count: 0
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/26737094
answer count: 2
tagged with: canvas
tagged with: ondraw

web-crawler
tags question: http://stackoverflow.com/q/26804422
tags question: http://stackoverflow.com/q/26729016
tags question: http://stackoverflow.com/q/26822812
tag name: web-crawler
tags question: http://stackoverflow.com/q/26773956
type: Tag
tags question: http://stackoverflow.com/q/26745263
tags question: http://stackoverflow.com/q/26735488
tags question: http://stackoverflow.com/q/26763216

http://stackoverflow.com/q/26698494
accepted answer: http://stackoverflow.com/a/26698614
possible better answer: http://stackoverflow.com/a/29289105
favorite count: 0
has answer: http://stackoverflow.com/a/29289105
tagged with: complexity-theory
has comment: http://stackoverflow.com/comment/41991262
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41999086
tagged with: java
has comment: http://stackoverflow.com/comment/41991182
upvote count: 1
has answer: http://stackoverflow.com/a/26698614
type: Question
has answer: http://stackoverflow.com/a/26698590
has title: Calculate algorithm's complexity containing predefined methods
has comment: http://stackoverflow.com/comment/41991158
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41991156
score: -1
has comment: http://stackoverflow.com/comment/41991551
answer count: 3
has body: Having this simple Java code : import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Simple { public static void main(String[] args) { List list = new ArrayList(); list.add(5); list.add(4); list.add(3); Collections.sort(list); } } How can i calculate this algorithm's complexity without knowing the complexity of Collection.sort method ? Am i supposed to go to the java doc and search for Collection.sort source code and then calculate its complexity ? NOTE : Collection.sort is just an example of predefined methods . Thanks
has comment: http://stackoverflow.com/comment/41991140

http://stackoverflow.com/comment/100882581
has text: This only works for a single depth. `MyClass(){{ this.other = MyOtherClass() {{}}; }}` will still not work.
type: AnswerComment
comment on: http://stackoverflow.com/a/57120783
score: 0
type: Comment

http://stackoverflow.com/comment/42069244
has text: It array was initialized to 0 what if the had an element 0 as well ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26741725
type: Comment
score: 0

http://stackoverflow.com/comment/42034515
type: QuestionComment
score: 0
has text: Is there any reason you're not using the [AWS SDK for Java](http://aws.amazon.com/sdk-for-java/)?
comment on: http://stackoverflow.com/q/26719366
type: Comment

http://stackoverflow.com/comment/42150695
type: Comment
comment on: http://stackoverflow.com/a/26787073
type: AnswerComment
has text: Thank you, your solution works. Now off to figure out how to call my BankAccount class. Thanks again.
score: 0

http://stackoverflow.com/q/26750820
tagged with: java
has answer: http://stackoverflow.com/a/26750877
has comment: http://stackoverflow.com/comment/42085525
tagged with: eclipse
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42085466
tagged with: android
has body: Goodafternoon community! total beginner here. I am developing my first android app and have downloaded all what is required in running Eclipse Juno as well as files from SDK manager. But when I'm creating a new Android Application Project I encounter a couple of errors already. It says, Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. (^in red) AND... WARNING: unable to write jarlist cache file C:\Users\Nokia\thesis2\appcompat_v7\bin\jarlist.cache (^ in black) Can anyone help me. Thank you very much everyone! :-D more power to you guys!
type: UnansweredQuestion
has title: Error in Eclipse Juno

http://stackoverflow.com/a/39075289
has comment: http://stackoverflow.com/comment/66828483
has comment: http://stackoverflow.com/comment/86384734
has comment: http://stackoverflow.com/comment/66950738
has body: If what you need is given a known Bar who is its belonging Foo this would fit. Sentence will not be translated to a SQL JOIN but it is semantically equivalent. CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;Foo&gt; cq = cb.createQuery(Foo.class); Root&lt;Foo&gt; fooRoot = cq.from(Foo.class); Root&lt;Bar&gt; barRoot = cq.from(Bar.class); cq.select(fooRoot); cq.where(barRoot.in(fooRoot.get("bars")));
has comment: http://stackoverflow.com/comment/72002006
type: Answer
answers question: http://stackoverflow.com/q/26717257
score: -1
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/72076564

http://stackoverflow.com/q/26767158
has body: I have looked at this question and made it work using .configure(DeserializationConfig.Feature.USE_ANNOTATIONS, true) .configure(SerializationConfig.Feature.USE_ANNOTATIONS, true); on my custom ObjectMapper Json serialization works fine with the above configuration. But the problem is I want to use Jackson 2.x now because of better deserialization control and I cannot find any good documentation indicating how to configure jackson 2.x to ignore JAXB annotations Any help would be appreciated. UPDATE: I tried objectMapper.configure(MapperFeature.USE_ANNOTATIONS, false); but this seems to have no effect on jackson picking up JAXB annotations. Second Update: Posted the solution below as an answer.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jaxb
type: Question
upvote count: 2
answer count: 1
tagged with: jackson
favorite count: 0
has title: Configure Jackson 2.x to NOT use @XmlElement field annotation for JSON field naming
linked to: http://stackoverflow.com/q/5005668
has answer: http://stackoverflow.com/a/26783087
score: 2
accepted answer: http://stackoverflow.com/a/26783087
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/26817791
type: Answer
has body: After using appendReplacement on a StringBuffer I had to call appendTail in order to rebuild the rest of the String. Thanks to Holger for his Suggestion!
accepted answer of: http://stackoverflow.com/q/26785366
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26785366

http://stackoverflow.com/comment/42133264
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26777328
has text: No, I have to keep all files so every filename is unique.

http://stackoverflow.com/q/26830793
tagged with: foreign-keys
has answer: http://stackoverflow.com/a/26830945
accepted answer: http://stackoverflow.com/a/26830945
type: AnsweredQuestion
downvote count: 1
type: Question
score: 3
tagged with: constraints
tagged with: java
tagged with: derby
upvote count: 4
has body: I faced this problem INSERT on table 'PURCHASEDETAILS' caused a violation of foreign key constraint 'SQL141108214008671' for key (P0003). The statement has been rolled back. I can't seems to find the problem. CREATE TABLE STOCKS ( stockID VARCHAR(5) not null, stockName VARCHAR(50), stockPrice DOUBLE, stockDescrp VARCHAR(100), stockQty INTEGER, PRIMARY KEY (stockID) ); INSERT INTO STOCKS VALUES ('S0001', 'Vitamin C For Kids', 12.90, 'Vitamin C for kids under age of 8.', 100); INSERT INTO STOCKS VALUES ('S0002', 'Syntha-6 Whey Protein', 180.00,'Ultra lean muscle protein for healthy adults over 18 years old.', 100); INSERT INTO STOCKS VALUES ('S0003', 'Serious Mass', 190.00,'Extra calories that allows anyone to increase mass efficiently.', 100); INSERT INTO STOCKS VALUES ('S0004', 'Vitamin C Elite', 15.50, 'Vitamin C for everyone.', 100); CREATE TABLE PURCHASE ( purchaseID VARCHAR(5) not null, purchaseDate DATE, memberID VARCHAR(5), PRIMARY KEY (purchaseID), FOREIGN KEY (memberID) REFERENCES MEMBERS(memberID) ); INSERT INTO PURCHASE VALUES ('P0001','2014-10-23','S0001'); INSERT INTO PURCHASE VALUES ('P0002','2014-10-23','G0001'); CREATE TABLE PURCHASEDETAILS ( purchaseDetailID VARCHAR(7) not null, purchaseID VARCHAR(5), stockID VARCHAR(5), OrderQty INTEGER, PRIMARY KEY (purchaseDetailID), FOREIGN KEY (purchaseID) REFERENCES PURCHASE(purchaseID), FOREIGN KEY (stockID) REFERENCES STOCKS(stockID) ); INSERT INTO PURCHASEDETAILS VALUES ('PD00001', 'P0001', 'S0001', 4); INSERT INTO PURCHASEDETAILS VALUES ('PD00002', 'P0001', 'S0002', 10); INSERT INTO PURCHASEDETAILS VALUES ('PD00003', 'P0002', 'S0003', 5); Here's the DA part for insert record : public void insertRecord(Purchase purc){ String queryStr = "INSERT INTO "+ tableName +" VALUES (?,?,?,?)"; try{ stmt = conn.prepareStatement(queryStr); stmt.setString(1,purc.getPurchaseDetailsID()); stmt.setString(2,purc.getPurchaseID()); stmt.setString(3, purc.getStockID()); stmt.setInt(4, purc.getQuantity()); stmt.executeUpdate(); }…
answer count: 1
favorite count: 0
has title: Violation of foreign key constraint

http://stackoverflow.com/q/26732199
answer count: 2
has comment: http://stackoverflow.com/comment/42051918
has answer: http://stackoverflow.com/a/26732527
has comment: http://stackoverflow.com/comment/42058091
score: 0
has comment: http://stackoverflow.com/comment/42051584
tagged with: exception
upvote count: 1
has comment: http://stackoverflow.com/comment/42051626
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42057647
has comment: http://stackoverflow.com/comment/42061554
has body: I'm developing a Swing application that involves lots of classes and most times it works, while some times it crashes with a NullPointerException. When viewed in a console, the stacktrace does not include any of my classes. Because of this, I can't figure out where the origin of the problem is. Here is the stacktrace: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.GroupLayout$ComponentInfo.setBounds(GroupLayout.java:3657) at javax.swing.GroupLayout.layoutContainer(GroupLayout.java:928) at java.awt.Container.layout(Container.java:1508) at java.awt.Container.doLayout(Container.java:1497) at java.awt.Container.validateTree(Container.java:1693) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validateTree(Container.java:1702) at java.awt.Container.validate(Container.java:1628) at javax.swing.RepaintManager$2.run(RepaintManager.java:691) at javax.swing.RepaintManager$2.run(RepaintManager.java:689) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:688) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1679) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivil…
tagged with: java
has title: Stacktrace does not include my class. What should I do?
tagged with: stack-trace
has comment: http://stackoverflow.com/comment/42059138
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26732835

http://stackoverflow.com/q/26773892
has title: How do I make a Java program that draws lines?
tagged with: draw
score: 2
has answer: http://stackoverflow.com/a/26774222
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
has body: What I'm trying to do is make a program that creates four lines. I want it to go through a for loop and each time it loops the lines move closer to eachother. Eventually I want the lines to meet in the center of the box and form a swirl. The initial positions would start as: line[0].x = 0; line[0].y = 0; line[1].x = 0; line[1].y = boxSize; line[2].x = boxSize; line[2].y = boxSize; line[3].x = boxSize; line[3].y = 0; To find the next point I would do: line[(i+1)%4].y–line[i].y I'm having trouble with the draw function. How would I implement that into my code?
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: lines

http://stackoverflow.com/comment/41992903
type: QuestionComment
comment on: http://stackoverflow.com/q/26699543
type: Comment
score: 2
has text: What do you mean by "byte [] is too big"? Is it bigger than 2GB or too big to fit on heap? Can you split it into smaller arrays and process it one chunk at a time?

hql
tag name: hql
type: Tag
tags question: http://stackoverflow.com/q/26756069

http://stackoverflow.com/q/26681603
tagged with: tomcat
tagged with: rest
type: Question
has answer: http://stackoverflow.com/a/26682859
answer count: 1
has body: I'm writing a Java Web Application with Jersey running on Tomcat with a MySQL database. Nothing fancy so far, just a few Webpages that contain ajax calls to the backend REST web service (Jersey) which queries the database and returns the dataset to be rendered on the web page. So far so good. One of my REST methods needs to connect to another Application Server via a 3rd party API. The connection setup looks like this: ServerObject svr = new ServerObject(); svr.setHostname("192.168.1.1"); svr.setPort(21); svr.setUsername("user"); svr.setPassword("password"); try{ svr.connect() }catch(Exception e){ e.printstacktrace(); } The connect() method is very time consuming so it is not practical to establish new connections every single request. What is the best way to maintain a connection to this server via this API call? In prior applications I've built, I used the Servlet's init() method to setup these connections. I'm using Jersey this time so I don't know if I can or even should do the same thing? Any advice would be greatly appreciated!
score: 0
tagged with: java
has title: How to maintain a connection to a 3rd party API throughout my Web Application
tagged with: jersey
type: UnansweredQuestion

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/26755820

http://stackoverflow.com/comment/42153876
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26788775
has text: Java 8 introduced default methods.
type: Comment

http://stackoverflow.com/comment/41961621
type: QuestionComment
comment on: http://stackoverflow.com/q/26681220
type: Comment
has text: there could be a gazzilion reasons and I don't have the time nor capabilities to externally debug a web page, look inside `isloggedin.php` and init.js`, maybe use the developers console in Chrome or Firefox and debug stuff
score: 0

http://stackoverflow.com/q/26732452
has comment: http://stackoverflow.com/comment/107274431
has title: Maven - addjars-maven-plugin to add jars to classpath for an java project build
upvote count: 1
has comment: http://stackoverflow.com/comment/42056588
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42056936
tagged with: jar
favorite count: 0
tagged with: maven
has body: I am using addjars-maven-plugin to add all the jars present in web-inf/lib to my classpath and i am able to build my web-application and package it as war. Is there any similar way to add all the jars present in some folder to classpath, while building java classes and package it as jar? I tried the same plugin as below. But, when i try to build my project, the jars are downloaded to my local repository. But still i get class not found exception. Kindly help. Thanks in advance! com.googlecode.addjars-maven-plugin addjars-maven-plugin 1.0.2 add-jars ${project.basedir}/src/main/extlib Full pom.xml content: 4.0.0 com.xyz testlogger jar 1.0 com.googlecode.addjars-maven-plugin addjars-maven-plugin 1.0.2 add-jars ${project.basedir}/src/main/extlib I could achieve adding the jars present in any folder by using addjars-maven-plugin as above but, the only change i had to make is change the version of the plugin from 1.0.2 to 1.0.5. Thanks all for the support!!
has comment: http://stackoverflow.com/comment/42057174
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42056153
tagged with: java
has comment: http://stackoverflow.com/comment/42059813
tagged with: classpath
has answer: http://stackoverflow.com/a/54541149
type: Question
has comment: http://stackoverflow.com/comment/42056788

http://stackoverflow.com/a/78474005
has body: int x = 10, i=0, f=1, s=1, o = 1; while (x &gt; 0) { if(i!=0 &amp;&amp; i!=1){ o=f+s; f=s; s=o; } System.out.print(o); x--; i++; }
has comment: http://stackoverflow.com/comment/138353993
answers question: http://stackoverflow.com/q/26807578
score: 0
type: Answer

http://stackoverflow.com/comment/42094128
score: 0
type: AnswerComment
has text: Requirements for updatable result sets: Only specific SELECT statements- simple accesses of a single table-allow you to update or delete rows as you step through them.
type: Comment
comment on: http://stackoverflow.com/a/26754350

http://stackoverflow.com/comment/42021294
score: 0
type: Comment
type: QuestionComment
has text: and what exactly is your question?
comment on: http://stackoverflow.com/q/26708018

http://stackoverflow.com/a/26793635
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/42162409
has comment: http://stackoverflow.com/comment/42162511
has comment: http://stackoverflow.com/comment/42162315
answers question: http://stackoverflow.com/q/26793337
has comment: http://stackoverflow.com/comment/42162497
has comment: http://stackoverflow.com/comment/42162474
has body: In order to print them out in alphabetical order, you're going to need to hold all the names in a data structure (if you know how many names you're going to have, use array; if you don't know how many names you'll have, use an array list). Once you have all the files in the container, you'll have to run through them again to sort them (there are a number of ways to do this - bubble sort being the simplest. Others that might be appropriate include selection sort and quick sort). Finally, once they are all sorted, do a loop that goes through the list x times, where x is the longest amount of characters in the longest string in the list. Each time you go through the list, print out characters of a certain length.
has comment: http://stackoverflow.com/comment/42162283

http://stackoverflow.com/q/26778780
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42135740
has comment: http://stackoverflow.com/comment/42151318
answer count: 0
has comment: http://stackoverflow.com/comment/42148477
type: UnansweredQuestion
has body: I have tried below code but after update date updated in DB is without the time I passed. The time update is 00:00:00. How I can update the time also in a Oracle Date column? I have also tried to use preparedStatement.SetDate, preparedStatement.setTime also I tried datecolumn=TO_DATE('Nov 6, 2014 12:30:00 AM', 'MON DD, YYYY HH:MI:SS AM') but still the time part was lost. The date update in database is Nov 6, 2014 12:00:00 AM. Calendar startDateTime = Calendar.getInstance(); Timestamp t = new Timestamp(startDateTime.getTimeInMillis()); PreparedStatement preparedStatement = connection.prepareStatement(updateQuery); preparedStatement.setTimestamp(1, t); System.out.println("Update Date "+startDateTime.getTime().toLocaleString()); preparedStatement.executeUpdate(); Update query : update table_bpm_step_inst set wait_time=? where objid = 'abc'
type: Question
has comment: http://stackoverflow.com/comment/42138656
has comment: http://stackoverflow.com/comment/42136440
tagged with: java
has comment: http://stackoverflow.com/comment/80484947
tagged with: date
score: 0
has title: Losing time part while updating date column using JDBC . How can we preserve it?
has comment: http://stackoverflow.com/comment/42135479
tagged with: oracle-database

http://stackoverflow.com/a/26809718
score: 1
has body: The biggest bug I see is using list.length in your for loop, for(int i = 0; i &lt;list.length; i++) you have numElements. Also, I think it's i that needs to stop one before like, for(int i = 0; i &lt; numElements - 1; i++) and then for (int j = numElements; j &gt; i; j--)
answers question: http://stackoverflow.com/q/26809635
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41996402
score: 1
comment on: http://stackoverflow.com/q/26701459
type: QuestionComment
type: Comment
has text: What do you think `velocity ();` should do and why?

http://stackoverflow.com/comment/41986027
score: 0
type: Comment
type: QuestionComment
has text: Didn't you just ask this very same question not 2 hours ago?
comment on: http://stackoverflow.com/q/26695519

http://stackoverflow.com/a/27663837
answers question: http://stackoverflow.com/q/26713148
upvote count: 3
type: Answer
downvote count: 0
has body: File --> Settings --> Appearance '&amp;' Behavior --> System Settings. CLICK on System Settings, not a sub-tab, and uncheck the box that says "Reopen last project on startup." As far as separate projects are concerned you could, perhaps, make a shortcut to the IML or intellij project file in it's respective directory to your desktop and use that. This way you could link as many projects as you'd like, though passing arguments to the intellij exe is also viable it may be a bit impractical. A plugin would most likely be best to automate that process, but I don't know the technicalities so take these tips with a few grains of salt. EDIT: I also think it's worth mentioning that intellij's settings, as is the spirit of java, has pretty close to uniform and connected preferences accross platforms whether windows or linux or mac, but extending features have to be made compatable to the specific platform if it utilizes a native function (like passing parameters to an exe in windows or doing the same with an shell script in linux.)
score: 3

http://stackoverflow.com/q/26743092
tagged with: integer
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26743130
tagged with: java
has title: Java: How can I get the size of Integer(object) array?
type: Question
score: -2
has comment: http://stackoverflow.com/comment/42071914
downvote count: 3
has comment: http://stackoverflow.com/comment/42110075
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42071980
has body: I'm talking about Integer object data type, not primitive int Suppose this: Integer[] arr = new Integer[5]; arr[0] = 2; arr[1] = 2; arr[2] = 3; Then the array will look like this {2,2,3,null,null} How can I get the size of the array? In this case, the size is 5

http://stackoverflow.com/q/26765175
has answer: http://stackoverflow.com/a/27474681
accepted answer: http://stackoverflow.com/a/27474681
score: 30
possible better answer: http://stackoverflow.com/a/29926832
has comment: http://stackoverflow.com/comment/42130536
tagged with: spring
has body: I have a question that, I know, has been widely discussed about, but in my opinion, there is one aspect that still needs clarification. I am creating a web-application with a multilanguage database, I already found some good-practices articles (such as this) and answers here in stack overflow like this. So I decided to use a main table with the IDs of my items and another table with the translation for each item, let's say, for example Content ContentTranslation or Category CategoryTranslation and so on. Right now what I'm doing? I just get the items from the database with all the translations and then I iterate over each one to look for the correct translation based on the current user's local, and if I find the correct local I set into the main object that translation for the page to render, otherwise I just get the translation that is flagged as the "default" one. With large amounts of objects and translations, though, server response time might grow and even if the user might not notice, I don't want this. So, is there any good practice for this use case too? For example some specific queries that say "pick the translation with locale "it" but if you don't find it just get the one with the "default" flag set? Now for the technology I'm using Spring MVC with Hibernate and JPA (by means of JPARepository). My objects all extend a basic Translatable class that I made this way @MappedSuperclass public abstract class Translatable&lt;T extends Translation&gt; extends BaseDTO { private static final long serialVersionUID = 562001309781752460L; private String title; @OneToMany(fetch=FetchType.EAGER, orphanRemoval=true, cascade=CascadeType.ALL) private Set&lt;T&gt; translations = new HashSet&lt;T&gt;(); @Transient private T currentLocale; public void addLocale(T translation, boolean edit) { if (!edit) getTranslations().add(translation); } public void remLocale(String locale) { T tr = null; for (T candidate: getTranslations()) { if (candidate.getLocale().equals(locale)) tr …
type: AnsweredQuestion
tagged with: java
tagged with: database
type: Question
has answer: http://stackoverflow.com/a/29926832
answer count: 2
linked to: http://stackoverflow.com/q/929410
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42127234
has title: Multi language database, with default fallback
upvote count: 30
tagged with: multilingual
linked to: http://stackoverflow.com/q/39562

http://stackoverflow.com/q/26800404
has answer: http://stackoverflow.com/a/38179546
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/44373919
has body: I use macos. when i update android studio it ask move the sdk from application to other. i has move and update successfully. but now the above error come:-- Error:Could not download artifact 'com.android.tools.build:gradle:0.13.2:gradle.jar': No cached version available for offline mode. i download new android studio but it come same error without uninstall old IDE because it in some project have. please help me. this error will come in idea.log file 2014-11-07 18:47:05,746 [ 602060] INFO - TestNG Runner - Create TestNG Template Configuration 2014-11-07 18:47:05,746 [ 602060] INFO - TestNG Runner - Create TestNG Template Configuration 2014-11-07 18:47:05,756 [ 602070] INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $PROJECT_CONFIG_DIR$/dynamic.xml file is null 2014-11-07 18:47:05,770 [ 602084] INFO - ellij.project.impl.ProjectImpl - 139 project components initialized in 70 ms 2014-11-07 18:47:05,774 [ 602088] INFO - le.impl.ModuleManagerComponent - 1 module(s) loaded in 4 ms 2014-11-07 18:47:05,789 [ 602103] WARN - j.ui.mac.MacMainFrameDecorator - no url bundle present. To use platform protocol handler to open external links specify required protocols in the mac app layout section of the build file Example: args.urlSchemes = ["your-protocol"] will handle following links: your-protocol://open?file=file&amp;line=line 2014-11-07 18:47:05,995 [ 602309] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home 2014-11-07 18:47:05,996 [ 602310] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home 2014-11-07 18:47:06,026 [ 602340] INFO - .project.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [-Pandroid.injected.build.model.only=true, -Pandroid.injected.invoked.from.ide=true, --init-script, /private/var/folders/py/t8f3wlmj7694zcrwq7t661pc0000gp/T/ijinit912529939…
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/26801050
type: UnansweredQuestion
tagged with: maven
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/53730935
score: 1
has title: Error:Could not download artifact 'com.android.tools.build:gradle:0.13.2:gradle.jar': No cached version available for offline mode
tagged with: java
has answer: http://stackoverflow.com/a/76448405
tagged with: caching

multidimensional-array
tags question: http://stackoverflow.com/q/26819195
type: Tag
tags question: http://stackoverflow.com/q/26700136
tags question: http://stackoverflow.com/q/26765252
tags question: http://stackoverflow.com/q/26686095
tags question: http://stackoverflow.com/q/26765061
tags question: http://stackoverflow.com/q/26693291
tags question: http://stackoverflow.com/q/26728017
tags question: http://stackoverflow.com/q/26735291
tags question: http://stackoverflow.com/q/26748842
tags question: http://stackoverflow.com/q/26726366
tags question: http://stackoverflow.com/q/26787278
tags question: http://stackoverflow.com/q/26701154
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/26795100

http://stackoverflow.com/comment/42142479
type: QuestionComment
comment on: http://stackoverflow.com/q/26770383
has text: Did you try debug your app? Add `${pageContext.response.locale}` to your JSP page and will see, witch locale is really used.
score: 0
type: Comment

http://stackoverflow.com/comment/42168526
type: Comment
has text: As of Ehcache 2.6, all data will be present in the lowest tier, disk in this case - see [this answer](http://stackoverflow.com/a/23358936/18591)
comment on: http://stackoverflow.com/a/26779381
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41988026
comment on: http://stackoverflow.com/a/26696655
type: Comment
has text: Please read about Java **reference types** (why do you think they are called that?) on in the [Java Language Specification](http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.3) and then come back here. The Java Language Specification is the authoritative source on the Java Language.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26704981
tagged with: android-fragments
tagged with: java
score: 0
tagged with: google-maps
has answer: http://stackoverflow.com/a/26775298
accepted answer: http://stackoverflow.com/a/26775298
answer count: 1
tagged with: android
has title: android - how to inflate a map fragment in an already inflated layout?
has body: i am creating a Table Layout in my an activity, adding dynamically table rows in a loop. What i want to achieve, is to add a Google map fragment in each dynamically created Table row. This is my Table row Layout: &lt;?xml version="1.0" encoding="utf-8"&gt; &lt;TableRow xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_rowitem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="15dp"&gt; &lt;RelativeLayout android:id="@+id/inflated_row_relative" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/tv_poi_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/orange" android:textColor="#ffffff" android:text="Name" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;ImageView android:id="@+id/img_snapshot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/tv_poi_name" android:adjustViewBounds="true" android:src="@drawable/map_snapshot" /&gt; &lt;TextView android:id="@+id/tv_poi_address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Address" android:textColor="#fe8301" android:layout_below="@+id/img_snapshot" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/distance_layout" android:layout_below="@+id/tv_poi_address" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/distance_icon" /&gt; &lt;TextView android:id="@+id/tv_poi_distance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@+id/imageView1" android:text="Distance" android:paddingLeft="10dp"…
type: Question
type: AnsweredQuestion
tagged with: android-layout

http://stackoverflow.com/comment/41968683
type: Comment
has text: Canvas is my subclass of JPanel, not java.awt.Canvas!
comment on: http://stackoverflow.com/a/26683979
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42186522
comment on: http://stackoverflow.com/a/26805731
has text: I have the solution, its in the way you create your runnables. Since you subclass SimpleFrame and you create a new myRunnable those have their own textareas, you arent edditing the main windows text area. I suggest removing the extends and add the text area as an argument to the constructor of myRunnable. You can store the textarea as a field and use that. You may need to add the frame as an arg aswell if you repaint doesnt work.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26779230
has comment: http://stackoverflow.com/comment/42137591
has comment: http://stackoverflow.com/comment/42137499
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: This should be what you are lokking for: public Map&lt;String,String&gt; states(){ String state = @"SOME_STATE"; switch (this.state) { case 1: state = "STATE1"; break; case 2: state = "STATE2"; break; case 3: state = "STATE3"; break; case 4: state = "STATE4"; break; case 5: state = "STATE5"; break; case 6: state = "STATE6"; break; case -1: state = "STATE-1"; break; } Map&lt;String,String&gt; map = new HashMap&lt;String, String&gt;(); map.put("state", state); return map; }
downvote count: 0
answers question: http://stackoverflow.com/q/26779070
has comment: http://stackoverflow.com/comment/42138322
accepted answer of: http://stackoverflow.com/q/26779070
has comment: http://stackoverflow.com/comment/42138245

http://stackoverflow.com/comment/42064450
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26739313
has text: What's wrong with what you have?
type: Comment

http://stackoverflow.com/a/26703724
score: 1
has body: int k = 12; k /= --k; System.out.println(k); k *= k++; System.out.println(k); k *= ++k; System.out.println(k); The first equation is 12 / 11. --k will decrease k, and return the decreased value (which is 11). 12 / 11 is 1.09. When casted to int (happens implcitly), the decimal places are omited, and you're left with 1. The 1 gets printed to the console. The second equation is 1 * 1. k++ incremeants k, then returns the previous value (the value it was before the incremeant, so 1). 1 gets printed to the console; now you know why you have the first two 1s printing out. The final equation is 1 * 2. By now, you should know how incremeanting works. The answer is printed to the cosole. Thats why the answer is option #2
upvote count: 1
answers question: http://stackoverflow.com/q/26703604
type: Answer
downvote count: 0

http://stackoverflow.com/a/26793614
has body: I would start by implementing a custom Comparator&lt;String&gt; that compares the length(s) before comparing the String values (actually, it's a good idea to handle null as well) like static class StringLengthComp implements Comparator&lt;String&gt; { @Override public int compare(String o1, String o2) { if (o1 == null) { if (o2 != null) { return -1; } return 0; } else if (o2 == null) { return 1; } int r = Integer.valueOf(o1.length()).compareTo(o2.length()); if (r != 0) { return r; } return o1.compareTo(o2); } } Then you can store the values in a List&lt;String&gt; and use Collections.sort(List, Comparator) and then print to the file after execution. Also, I suggest you use try-with-resources like public static void main(String[] args) { try (Scanner fileInput = new Scanner(new File("names.txt")); PrintStream fileOut = new PrintStream(new File("results.txt"));) { int sum = 0; List&lt;String&gt; names = new ArrayList&lt;&gt;(); while (fileInput.hasNext()) { String name = fileInput.next(); names.add(name); while (fileInput.hasNextInt()) { sum += fileInput.nextInt(); } } Collections.sort(names, new StringLengthComp()); for (String name : names) { fileOut.println(name); } } catch (FileNotFoundException e) { e.printStackTrace(); } }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42162239
answers question: http://stackoverflow.com/q/26793337

http://stackoverflow.com/comment/42102999
comment on: http://stackoverflow.com/a/26756975
has text: That's strange. `NumberFormat.getCurrencyInstance()` produces `123.456.789,00`.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42176895
has text: public static int getDigit(int number, int i) { int negative =-1; int counter = 0; int digit = 0; if(i>numDigits(number)|| i == 0) { return negative; } while(counter < i) { digit = number % 10; number = number / 10; counter++; }
comment on: http://stackoverflow.com/q/26801623
score: 0
type: Comment
type: QuestionComment

maven-javadoc-plugin
tags question: http://stackoverflow.com/q/26787825
type: Tag
tag name: maven-javadoc-plugin

http://stackoverflow.com/q/26699511
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41993005
has body: I have a singleton class that is returning multiple instances, and I can't figure out how. It is likely that there are multiple threads calling on the singleton class, but if that is the case, I'm not sure how I can make it work properly. Here's some of the code. public class SomeClass{ private static final String TAG="someClass"; private volatile static SomeClass instance = new SomeClass(); public static synchronized SomeClass getInstance() { Log.v(TAG,"Returning instance "+instance); return instance; } private SomeClass() { //Some initialization here } @Override public String toString() { StringBuilder sb=new StringBuilder(); sb.append("this="+System.identityHashCode(this)); return sb.toString(); } } And my logs look like this: 11-02 12:50:04.494: V/someClass(12882): Returning instance this=1386326216 11-02 12:50:04.518: V/someClass(12900): Returning instance this=1384153464 I don't understand how I can have 2 instances, given how I'm setting this up. Any ideas?
answer count: 2
has comment: http://stackoverflow.com/comment/41993016
tagged with: singleton
has answer: http://stackoverflow.com/a/26699551
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: Singleton returning multiple instances
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41992939
has answer: http://stackoverflow.com/a/26699728

http://stackoverflow.com/comment/42039639
score: 0
type: Comment
has text: Thanks for the input. I still can't get this to work. The console.next(); just gives me the first token. I would really appreciate further explanations. Thanks Very Much!
type: AnswerComment
comment on: http://stackoverflow.com/a/26724780

http://stackoverflow.com/a/26829755
has body: multiplying can be done in log(B) time simliar to exponentiation if(b is odd) a+multiply(2*a,(b-1)/2) mod N else multiply(2*a,b/2) mod N this works till longvalue/2 http://en.wikipedia.org/wiki/Montgomery_reduction might be more optimum
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42230498
accepted answer of: http://stackoverflow.com/q/26829668
has comment: http://stackoverflow.com/comment/42280190
answers question: http://stackoverflow.com/q/26829668
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/42017027
comment on: http://stackoverflow.com/q/26674422
has text: As mentioned in my example, the timer executes the actionPerformed method after 5 seconds once. If you want the timer to count on every second, you need to set the interval (5000) to 1000 and call timer.setRepeats(true). Updated my answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42033972
comment on: http://stackoverflow.com/a/26709705
has text: One more change : call setCookies() only if response has cookies so that you don't loose the initial cookie.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26786354
type: Answer
has comment: http://stackoverflow.com/comment/42170242
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42232668
has body: Please don't suggest I do this to solve the problem, I can't do it that way. LOL, nobody's gonna to suggest it to you :) Custom statement should avoid updating the version: SqlUpdate update = Ebean.createSqlUpdate("UPDATE post set likes = likes+1 where id = :id"); update.setParameter("id", post.id).execute(); (tested it, works as required)
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26780275
has comment: http://stackoverflow.com/comment/42170984
answers question: http://stackoverflow.com/q/26780275

http://stackoverflow.com/comment/42021400
comment on: http://stackoverflow.com/q/26715102
has text: Google Cloud Storage has a free 5 GB quota.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26807470
downvote count: 0
answers question: http://stackoverflow.com/q/26807352
type: Answer
has comment: http://stackoverflow.com/comment/42187848
has comment: http://stackoverflow.com/comment/42187976
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42187956
has body: Just keep (re)selecting a second value until it doesn't agree with the first one. int rn1 = boarduser[new Random().nextInt(boarduser.length)]; System.out.println("Computer's Value: " + rn1); int rn2 = boarduser[new Random().nextInt(boarduser.length)]; while(rn2 == rn1) { rn2 = boarduser[new Random().nextInt(boarduser.length)]; } System.out.println("Computer's Value: " + rn2);
accepted answer of: http://stackoverflow.com/q/26807352
type: AcceptedAnswer

http://stackoverflow.com/comment/42091324
type: Comment
type: QuestionComment
has text: Thread.sleep(50); Im assuming thats the problem as it freezes. I will make post more clear.
comment on: http://stackoverflow.com/q/26754146
score: 0

http://stackoverflow.com/q/26715739
tagged with: java
tagged with: accountmanager
type: Question
has body: I've been trying to add a custom account to my app so I can manage the authToken to my server better, but I'm confused as to initialise eveything properly. I've created the Authentication Activity that allows the user to log in, the Authenticator and the service, but I'm not sure how to go about handling the first time the app is opened. The Authenticator will display the AuthActivty when it doesn't have the users account details, but in the case where the app is opened the first time, the account type doesnt exist in the phone, so I'm unable to call the getAuthToken method in the Authenticator. Should I check if the account type exists and manually start the LoginAcivity from my MainActivty or am I missing something?
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/26715839
accepted answer: http://stackoverflow.com/a/26715839
has title: Adding a custom account using Android's AccountManager
type: AnsweredQuestion

http://stackoverflow.com/q/26734229
type: Question
accepted answer: http://stackoverflow.com/a/26734667
has body: I am trying to change the appearance of a button on click, like a toggle. when I click on it i want its text and color to change but its text just disappears. here is my code for the btn when its clicked: public void ToggleBuffer(View view) { if(this.toggleBufferIsActive){ this.btn.setText("Start Buffer"); this.btn.setTextColor(0x0000CD); this.btn.invalidate(); this.toggleBufferIsActive = false; } else{ this.btn.getBackground().setColorFilter(0xFFBBAA00, PorterDuff.Mode.MULTIPLY); this.btn.setText("Stop Buffer"); this.btn.setTextColor(0xff0000); this.btn.invalidate(); this.toggleBufferIsActive = true; } } can anyone tell me what im doing wrong here? many thanks in advance
has answer: http://stackoverflow.com/a/26734355
score: 0
answer count: 2
tagged with: button
possible better answer: http://stackoverflow.com/a/26734355
tagged with: android
has answer: http://stackoverflow.com/a/26734667
tagged with: android-activity
type: AnsweredQuestion
has title: change the apperance of a button on click in Android Activity
tagged with: java

http://stackoverflow.com/a/26743838
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26743519
has body: Declare a variable in your class body, int counter = 0; //In your button click event counter = counter + 1; if((counter &gt; 0) &amp;&amp; (counter &lt; 3){ // your program logic comes here } if(counter &gt;= 3){ button.setEnabled = false; Toast.makeText(activityname,"Restart the game", TOAST.LENGTH_LONG).show(); }

http://stackoverflow.com/comment/41986060
comment on: http://stackoverflow.com/q/26695519
has text: @HovercraftFullOfEels : Same question was asked, except there was no code with it (originally)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41986242
comment on: http://stackoverflow.com/a/26695634
type: Comment
has text: How is this better than the original poster's code?
score: 3
type: AnswerComment

http://stackoverflow.com/q/26703178
score: 1
tagged with: java
tagged with: eclipse
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42003772
favorite count: 0
tagged with: android
has body: I am having a new error when I am building an android version of my game, This build fail has only been happening after my recent upgrade to Unity 4.5.5f1 from 4.3.something. I see many other people had similar issues to this before and I have already tried these solutions with no success. Copying/cutting zipalign.exe from build-tools to tools. Setting JAVA_HOME to C:Program Files(x86)Javajre7 and to C:Program -Files(x86)Javajre1.8.0_25bin (JAVA_HOME was not originally there I had to create this) Updating/reinstall both 32/64 bit Java Deleting and reinstalling my SDK Updating SDK to only API 21 Updating SDK to only API 20 copying Java.exe from Windows/SysWOW64 to Windows/System 32 Uninstall all versions of Java and Java SE Dev Kit from control Panel, deleted all SDK and Eclipse from c: and completed a new install of 64 bit eclipse adt bundle and Java 32 and 64 bit. So I am currently running Windows 7 (64 Bit) Service Pack 1 - Unity 4.5.5f1. ADT bundle for 64 bit with API 21, Java for both 64 bit and 32 bit (java 1.8 v 25), I deleted JAVA_HOME setting as it wasn't there previously and am still getting the following error: Error building Player: Win32Exception: ApplicationName='C:Program Files (x86)Javajre1.8.0_25binjavac.exe', CommandLine='-bootclasspath "C:/adt-bundle-windows-x86_64-20140702/sdk/platforms/android-21android.jar" -d "C:UsersShawnDocumentsSimonGameTempStagingAreabinclasses" -source 1.6 -target 1.6 -encoding UTF-8 "comfacebookandroidManifest.java" "comfacebookandroidR.java" "comtwocogmimicManifest.java" "comtwocogmimicR.java"', CurrentDirectory='C:UsersShawnDocumentsSimonGameTempStagingAreagen' Any help would be greatly appreciated! Thank you, UPDATE / EDIT: I pushed JAVA_HOME to my JDK folder C:\Program Files\Java\jdk1.8.0_25\bin and now am getting a new (but very similar) error. Error building Player: Win32Exception: ApplicationName='javac.exe', CommandLine='-bootclasspath "C:/adt-bundle-windows-x86_64-20140702/sdk/platforms/android-21\android.jar" -d…
tagged with: unity-game-engine
type: UnansweredQuestion
upvote count: 1
has title: Unity3D - Error building Player: Win32Exception:
has answer: http://stackoverflow.com/a/26724362
type: Question

http://stackoverflow.com/q/26746435
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26746604
accepted answer: http://stackoverflow.com/a/26746604
has comment: http://stackoverflow.com/comment/42078347
has comment: http://stackoverflow.com/comment/42078429
has comment: http://stackoverflow.com/comment/42078396
has title: Can't get text from a JTextField via Anonymous class
tagged with: swing
has comment: http://stackoverflow.com/comment/42078237
type: AnsweredQuestion
tagged with: java
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/42078264
type: Question
score: -2
has body: Basically, this is what needs to happen: Submit button is clicked, the actionlistener picks it up and prints what is in the textfield at the time of submission. For some reason, it isn't picking up the text inside the textbox? The "Submit Button Pressed" is getting printed by the way! This is a silly problem but I am not used to anonymous classes. I believe the problem is the variable modifier. Here is my code simplified: public class MainWindw extends JFrame { public static JTextField txt1; final JButton submit; public MainWindw() { //add panel...add textfield etc.. txt1 = new JTextField(); submit = new JButton("Submit"); submit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println("Submit button pressed" + txt1.getText());} } }); } }
has comment: http://stackoverflow.com/comment/42078187
has comment: http://stackoverflow.com/comment/42078287
downvote count: 3

http://stackoverflow.com/a/26733335
type: Answer
accepted answer of: http://stackoverflow.com/q/26731044
has body: You can't configure the JDK used specifically for the Findbugs task, but you can configure gradle to use a specific jvm in general by setting a property in your gradle.properties file: org.gradle.java.home Not that this java will be used for the whole gradle process and not just for Findbugs, but it does not require to change your environment variables.
has comment: http://stackoverflow.com/comment/42071060
type: AcceptedAnswer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42075769
has comment: http://stackoverflow.com/comment/42072062
answers question: http://stackoverflow.com/q/26731044
upvote count: 2

http://stackoverflow.com/q/26689550
has answer: http://stackoverflow.com/a/26690878
accepted answer: http://stackoverflow.com/a/26690878
score: 0
upvote count: 1
has title: illegalStateException on nested lock
answer count: 1
downvote count: 1
favorite count: 0
has body: i' m getting this exception but i don't understand why. public Test() { globalLock = new ReentrantLock(); condition = globalLock.newCondition(); } public void increaseRow(Integer row) { matrixLock.lock(); try { while (countIncreasingColumn &gt; 0) condition.await(); countIncreasingRow++; } catch (InterruptedException e) { e.printStackTrace(); } finally { condition.notifyAll(); matrixLock.unlock(); synchronized (rows.get(row)) { for (int j = 0; j &lt; column; j++) matrix[row][j] += 1; countIncreasingRow--; } } } thread class: public void run() { while (true) { test.function(new Random().nextInt(10)); } } stackTrace: Exception in thread "Thread-0" waiting thread for test 18 java.lang.IllegalMonitorStateException at java.lang.Object.notifyAll(Native Method) i' m getting thie exception on notifyAll(). The thread that execute the global.lock() block is the owner,so why i'm getting this?
has comment: http://stackoverflow.com/comment/41976143
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41976154
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18209552
tagged with: java
type: Question

http://stackoverflow.com/q/26803322
has answer: http://stackoverflow.com/a/26865429
has comment: http://stackoverflow.com/comment/42202922
has title: jpa2 db reverse engineering with bean validation annotations
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has body: I'm trying to generate JPA java classes from existing Oracle database. Generated classes contain JPA annotations like @Column(nullable=false, length=40). Is there any open source tool that would generate Java Bean Validation annotations as well (@NotNull @Size(max=40) in this case)?
tagged with: bean-validation
answer count: 1
tagged with: jpa-2.0

http://stackoverflow.com/a/26791504
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26754302
has body: Done with this tutorial : Example: Communication between Activity and Service using Messaging now user can go surf the net, or answere a call or whatever . . . the track and sending sms's are working in the background , when user comes back he see the changes online .
answers question: http://stackoverflow.com/q/26754302
type: AcceptedAnswer

http://stackoverflow.com/q/26817884
upvote count: 6
accepted answer: http://stackoverflow.com/a/28893071
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: netbeans-plugins
has body: Here a error getting from diagnostic throught javaCompiler taska: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.netbeans.modules.openide.modules.PatchedPublicProcessor not a subtype I trying to dynamic comppile a simple java class from file, using JavaCompiler. This class looks like: package web.others; public class User { } My Project is Maven Project Type as you can see the class conatins nothing special. One thing what i need it is geting a Class object from this class. But at runtime. I would like to compile dynamic this class and get Class object. Problem is that I working on Netbeans Plaform and i want do that in this IDE (i develop a simple plugin) To compile and run im using a following code: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); Iterable<? extends JavaFileObject> compilationUnits = Arrays.asList(file); JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null,null,compilationUnits); boolean success = task.call(); try { fileManager.close(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } System.out.println("Success: " + success); if (!success) { List<Diagnostic<? extends JavaFileObject>> dia = diagnostics.getDiagnostics(); System.out.println("Diagnostic: " + dia); } And always i getting a following error from diagnostics: error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.netbeans.modules.openide.modules.PatchedPublicProcessor not a subtype Anybody can help with this issue i will be a greatful for help! UPDATE: here my pom.xml: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany mavenproject2 1.0-SNAPSHOT nbm …
answer count: 1
has title: Netbeans and Bad service configuration file, or exception thrown while constructing Processor object
tagged with: netbeans-platform
downvote count: 0
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/43008707
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/28893071
has comment: http://stackoverflow.com/comment/42485103
score: 6
has comment: http://stackoverflow.com/comment/42484231

http://stackoverflow.com/comment/42179814
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26770041
has text: It's a perfect example of a legacy system (your command line java program) which needs to be accessed via a modern frontend (your web application). So for the proposed Java EE JSF application, you'd build a view containing the command (e.g. a button) and showing the result (e.g. a text area) and a related handler class (CDI component), which uses the logic within the JAR without going via files system, but directly providing any needed parameters, receiving the result and showing it in the view. In case it's long-running do it asynchronously and poll for the result or push it via web socket.

http://stackoverflow.com/comment/41986904
score: 0
comment on: http://stackoverflow.com/q/26695491
type: Comment
type: QuestionComment
has text: Thanks for confirming that how I think it should work is how it SHOULD work - clearly there's something going on outside of this which I'm not seeing (for one thing, the person who wrote this likes overriding getter methods which scares me and may be the source of my issues - certainly Eclipse hates it!) I'm going to vote to close the question for now I think - I can't see others getting anything from it as it's asking a question which shouldn't be a question? Tomorrow I will start anew perhaps - thanks again!

http://stackoverflow.com/q/26734013
upvote count: 0
linked to: http://stackoverflow.com/q/17689529
has answer: http://stackoverflow.com/a/26734608
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42054725
linked to: http://stackoverflow.com/q/4201860
tagged with: loops
type: Question
tagged with: java
has title: calculating the gcd and lcm of 5 numbers
downvote count: 2
score: -2
answer count: 1
tagged with: greatest-common-divisor
has comment: http://stackoverflow.com/comment/42054738
favorite count: 0
has body: how can i calculate the GCD and LCM of 5 numbers using a loop that i should create?? this is what i started doing but i think i started in wrong way from the beginning can anyone help public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int nbr1=input.nextInt(); int nbr2=input.nextInt(); int nbr3=input.nextInt(); int nbr4=input.nextInt(); int nbr5=input.nextInt(); for(int i=nbr1;(i%nbr2==0 || i%nbr3==0 ||i%nbr3||i%nbr4==0 || i%nbr5==0 ;i++) { } } }
tagged with: lcm

http://stackoverflow.com/q/26767833
tagged with: java
type: UnansweredQuestion
has body: I am trying to build a simple paint using Shape java build-in, How can I remove/delete the shape (for example a circle) from the JFrame? import java.awt.Shape; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; import java.awt.Polygon; import java.util.List; public class Delete extends DrawingPanel { List&lt;ShapeItem&gt; shape; public Delete(List&lt;ShapeItem&gt; shape){ this.shape = shape; } public void deleteShape(){ for(ShapeItem s : shape){ if(s.getShape() instanceof Line2D){ s.setColor(getBackground()); } if(s.getShape() instanceof Ellipse2D){ s.setColor(getBackground()); } if(s.getShape() instanceof Rectangle2D){ s.setColor(getBackground()); } if(s.getShape() instanceof Polygon ){ s.setColor(getBackground()); } } } } Is this way is valid?
has comment: http://stackoverflow.com/comment/42116788
answer count: 0
tagged with: awt
type: Question
tagged with: graphics2d
tagged with: shapes
has title: Removing drawn shape object
has comment: http://stackoverflow.com/comment/42116741
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/42116739
has comment: http://stackoverflow.com/comment/42121034

http://stackoverflow.com/q/26758300
has answer: http://stackoverflow.com/a/26759494
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42098702
tagged with: multiplication
has comment: http://stackoverflow.com/comment/42098501
has comment: http://stackoverflow.com/comment/42102742
has title: Time Complexity of Efficient way to find power of a number
has body: I have written a small piece of code to find the power of a number Can any one tell me how to find the time complexity of this code. and what is the time complexity of this code. and is it a efficient way to find powers of a number the code is : public static void main(String[] args) { System.out.println(optPower(7, 15)); } static int optPower(int x, int y) { // divide in buckets if (y == 0) { return 1; } if (y == 1) { return x; } if (y == 2) return x * x; int tmpY; boolean isYmodified = false; if (y % 2 == 0) { tmpY = y; } else { tmpY = y - 1; isYmodified = true; } int biggestBucket = 2; int n = biggestBucket; /* * tmpY/4 , here '4' can be used as a tweking parameter to size the * buckets */ while (tmpY % n == 0 &amp;&amp; tmpY / 4 &gt;= n) { biggestBucket = n; n = n * 2; } int res = 1; for (int i = 0; i &lt; biggestBucket; i++) { res = res * x; } int mul = res; for (int j = 1; j &lt; tmpY / biggestBucket; j++) { mul = mul * res; } return isYmodified ? mul * x : mul; } As requested, I have added more notes for clearer explanation of the algorithm. if I want to compute 5 raise to 16 step 1:- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 here x=5, y=16 in the above method if y is odd we multiple an extra x in the final result and assign tmpY as y-1 to make it even so noOfBuckets = 4 because of below code while (tmpY % n == 0 ) { biggestBucket = n; n = n * 2; } that is 16/(2 raise to 2) step 2:- divide 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 into 4 buckets bucket1 :- 5,5,5,5 bucket2 :- 5,5,5,5 bucket3 :- 5,5,5,5 bucket4 :- 5,5,5,5 step 3:- compute bucket 1 only and use the result of this bucket for remaining buckets result of bucket 1 = 625 = 5*5*5*5 step 4 :-enter code here final result is bucket1*bucket1*bucket1*bucket1 i.e 625 * 625 * 625 * 625 i.e. 5 raise to 16 then we are avoiding iterations in bucket 2,3,4 and directly using the value from bucket 1 to get to the final result.
possible better answer: http://stackoverflow.com/a/26758935
linked to: http://stackoverflow.com/q/11032015
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42101998
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42099031
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/26759494
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42098485
has comment: http://stackoverflow.com/comment/42099648
has comment: http://stackoverflow.com/comment/42099501
has answer: http://stackoverflow.com/a/26758935
has comment: http://stackoverflow.com/comment/42109347

http://stackoverflow.com/a/40217359
has comment: http://stackoverflow.com/comment/77769667
has body: try this public void enableActionBarHomeButton(AppCompatActivity appCompatActivity, int colorId){ final Drawable upArrow = ContextCompat.getDrawable(appCompatActivity, R.drawable.abc_ic_ab_back_material); upArrow.setColorFilter(ContextCompat.getColor(appCompatActivity, colorId), PorterDuff.Mode.SRC_ATOP); android.support.v7.app.ActionBar mActionBar = appCompatActivity.getSupportActionBar(); mActionBar.setHomeAsUpIndicator(upArrow); mActionBar.setHomeButtonEnabled(true); mActionBar.setDisplayHomeAsUpEnabled(true); } function call: enableActionBarHomeButton(this, R.color.white);
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26788464
downvote count: 0

http://stackoverflow.com/a/26796201
has body: Change this: for (int i=0; i&lt;value.length; i+=3) { i = i + 1; System.out.println(i); } To This: for (int i=1,j=3; i&lt;value.length; i+=j,j+=2) { System.out.println(i); } Of course, you can run a standard loop and print i*i, but I suppose you wanted to do it differently. By the way, you may as well get rid of that value array, and use 20 instead of value.length.
has comment: http://stackoverflow.com/comment/42166573
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42166653
has comment: http://stackoverflow.com/comment/42168886
has comment: http://stackoverflow.com/comment/42166767
has comment: http://stackoverflow.com/comment/42166537
has comment: http://stackoverflow.com/comment/42166832
answers question: http://stackoverflow.com/q/26796138
has comment: http://stackoverflow.com/comment/42166711
downvote count: 0
has comment: http://stackoverflow.com/comment/42166651

http://stackoverflow.com/a/26714590
type: Answer
has comment: http://stackoverflow.com/comment/42019958
has comment: http://stackoverflow.com/comment/42020173
answers question: http://stackoverflow.com/q/26714445
score: 1
has comment: http://stackoverflow.com/comment/42020249
upvote count: 2
has body: It depends on how accurate you want to be. If you want 100% you have to compile it. If you would be happy with something low you can check printable characters. Reasonable level may be achieved by key work check. And so on...
has comment: http://stackoverflow.com/comment/42019573
downvote count: 1
has comment: http://stackoverflow.com/comment/42019848

http://stackoverflow.com/comment/101407573
comment on: http://stackoverflow.com/a/47381903
type: AnswerComment
type: Comment
has text: With 2.9, I couldn't replicate with the `toString` override, I had to do this: ```private static class WillNotSerialize { public WillNotSerialize getSelf() { return this; } } ```
score: 1

hashset
tags question: http://stackoverflow.com/q/26790427
tags question: http://stackoverflow.com/q/26820899
tags question: http://stackoverflow.com/q/26704376
tags question: http://stackoverflow.com/q/26780699
tags question: http://stackoverflow.com/q/26778668
tags question: http://stackoverflow.com/q/26716740
type: Tag
tags question: http://stackoverflow.com/q/26750496
tag name: hashset

http://stackoverflow.com/q/26708481
tagged with: java
tagged with: javafx
has title: Java Runtime Exception. Java FX
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/11111645
tagged with: exception
has body: I have tried to learn Java FX so I used some of the Oracle Eample Code but when I tried to run it in Netbean IDE, It gives me a Runtime Error. Here is a Piece of code : public class WebViewTestOne { private Scene scene; @Override public void start(Stage stage) { stage.setTitle("Web View"); scene = new Scene(new Browser(),750,500, Color.web("#666970")); stage.setScene(scene); scene.getStylesheets().add("webviewsample/BrowserToolbar.css"); stage.show(); } public static void main(String[] args){ launch(args); } } and this is the Exception. Exception in thread "main" java.lang.RuntimeException: Error: class webviewtest.one.WebViewTestOne is not a subclass of javafx.application.Application at javafx.application.Application.launch(Application.java:254) at webviewtest.one.WebViewTestOne.main(WebViewTestOne.java:33) Java Result: 1 So what is wrong? I mean since this is an Example from the official Site, why even there is an error? ( the error happens at the launch(args) EDIT: Ok based on the Answer by rob I added the Extension that I missed from the example, Now it gives even much more exception after I tried to extend the code. below is the new Code and the Log for the exception. package webviewtest.one; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.ListChangeListener.Change; import javafx.concurrent.Worker.State; import javafx.event.ActionEvent; import javafx.event.Event; import javafx.event.EventHandler; import javafx.geometry.HPos; import javafx.geometry.Pos; import javafx.geometry.VPos; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Hyperlink; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Pr…
has answer: http://stackoverflow.com/a/26708554
type: UnansweredQuestion
score: 0

http://stackoverflow.com/a/26780798
answers question: http://stackoverflow.com/q/26768947
type: Answer
score: 2
upvote count: 2
has body: I'll accept your invitation for new ideas and put on the table my methodology of approaching similar cases. Clearly the problem is mostly about the communication between back-end and javascript data. The data that the javascript function needs as an argument in this case. Since html5's introduction of data attributes and the improved jQuery's efficiency with them in late versions, you may expose whatever back end data you want as attributes starting with "data-". This is valid according to html5. In jQuery you can access them as if they were jQuery data by translating the html naming convention to camelCase after reducing the initial "data-" pefix. (e.g. data-my-attribute = myAttribute). You can either access them in the original html convention (e.g. my-attribute). Its a matter of preference. Then your html can be much cleaner: &lt;td th:each="optionValue,iterStat : ${someObject.optionValues}"&gt; &lt;button class="btn btn-default" th:id="${'optionBtn_' + (iterStat.count - 1)}" th:text="${optionValue.toString()}" th:attr="data-my-func-attr=${optionValue}"/&gt; &lt;/td&gt; You can bind your event handlers then as: $("button.btn").on("click", function() { buttonPressed($(this).data("my-func-attr")) } or similar. This way you also keep your code cleaner and separate from the markup which is one principle of Unobtrusive JS
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26768947

http://stackoverflow.com/q/26709202
has comment: http://stackoverflow.com/comment/42123660
tagged with: java
tagged with: mysql
has title: Tomcat MySQL Server with OAuth 2.0
linked to: http://stackoverflow.com/q/1833184
type: Question
has comment: http://stackoverflow.com/comment/42010333
tagged with: tomcat
score: 0
answer count: 0
tagged with: oauth
type: UnansweredQuestion
has body: I am trying to implement a MySQL database that is accessible via REST APIs. In order to do so, I am running a dynamic web project within a Tomcat 8.0 Server. However, now I am looking to implement some form of authentication that has to happen before a client (i.e. an Android app) can have access to the APIs. I have been reading up on OAuth 2.0, and it does appear to be what I am looking for. Based on the article that I have been reading (http://tutorials.jenkov.com/oauth2/authorization.html), it appears that a separate OAuth server has to be running. The question is, how can this be done? I am currently using Eclipse to compile and start my local Tomcat server. Do I have to create a separate server in Eclipse? Once the permission has been granted, does the client need to interact with the OAuth server in order to access the database data or does it interact with the Tomcat server that I am running?

http://stackoverflow.com/q/26731616
possible better answer: http://stackoverflow.com/a/26741884
has body: I try to retrive id after insert in Spring but this solution not work: String sqlquery2 = "INSERT into tab (attr1,attr2) VALUES (?,?)"; String sql1 ="select last_insert_id()"; jdbcTemplateObject.update(sqlquery2, value1, value2); int id = jdbcTemplateObject.update(sql1);
upvote count: 1
tagged with: jdbctemplate
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42051378
answer count: 2
has answer: http://stackoverflow.com/a/26741884
tagged with: sql
downvote count: 0
accepted answer: http://stackoverflow.com/a/26731881
favorite count: 0
has title: Get id after insert in Spring
has answer: http://stackoverflow.com/a/26731881
tagged with: spring
linked to: http://stackoverflow.com/q/19095994
type: AnsweredQuestion

http://stackoverflow.com/q/26731663
score: -2
has answer: http://stackoverflow.com/a/26731784
tagged with: android
favorite count: 0
has title: java lang runtime exception :unable start activity component info
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42050825
has answer: http://stackoverflow.com/a/26731701
tagged with: java
has body: hi sir I got this error when my app was launched. When I run my project unfortunately project was stop. This error is coming my log cat. When click on app unfortunately app was stop msg came. I put one text view on activity_xml. When click on navigate to another page but here do not display my first page. There is problem to on mainactivity.java and activity main.xml error is java.lang.runtime Exception: Unable to start activity component Info{com.example.b/com.example.b.MainActivity}: java. Lang.NullPointerException **mainactivity.java** andheri = (TextView) findViewById(R.id.Andheri1); andheri.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Context context = null; // TODO Auto-generated method stub Intent intent = new Intent(context,andheri.class); startActivity(intent); } }); **activity_xml** <TextView android:id="@+id/Andher1" android:layout_width="80dp" android:layout_height="20dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="#FFE4B5" android:capitalize="characters" android:gravity="center" android:text="Andheri" android:textColor="#000000" android:textColorHint="#0000CD" android:textSize="15dp" android:textStyle="bold" /> **mainifest file.** <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
type: Question
answer count: 2
downvote count: 2

http://stackoverflow.com/comment/42116312
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26743299
score: 0
has text: @DaveSyer "What doesn't work": At the moment, I can't even get an alternative main class to run. If I attempt to run the alternative main via the "-cp" flag route, I get error messages like: https://gist.github.com/anonymous/468529d4c36934aef1c6

spring-test
tags question: http://stackoverflow.com/q/26747076
tag name: spring-test
type: Tag
tags question: http://stackoverflow.com/q/26777207

http://stackoverflow.com/comment/42067293
type: AnswerComment
has text: Thanks all, Currently I prefer two preparedstatements and decide dynamically which one use..
comment on: http://stackoverflow.com/a/26736367
type: Comment
score: 0

http://stackoverflow.com/comment/42198820
comment on: http://stackoverflow.com/q/26813420
type: QuestionComment
has text: still i don't understand your point. A single example wouldn't be enough, so post some more along with the expected output.
score: 0
type: Comment

changelistener
tags question: http://stackoverflow.com/q/26730034
tag name: changelistener
type: Tag

http://stackoverflow.com/a/26838867
has comment: http://stackoverflow.com/comment/42243419
answers question: http://stackoverflow.com/q/26823484
upvote count: 5
has comment: http://stackoverflow.com/comment/42243661
type: Answer
has comment: http://stackoverflow.com/comment/42243568
has comment: http://stackoverflow.com/comment/42243052
downvote count: 0
score: 5
has body: Java 5 and 6 If you are stuck running your program on Java 5 or 6 JVM, and you want to match characters in the range from U+1F601 to U+1F64F, use surrogate pairs in the character class: Pattern emoticons = Pattern.compile("[\uD83D\uDE01-\uD83D\uDE4F]"); This method is valid even in Java 7 and above, since in Sun/Oracle's implementation, if you decompile Pattern.compile() method, the String containing the pattern is converted into an array of code points before compilation. Java 7 and above You can use the construct \x{...} in David Wallace's answer, which is available from Java 7. Or alternatively, you can also specify the whole Emoticons Unicode block, which spans from code point U+1F600 (instead of U+1F601) to U+1F64F. Pattern emoticons = Pattern.compile("\\p{InEmoticons}"); Since Emoticons block support is added in Java 7, this method is also only valid from Java 7. Although the other methods are preferred, you can specify supplemental characters by specifying the escape in the regex. While there is no reason to do this in the source code, this change in Java 7 corrects the behavior in applications where regex is used for searching, and directly pasting the character is not possible. Pattern emoticons = Pattern.compile("[\\uD83D\\uDE01-\\uD83D\\uDE4F]"); /!\ Warning Never ever mix the syntax together when you specify a supplemental code point, like: "[\\uD83D\uDE01-\\uD83D\\uDE4F]" "[\uD83D\\uDE01-\\uD83D\\uDE4F]" Those will specify to match the code point U+D83D and the range from code point U+DE01 to code point U+1F64F in Oracle's implementation. Note In Java 5 and 6, Oracle's implementation, the implementation of Pattern.u() doesn't collapse valid regex-escaped surrogate pairs "\\uD83D\\uDE01". As the result, the pattern is interpreted as 2 lone surrogates, which will fail to match anything.

http://stackoverflow.com/q/26826769
tagged with: encryption
score: -3
has comment: http://stackoverflow.com/comment/42221779
tagged with: php
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26827491
type: Question
tagged with: encoding
upvote count: 0
favorite count: 0
has title: Encrypt / Decrypt - Encode / Decode PHP Equvilent to JAVA
answer count: 1
has body: Can anyone explain the PHP code and give me hints on how to port the code in Java? Here is the PHP code: function decode_string($encoded_string, $key) { $decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encoded_string), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); return $decoded; }
type: UnansweredQuestion

http://stackoverflow.com/comment/42128314
type: AnswerComment
comment on: http://stackoverflow.com/a/26774541
score: 0
has text: In that case you would just use a different function definition within the map closure...one which alters depending on the passed in index...
type: Comment

http://stackoverflow.com/q/26793067
type: Question
has title: Gif not showing up in JFrame
tagged with: http://stackoverflow.com/tag/gif
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42161608
has comment: http://stackoverflow.com/comment/42161473
has comment: http://stackoverflow.com/comment/42162748
tagged with: imageicon
linked to: http://stackoverflow.com/q/9864267
favorite count: 0
type: UnansweredQuestion
tagged with: embedded-resource
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26794368
score: 1
tagged with: java
has body: I'm trying to get a gif to appear on one of my JFrame and the program compiles but doesn't show the gif I want it to show. Is it a matter of where I have the gif stored on my computer? import javax.swing.*; import java.awt.*; import java.util.*; public class iWorkoutScreen { public void iWorkoutScreen() { String calories = "this many"; this.setBackground(Color.WHITE); this.setLayout(new BorderLayout()); this.setPreferredSize(new Dimension(800, 400)); this.pack(); JButton button = new JButton("Press to Start Workout"); this.add(button, BorderLayout.PAGE_START); JLabel timer = new JLabel("this timer will be better"); timer.setPreferredSize(new Dimension(400, 10)); ImageIcon timerIcon = new ImageIcon("7TaK4G8TA.gif"); timer.setIcon(timerIcon); this.add(timer, BorderLayout.CENTER); button = new JButton("Button 3 (LINE_START)"); this.add(button, BorderLayout.LINE_START); button = new JButton("Long-Named Button 4 (PAGE_END)"); this.add(button, BorderLayout.LINE_END); JLabel caloriesBurned = new JLabel("You have burned " + calories + " calories!!"); this.add(caloriesBurned, BorderLayout.PAGE_END); } }

http://stackoverflow.com/comment/42026579
type: Comment
score: 1
has text: Deleting the Date.class solved the issue.. Thanks
comment on: http://stackoverflow.com/q/26717733
type: QuestionComment

http://stackoverflow.com/a/26825187
answers question: http://stackoverflow.com/q/26824825
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26824825
has body: You must declare the ObjectOutputStream before you declare the ObjectInputStream. When you create an ObjectInputStream, it waits for data from an ObjectOutputStream. It's waiting on that data (the header). public ObjectInputStream(InputStream in) throws IOException { verifySubclass(); bin = new BlockDataInputStream(in); handles = new HandleTable(10); vlist = new ValidationList(); enableOverride = false; readStreamHeader(); //this is whats causing it to block bin.setBlockDataMode(true); } protected void readStreamHeader() throws IOException, StreamCorruptedException { short s0 = bin.readShort(); short s1 = bin.readShort(); if (s0 != STREAM_MAGIC || s1 != STREAM_VERSION) { throw new StreamCorruptedException(String.format("invalid stream header: %04X%04X", s0, s1)); } } If you declare ObjectOutputStream first, it sends the data, which isn't blocking

http://stackoverflow.com/a/26723539
has body: Replace System.out.println(revs[i]); with System.out.println(i); Explanation: The variable i is the integer element and not an index.
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26723504
type: Answer

http://stackoverflow.com/comment/42124177
has text: thank u for your reply but with this how can i get one decimal point latitude and longitude.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26772156
type: AnswerComment

http://stackoverflow.com/comment/42230284
type: AnswerComment
score: 0
has text: as well as [link 5](http://stackoverflow.com/questions/15290035/key-bindings-vs-key-listeners-in-java), and [link 6](http://stackoverflow.com/questions/10609388/difference-between-keybindings-and-keylisteners).
type: Comment
comment on: http://stackoverflow.com/a/26831393

http://stackoverflow.com/comment/42005550
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26704219
has text: You'll need to put that code where the code says `// Parse and handle line number`.
score: 0

http://stackoverflow.com/comment/42209023
type: AnswerComment
has text: `Character.isUpperCase`. Doesn't that violates the predicate interface ? .However its interesting
type: Comment
comment on: http://stackoverflow.com/a/26817510
score: 0

http://stackoverflow.com/comment/41992934
comment on: http://stackoverflow.com/q/26699525
score: 0
type: Comment
type: QuestionComment
has text: I tried `Heart_Breaking_Bad.ttf` and it doesn't work... I don't see any errors.. I can launch my App without issues..

http://stackoverflow.com/a/26774388
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42128045
has comment: http://stackoverflow.com/comment/42128320
has comment: http://stackoverflow.com/comment/42128194
has body: Don't ever override the Fragment constructor, because they MUST have an empty constructor. Create the same newInstance method in your PagerContainer, and grab the parameter from it: private static final String ARGUMENT_PAGE_HOTEL = "arg_page_hotel"; public PagerContainer() { } public static PagerContainer newInstance(String hotel) { PagerContainer container = new PagerContainer(); Bundle arguments = new Bundle(); arguments.putString(ARGUMENT_PAGE_HOTEL, hotel); container.setArguments(arguments); return container; } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.pager_container, null); hotel = getArguments().getString(ARGUMENT_PAGE_HOTEL); ... return v; }
answers question: http://stackoverflow.com/q/26774063

http://stackoverflow.com/q/26701081
favorite count: 0
has comment: http://stackoverflow.com/comment/41996519
has comment: http://stackoverflow.com/comment/57255912
tagged with: rest
has comment: http://stackoverflow.com/comment/41996546
tagged with: android
linked to: http://stackoverflow.com/q/19975046
has body: I was wondering if anyone could tell me why I am getting a bad request error when I attempt to perform a RESTfull service using Retrofit Error : HTTP/1.1 400 Bad Request Here are my two classes: RetrofitInterface: public class RetrofitInterface { private static StockApiInterface sStockService; public static StockApiInterface getStockApiClient() { if (sStockService == null) { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("http://query.yahooapis.com/v1/public") .build(); sStockService = restAdapter.create(StockApiInterface.class); } return sStockService; } public interface StockApiInterface { @GET("/yql") void listQuotes(@Query("q") String query,Callback&lt;Stock&gt; stockInfo); } } Asyntask within MainActivity public class extraThread extends AsyncTask&lt;Void, Void, Void&gt;{ @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub RetrofitInterface.getStockApiClient().listQuotes("select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(\"AIB.IR\")%0A%09%09&amp;format=json&amp;diagnostics=true&amp;env=http%3A%2F%2Fdatatables.org%2Falltables.env&amp;callback=", new Callback&lt;Stock&gt;() { @Override public void failure(RetrofitError arg0) { // TODO Auto-generated method stub arg0.printStackTrace(); } @Override public void success(Stock arg0, Response arg1) { // TODO Auto-generated method stub } }); } } The result is always a failure. I thought originally that the problem was Retrofit's built in gson converter was having trouble converting the response to a stock object, as I was only receiving a "Retrofit.retrofiterror' response. However the 'Bad Request' response has me thinking the problem is in the URL for the api. Here is my desired response url: http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AIB.IR%22)%0A%09%09&amp;format=json&amp;diagnostics=true&amp;env=http%3A%2F%2Fdatatables.org%2Falltables.env&amp;callback= Could anyone tell me i…
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26701599
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26701599
upvote count: 4
tagged with: retrofit
answer count: 1
downvote count: 0
has title: Android Retrofit error while building a request

http://stackoverflow.com/q/26693550
tagged with: filepath
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42044341
downvote count: 0
linked to: http://stackoverflow.com/q/320542
has comment: http://stackoverflow.com/comment/41983320
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42044378
has comment: http://stackoverflow.com/comment/41985037
tagged with: database
has comment: http://stackoverflow.com/comment/42043970
upvote count: 2
answer count: 1
tagged with: directory
favorite count: 0
has body: I would like to know how to save a file in the current directory. For example, let's say that the software application creates a text file called "Information.txt", and the software application allows this text file to be edited. If I edit the text in this text file and save it, I would like to be able to copy the project onto a flash drive and use it on another computer, still having access to the "Information.txt" file. Basically, what I want to be able to do is save a file in the same directory as the project. What filepath would I use to do this. And, if I was doing this with a database file, how might I go about saving the database in the current directory? Thank you in advance for any helpful answers. Regards, Ryan Shukis
has title: How can I save a file in the current directory?
has answer: http://stackoverflow.com/a/26693806
accepted answer: http://stackoverflow.com/a/26693806
has comment: http://stackoverflow.com/comment/41983379

http://stackoverflow.com/q/26747033
downvote count: 0
score: 6
tagged with: weld
type: AnsweredQuestion
tagged with: java
has title: Using Weld with Dropwizard
type: Question
has comment: http://stackoverflow.com/comment/42131204
answer count: 2
has answer: http://stackoverflow.com/a/26756789
accepted answer: http://stackoverflow.com/a/26756789
has body: I am trying to use Weld-SE for dependency injection in a dropwizard application. I can bootstrap Weld and inject in the Application class like so: public class App extends Application&lt;AppConfig&gt; { @Inject NameService service; @Inject RestResource resource; public static void main(String[] args) throws Exception { Weld weld = new Weld(); WeldContainer container = weld.initialize(); App app = container.instance().select(App.class).get(); app.run(args); weld.shutdown(); } } I have written a producer method in a separate class for the RestResource and this is also injected fine. However in the resource class the service is not injected: @Path("/test") @Produces(MediaType.APPLICATION_JSON) public class RestResource { @Inject NameService service; @GET public String test() { return service.getName(); } } Here service is always null. Does anyone know how to make this work?
has comment: http://stackoverflow.com/comment/42082220
upvote count: 6
favorite count: 0
tagged with: dropwizard
possible better answer: http://stackoverflow.com/a/30031567
has answer: http://stackoverflow.com/a/30031567
tagged with: cdi

http://stackoverflow.com/comment/41994731
has text: You are barking up the wrong tree. First learn how to deal with JSON directly, simply parsed into Maps and Lists. Then you can use one of the fancy "POJO" tools. And creating a class dynamically is infinitely more complex than doing what I just said.
comment on: http://stackoverflow.com/q/26700517
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26712521
has body: Even thus this may be possible using Maven it will brake the underlaying convention. Beeing at the point where a "clean structure" or client requirements deny following the convention i would question Maven as the right choice for your build process. BUT: Most Java developpers would consider the maven structure "clean", expecially because production/busines-code is separated from test code allowing for example to deploy your application including all of the unit- and integrationtests to a Jenkins server for continous integration while a deployment to the production environment may not contain any test classes at all. Since per definition only "productive" code belongs to src/main/java even if you would have some sort of test-base with your own TestRunners, Factorys, etc. under src/main/java the according "Tests of the Testbase" would reside in src/test/java. If i was you i would realy consider to refactor the project and move your Testclasses to src/test/java (i leave it open to you on how you argument about convention over configuration and related topics :))
answers question: http://stackoverflow.com/q/26712158
score: 0
type: Answer

http://stackoverflow.com/q/26760278
tagged with: linux
type: UnansweredQuestion
has title: JVM ignoring Xms setting
has comment: http://stackoverflow.com/comment/42102349
tagged with: java
has body: I have the following Java program that I don't expect to need much java heap: SleepTest.java public class SleepTest { public static void main(String[] args) { while (true) { try { Thread.sleep(100000); } catch (InterruptedException e) { } } } } Therefore I try to inform this to the JVM by specifying an initial heap size using the Xms setting. However it seems that the JVM just ignores this and allocates with the default size. Why is this ? To illustrate I start my program three times: abc@yyy:~> java SleepTest & // default - 512 MB [1] 15745 abc@yyy:~> java -Xms10M SleepTest & // specifying initial size of 10 MB [2] 15756 abc@yyy:~> java -Xmx10M SleepTest & // forcing max heap size of 10 MB [3] 15766 And investigates the memory consumption in Linux: abc@yyy:~/ebbe> grep VmSize /proc/15745/status /proc/15756/status /proc/15766/status /proc/15745/status:VmSize: 688828 kB // default /proc/15756/status:VmSize: 688892 kB // specifying initial size of 10 MB /proc/15766/status:VmSize: 166596 kB // forcing max heap size of 10 MB Here the size of process 15756 indicates that it just allocated the same as default. I'm using the following JVM: java version "1.6.0" Java(TM) SE Runtime Environment (build pxa6460sr16fp1-20140706_01(SR16 FP1)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr16-20140626_204542 (JIT enabled, AOT enabled) J9VM - 20140626_204542 JIT - r9_20130920_46510ifx7 GC - GA24_Java6_SR16_20140626_1848_B204542) JCL - 20140704_01 And I'm running on SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 3
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26760894
tagged with: jvm

http://stackoverflow.com/q/26721704
has answer: http://stackoverflow.com/a/26721787
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42033309
has answer: http://stackoverflow.com/a/26721851
has title: JDBC/MYSQL Communications link failure (ECLIPSE/ANDROID)
linked to: http://stackoverflow.com/q/15732853
tagged with: java
has body: i've been trying to make a simple hello world app that uses jdbc to query mysql and retrieve/println results. Im using this tutorial from tutorials point adopted to android code: http://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm Here is my adopted version: package com.example.myfirstapp0006; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import java.sql.*; public class MainActivity extends ActionBarActivity { // JDBC driver name and database URL static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/EMP"; // Database credentials static final String USER = "username"; static final String PASS = "password"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Connection conn = null; Statement stmt = null; try{ // STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); // STEP 3: Open a connection System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL,USER,PASS); // STEP 4: Execute a query System.out.println("Creating statement..."); stmt = conn.createStatement(); String sql; sql = "SELECT id, first, last, age FROM Employees"; ResultSet rs = stmt.executeQuery(sql); // STEP 5: Extract data from result set while(rs.next()) { // Retrieve by column name int id = rs.getInt("id"); int age = rs.getInt("age"); String first = rs.getString("first"); String last = rs.getString("last"); // Display values System.out.println("ID: " + id); System.out.println(", Age: " + age); System.out.println(", First: " + first); System.out.println(", Last: " + last); } // STEP 6: Clean-up environment rs.close(); stmt.close(); conn.close(); }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); }catch(Exception e){ //Handle errors for Class.forName e.printStackTrace(); }finally{ //finally block used to c…
tagged with: mysql
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26721961
score: 0
answer count: 3
tagged with: jdbc

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26715216
tags question: http://stackoverflow.com/q/26723924
tags question: http://stackoverflow.com/q/26830244
tags question: http://stackoverflow.com/q/26828204
tags question: http://stackoverflow.com/q/26776904
tags question: http://stackoverflow.com/q/26677044
tags question: http://stackoverflow.com/q/26815474
tags question: http://stackoverflow.com/q/26816706
tags question: http://stackoverflow.com/q/26719944
tags question: http://stackoverflow.com/q/26820222
tags question: http://stackoverflow.com/q/26683441
tags question: http://stackoverflow.com/q/26786096
tags question: http://stackoverflow.com/q/26709595
tags question: http://stackoverflow.com/q/26758425
tags question: http://stackoverflow.com/q/26679641
tags question: http://stackoverflow.com/q/26805966
type: Tag
tags question: http://stackoverflow.com/q/26822156
tags question: http://stackoverflow.com/q/26814372
tags question: http://stackoverflow.com/q/26799266
tags question: http://stackoverflow.com/q/26788912

http://stackoverflow.com/q/26762376
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/42106627
has comment: http://stackoverflow.com/comment/42106146
has comment: http://stackoverflow.com/comment/42109607
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42106704
favorite count: 0
has answer: http://stackoverflow.com/a/26762640
has title: Calcul difference between two date for march month
has comment: http://stackoverflow.com/comment/42106205
has comment: http://stackoverflow.com/comment/42109073
has comment: http://stackoverflow.com/comment/42106110
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/26762640
has comment: http://stackoverflow.com/comment/42106322
has body: I am trying to calculate the number of days between two dates. First case : String string = "01/03/2014"; Date dateFin = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE).parse(string); string = "31/03/2014"; Date dateDebut = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE).parse(string); long result = Math.abs(dateFin.getTime() - dateDebut.getTime()); System.out.println((int) (result / (long) (1000 * 3600 * 24))); => Result : 29 Second case : String string = "01/03/2013"; Date dateFin = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE).parse(string); string = "31/03/2013"; Date dateDebut = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE).parse(string); long result = Math.abs(dateFin.getTime() - dateDebut.getTime()); System.out.println((int) (result / (long) (1000 * 3600 * 24))); => Result : 30 Question: Why there is a difference between this two cases? Thanks
type: Question
has comment: http://stackoverflow.com/comment/42106097
linked to: http://stackoverflow.com/q/10698470
has comment: http://stackoverflow.com/comment/42106280
has comment: http://stackoverflow.com/comment/42106411
has comment: http://stackoverflow.com/comment/42106223

http://stackoverflow.com/a/26810482
accepted answer of: http://stackoverflow.com/q/26810254
upvote count: 1
has body: String passString= "information im sending"; Intent intent = new Intent(this, secondActivity.class); intent.putExtras("DataKey", passString); startActivity(intent); //in your second activity Intent intent = getIntent(); String recieveString = intent.getStringExtra("DataKey"); //repeat the same in your second activity but this time the string will change Intent intent = new Intent(this, thirdActivity.class); intent.putExtras("DataKey", recieveString); startActivity(intent); //in your third activity Intent intent = getIntent(); String recieveString2 = intent.getStringExtra("DataKey");
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26810254
score: 1

http://stackoverflow.com/comment/42144155
comment on: http://stackoverflow.com/q/26783560
type: Comment
type: QuestionComment
score: 0
has text: could you clarify what's `this format`? a bunch of numbers could be a format of anything. and in what aspect you feel like to solve this problem using regex?

http://stackoverflow.com/comment/42026882
has text: and i have my aray ListView lista =(ListView) view.findViewById(R.id.comment_list_views); ArrayList<list_view_comments> arraydir = new ArrayList<list_view_comments>(); list_view_comments list_view_comments;
type: Comment
comment on: http://stackoverflow.com/q/26718336
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42046230
has text: I am so dumb! I changed 'localhost' to the actual machine name & got past this error. BUT - It's not quite working yet. Any one knows what the 'default' value of 'consumer group' is under Kafka? It doesn't seem to consume any messages.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26725463
score: 0

http://stackoverflow.com/comment/42165100
has text: Thanks for your answer. I already used a different logic to get it working properly. Appreciate it though :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26758206

http://stackoverflow.com/a/26704510
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26703921
has comment: http://stackoverflow.com/comment/43857375
accepted answer of: http://stackoverflow.com/q/26703921
score: 6
has comment: http://stackoverflow.com/comment/43856986
type: AcceptedAnswer
downvote count: 0
has body: I get this solved by passing mem attribute with sbt command as given below, (for 4 GB RAM system) SPARK_HADOOP_VERSION=1.1.0 sbt/sbt assembly -mem 1024

http://stackoverflow.com/comment/42114237
type: Comment
has text: Thanks alot for you<r patience..Ultimatly I am using the output to create a cell for an ExcelFile I'm generating with JExcelAPI so I'm guessing it's the API that enters the ' .... Thank you anyhow..
type: QuestionComment
comment on: http://stackoverflow.com/q/26766079
score: 0

http://stackoverflow.com/q/26701459
tagged with: overloading
type: AnsweredQuestion
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/41996418
type: Question
accepted answer: http://stackoverflow.com/a/26701483
answer count: 2
downvote count: 4
upvote count: 0
possible better answer: http://stackoverflow.com/a/26701514
has answer: http://stackoverflow.com/a/26701514
has body: my velocity method keeps giving me an error saying "No applicable overload for the method named 'velocity' was found in type "Velocity". Perhaps you wanted the overload version 'void velocity (double distance, double time) throws java.io.IOException;' instead?" I'm not really sure how I can fix this, but if you guys can help, that would be great, thanks. Anyways, here is the code: import java.io.*; public class Velocity { public static void main (String[] args) { velocity (); } public static void velocity (double distance, double time) throws IOException { BufferedReader myInput = new BufferedReader (new InputStreamReader (System.in)); System.out.println ("Please input distance in meters:"); distance = Double.parseDouble (myInput.readLine ()); System.out.println ("Please input time in seconds:"); time = Double.parseDouble (myInput.readLine ()); System.out.println ("Therefore your velocity is " + distance / time + " m/s."); } }
has title: Method Overload Error
favorite count: 0
has comment: http://stackoverflow.com/comment/41996402
has answer: http://stackoverflow.com/a/26701483
tagged with: velocity
score: -4

http://stackoverflow.com/a/26689361
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26689280
upvote count: 2
has body: This is done in Java and in many other languages so that a parser could classify a terminal symbol uniquely regardless of its surrounding context. Technically, it is entirely possible to allow identifiers that look like numbers or even like keywords: for example, it is possible to write a parser that lifts the restriction on identifiers, allowing you to write something like this: int 123 = 321; // 123 is an identifier in this imaginary compiler The compiler knows enough to "understand" that whatever comes after the type name must be a variable name, so 123 is an identifier, and so it could treat this as a valid declaration. However, this would create more ambiguities down the road, because 123 becomes in invalid number "shadowed" by your new "identifier". In the end, the rule works both ways: it helps compiler designers write simpler compilers, and it also helps programmers write readable code. Note that there were attempts in the past to build compilers that are not particularly picky about names of identifiers - for example int a real int = 3 would declare an identifier with spaces (i.e. "a real int" is a single identifier). This did not help readability, though, so modern compilers abandoned the trend.

http://stackoverflow.com/comment/42243365
score: 0
has text: I tried emoji-java, but it just helps to ease the use of such characters but it doesn't help to solve the font problem. Finally i suceeded with @trashgod sugestion of implementing the TableCellRenderer to view icons
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26778769

http://stackoverflow.com/a/26690639
has comment: http://stackoverflow.com/comment/41978480
type: Answer
answers question: http://stackoverflow.com/q/26690603
has comment: http://stackoverflow.com/comment/41977871
has comment: http://stackoverflow.com/comment/41977958
has comment: http://stackoverflow.com/comment/41977846
has comment: http://stackoverflow.com/comment/41977996
score: 0
has comment: http://stackoverflow.com/comment/41977983
has body: You do not have any code showing the errors back to the end user. Please see the following link for an example: http://www.mkyong.com/spring-mvc/spring-mvc-form-errors-tag-example/ Also, It doesn't look like you actually set your command object in your form. You might not have shown that code though. Small side note, I would not do a redirect if you have validation errors, just send them directly back to the page they came from. EDIT After further review, I do see that you have . Normally this goes outside and above the form itself. <form:errors path="transport"/> <form:form role="form" action="/admin/transport/add" method="post" commandName="transport"> Name <form:input type="text" path="name" class="form-control input-sm" id="name" autofocus="true"/> </form:form>

http://stackoverflow.com/comment/42040971
has text: where/how do you set environment variables? in the command prompt, can you 'echo %CATALINA_HOME%' to check it is set? Also, what does 'dir %CATALINA_HOME%\bin' do?
score: 0
comment on: http://stackoverflow.com/q/26725901
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26740288
answers question: http://stackoverflow.com/q/26738564
has body: Not sure if there's any "standard" way to handle this, but there's a CompletionCallback we can register with an AyncResponse. CompletionCallback: A request processing callback that receives request processing completion events. A completion callback is invoked when the whole request processing is over, i.e. once a response for the request has been processed and sent back to the client or in when an unmapped exception or error is being propagated to the container. The AsyncResponse is meant to handle requests asynchronously , but we can immediately call resume to treat it like it was synchronous. A simple example would be something like @Path("/callback") public class AsyncCallback { @POST @Consumes(MediaType.APPLICATION_JSON) public void postWithAsync(@Suspended AsyncResponse asyncResponse, SomeObject object) { asyncResponse.register(new CompletionCallback() { @Override public void onComplete(Throwable error) { if (error == null) { System.out.println("Processing new Request"); } else { System.out.println("Exception in Request handling"); } } }); Response response = Response.ok("Success").build(); // Carry on like nothing happened asyncResponse.resume(response); } } You can see more explanation at Asynchronous Server-side Callbacks
type: Answer
accepted answer of: http://stackoverflow.com/q/26738564
has comment: http://stackoverflow.com/comment/42075404
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26731686
has body: Just have a look in the code: See http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/view/View.java#3436 how a View object is created Because Button is a subclass of View you create the View v parameter by instanziating Button with Button b1 = new Button(this); When you call setOnClickListener you register a callback method (on View object) which should be executed. http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/view/View.java#4379 The real click is performed in the method performClick(). This method reads your registered onclick(View v) from the onclick listener method and executes it. http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/view/View.java#4432 You can also have a look for the Observer pattern.
type: Answer
answers question: http://stackoverflow.com/q/26730881
score: 0

http://stackoverflow.com/a/26931817
type: Answer
answers question: http://stackoverflow.com/q/26773829
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/26773829
has comment: http://stackoverflow.com/comment/42412670
type: AcceptedAnswer
upvote count: 6
has body: No, unfortunately, as your citation already mentions, the java.util.regex regular expression implementation does not support retrieving any previous values of a repeated capturing group after a single match. The only way to get those, as your code illustrates, is by find()ing multiple matches of the repeated part of your regular expression. I've also been looking at other implementations of regular expressions in Java, for example: http://www.brics.dk/automaton/ but I could not find any that supported it (only the Microsoft .NET engine) . If I understood correctly, implementations of regular expressions based on state machines cannot easily implement this feature. java.util.regex does not use state machines, though. If anyone knows of a Java regular expression library that supports this behaviour, please share it, because it would be a powerful feature. p.s. it took me quite a while to understand your question. The title is good, but the body confused me about whether I understood you correctly.

http://stackoverflow.com/comment/42083418
has text: @JayLo When you say just `ArrayList objs;` it is a raw type (it behaves like `ArrayList<Object> objs;`). The diamond operator on the right is short-hand, `List<String> strings = new ArrayList<>();` for `List<String> strings = new ArrayList<String>();`.
type: AnswerComment
comment on: http://stackoverflow.com/a/26749510
type: Comment
score: 1

http://stackoverflow.com/comment/42175242
comment on: http://stackoverflow.com/a/26800584
has text: What do you mean by 'enter the VB string'?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26683925
type: Answer
has body: I think you should replace pwd.equals(c.substring(c.indexOf(" "), c.lastIndexOf(" " +1)))) with pwd.equals(c.substring(c.indexOf(" "), c.lastIndexOf(" ") +1))) also for a and b
score: 0
answers question: http://stackoverflow.com/q/26683732
has comment: http://stackoverflow.com/comment/41997792
has comment: http://stackoverflow.com/comment/41966649

http://stackoverflow.com/comment/42193267
type: AnswerComment
has text: android:id="@+id/hello" in the xml and setContentView(R.id.hello); leads to an error?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26810100

http://stackoverflow.com/comment/42061427
type: QuestionComment
comment on: http://stackoverflow.com/q/26735479
score: 2
has text: Well, since the redirect is issued on the server side you'll need to make a request first, which happens when calling those methods you're not interested in. You could disallow following redirects and get the domain from the 30x response yourself.
type: Comment

http://stackoverflow.com/q/26724917
score: 0
tagged with: android
has body: This routine read the data from a socket stream (ois). The question is why it works fine showing the read data through System.out.println(data) (used to debug) but it works wrong showing "null" in the EditText object of the android device when a data is received. final EditText input_txt = (EditText) findViewById(R.id.input_txt); ..... thrd = new Thread(new Runnable() { public void run() { while (!Thread.interrupted()) { data = null; try { data = ois.readLine(); } catch (IOException e) { e.printStackTrace(); } if (data != null) { System.out.println(data); runOnUiThread(new Runnable() { @Override public void run() { input_txt.setText(data+""); } }); } } } }); thrd.start(); - ----- layout xml ------------------------------------- .... &lt;EditText android:id="@+id/input_txt" android:layout_width="240dp" android:layout_height="match_parent" android:layout_weight="0.25" android:ems="10" android:gravity="top" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt;
has answer: http://stackoverflow.com/a/26725058
accepted answer: http://stackoverflow.com/a/26725058
has title: Android show variable text from a socket connection in a EditText
tagged with: sockets
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/q/26780982
type: Question
tagged with: jira-rest-java-api
has comment: http://stackoverflow.com/comment/42140197
has answer: http://stackoverflow.com/a/26782963
has title: Creating REST Api bean
has comment: http://stackoverflow.com/comment/42139664
answer count: 1
has body: I was wondering it there is any good way without creating separate bean and breaking DRY principle if I want to expose different values. For example here is the "GET" bean : class NameBean { @XMLAttribute String name; int age; String ssn; } But when I "POST" I wont need ssn. Do I really have to create another bean if I don't want "ssn" in the json. class PostNameBean { @XMLAttribute String name; int age; }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42139463
has comment: http://stackoverflow.com/comment/42139738
score: 0
tagged with: java

http://stackoverflow.com/comment/42000148
score: 0
type: AnswerComment
has text: I'm starting to think if being placed in Ap computer science without joining pre-ap is a curse or a blessing.
type: Comment
comment on: http://stackoverflow.com/a/26703217

http://stackoverflow.com/q/26735525
downvote count: 0
has body: I'm trying to combine two collections in MongoDB in Java. The structure of my collections looks like this: global +- 100k rows: _id | registration | type _________|______________________|____________ 018024 | 5A-IAY | A306 type +- 1000 rows: _id | wake | code | manufacturer | _________|_____________|_______________________________|__________________| A306 | H | A300B4-600 /C4-600 / F4-600 | Airbus | I want this to be inserted dynamically, so that I can update it. I'm using an arrange of webcrawlers to retrieve this data, and so I want my program to be able to update it and retrieve it. I've been looking into mongodb refs and embedded documents and my structure while embedded would look like this: _id: 018024 registration: 5A-IAY type: A306 { _id: A306 wake: H type: A-300B4-600/.. manufacturer: Airbus } My question is: How will I be able to retrieve specific data like this in MongoDB from multiple collections, and how will I be able to update it dynamically? Thanks in advance for any input.
favorite count: 0
tagged with: mongodb-query
has comment: http://stackoverflow.com/comment/42058640
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/42057546
has title: Mongodb combine collections in java, and retrieve specific documents
has comment: http://stackoverflow.com/comment/42057664
tagged with: join
has comment: http://stackoverflow.com/comment/42057747
tagged with: java
type: Question
tagged with: mongodb

http://stackoverflow.com/q/26811217
upvote count: 1
has body: I have noticed that some innocent looking if-statements in one of my number crunching programs significantly slow down the execution (JRE 1.8.25, 64-bit Hotspot build 25.25-b02, Intel 64-bit CPU). I have checked the code generated by the JIT compiler and it looks a little bit strange. Here is a simple function to illustrate the problem: private float test(float a,float b) { float c=a+b; if(c&lt;0) { return -1; } return 0; } And here is the interesting part of the generated code: ... 0x2bd17ae: vaddss xmm0,xmm0,xmm1 0x2bd17b2: vxorps xmm1,xmm1,xmm1 0x2bd17b6: vucomiss xmm0,xmm1 0x2bd17ba: mov esi,1h 0x2bd17bf: jp 2bd17d8h 0x2bd17c5: jnbe 2bd17d8h 0x2bd17cb: mov esi,0h 0x2bd17d0: je 2bd17d8h 0x2bd17d6: dec esi ;*fcmpg 0x2bd17d8: cmp esi,0h 0x2bd17db: mov rsi,57448760h ; {metadata(method data for {method} ...} 0x2bd17e5: mov rdi,108h 0x2bd17ef: jnl 2bd17ffh 0x2bd17f5: mov rdi,118h 0x2bd17ff: mov rbx,qword ptr [rsi+rdi] 0x2bd1803: lea rbx,[rbx+1h] 0x2bd1807: mov qword ptr [rsi+rdi],rbx 0x2bd180b: jnl 2bd1c1fh ;*ifge ... // straightforward code for "return -1f" and "return 0f" follows ... The code from 0x2bd17ba to 0x2bd1807 doesn't make much sense to me. Why is it there? Any idea what it does? Edit: Thinking about it, it might be some code added by the JIT compiler to collect runtime statistics (just guessing because of the 'metadata' comment). But the question is: why is there? I have called the method several million times, so I would assume that the code should have reached its final optimized form.
type: Question
has title: understanding code generated by Java hotspot JIT for float test
tagged with: jit
tagged with: jvm-hotspot
tagged with: assembly
answer count: 1
downvote count: 0
score: 1
tagged with: disassembly
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26811577
tagged with: java

http://stackoverflow.com/comment/42081709
type: Comment
has text: So I changed the intilazed rows and columns to 2 and it ran. I still don't understand why though. Could you explain?
comment on: http://stackoverflow.com/a/26748486
type: AnswerComment
score: 0

http://stackoverflow.com/q/26694115
tagged with: java
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41983574
has title: Files.readAllLines skips last line
has body: am reading xml file in List in such a way: List&lt;String&gt; file_lines = Files.readAllLines(path); My file has 317 lines, but in list appears 316. Main problem is that lat one is empty (just carriage return probably) How can I deal with this? I need precisely every line of file, because am calculating crc32 checksum for file validation.
accepted answer: http://stackoverflow.com/a/26694174
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26694174
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/41978952
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26690950
type: AnswerComment
has text: @user2747502: No, it doesn't "just surround the data with a single quote". You don't need to do any escaping at all. I would actually expect it not to build a SQL statement including the values at all - instead, I'd expect it to send the values separately from the SQL. However, if it *does* build the SQL statement with values itself, you should be able to trust the driver to do the right escaping. Either way, *you don't need any escaping* if you're using PreparedStatement parameters.

http://stackoverflow.com/a/26719189
type: Answer
has comment: http://stackoverflow.com/comment/50988830
upvote count: 2
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26715642
answers question: http://stackoverflow.com/q/26715642
type: AcceptedAnswer
has body: This error can be fixed by downgrading the Appium Client(see step 1 in my question) from latest to java-client-1.5.0. You can keep rest of the jars to latest. Downgraded version of Appium Client can be downloaded from here http://mvnrepository.com/artifact/io.appium/java-client/1.5.0

http://stackoverflow.com/comment/42154359
has text: I get this: `$ gcloud version Google Cloud SDK 0.9.35 bq 2.0.18 bq-nix 2.0.18 compute 2014.10.30 core 2014.11.03 core-nix 2014.10.20 dns 2014.10.30 gcutil 1.16.5 gcutil-nix 1.16.5 gsutil 4.6 gsutil-nix 4.6 sql 2014.10.30` Anyone with any ideas? I have no idea where to begin.
type: QuestionComment
comment on: http://stackoverflow.com/q/26724536
score: 0
type: Comment

http://stackoverflow.com/q/26720133
answer count: 3
has answer: http://stackoverflow.com/a/26720285
has comment: http://stackoverflow.com/comment/42030382
favorite count: 0
has title: after => Null Pointer
downvote count: 2
has answer: http://stackoverflow.com/a/26720232
has comment: http://stackoverflow.com/comment/42030372
tagged with: timestamp
has comment: http://stackoverflow.com/comment/42030771
type: AnsweredQuestion
has body: I got this code, and I am trying to compare a Timestamp array: Timestamp oldestTStamp = timeStamp[0]; boolean found = false; int temp = 0; for (int j = 1; j&lt;timeStamp.length; j++){ if(oldestTStamp == null &amp;&amp; timeStamp[j] == null){} else if(oldestTStamp.after(timeStamp[j])){ oldestTStamp = timeStamp[j]; //Retrieve the oldest timestamp index in array found = true; temp = j; } This is how I assign timestamp: timeStamp[index] = new Timestamp(System.currentTimeMillis());
tagged with: java
has answer: http://stackoverflow.com/a/26720233
type: Question
possible better answer: http://stackoverflow.com/a/26720233
upvote count: 0
accepted answer: http://stackoverflow.com/a/26720232
score: -2

http://stackoverflow.com/a/26713193
downvote count: 0
score: 1
has body: LinkedList connections = new LinkedList(); is a raw type and thus it knows its elements as of the Type Object. You need to add a generic type paramter to it: LinkedList&lt;PrintWriter&gt; connections = new LinkedList&lt;&gt;();
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26713094
answers question: http://stackoverflow.com/q/26713094
type: Answer

http://stackoverflow.com/a/26752581
has comment: http://stackoverflow.com/comment/42088477
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26752103
accepted answer of: http://stackoverflow.com/q/26752103
has comment: http://stackoverflow.com/comment/42089949
has body: The answers here all work, but everyone seems to have glanced over the instructions. It says write a nested if statement, which is just an if statement inside of another if statement. You're going to want to do something along the lines of this: if(amount1 &gt; 10 &amp;&amp; amount2 &lt; 100){ if(amount1 &gt; amount2){ System.out.println(amount1); } else{ System.out.println(amount2); } }
type: Answer
has comment: http://stackoverflow.com/comment/42104761
upvote count: 2
has comment: http://stackoverflow.com/comment/42089927

http://stackoverflow.com/comment/42179045
type: Comment
has text: The error happened here `View contentView = inflater.inflate(R.layout.home, null, false);`, it's before you did this `wheel.setWheelDiameter(400);` The error should come from an incorrect xml, somewhere.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26780527

http://stackoverflow.com/comment/42125353
type: Comment
type: QuestionComment
has text: The declaration of `tracks` is irrelevant to the compiler complaining about the variable named `index` not being defined...
score: 0
comment on: http://stackoverflow.com/q/26772522

http://stackoverflow.com/comment/42059476
type: AnswerComment
has text: @IWasSoLost: Use your `MyAsyncTask` in `selectItem()`.
comment on: http://stackoverflow.com/a/26735956
type: Comment
score: 0

http://stackoverflow.com/a/26762047
has comment: http://stackoverflow.com/comment/42107544
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42107176
has comment: http://stackoverflow.com/comment/42106037
has body: Both of these should be ok. If you want to use the first way but avoid updating fields besides password you can configure dynamic-update with the annotation @DynamicUpdate(value=true): dynamic-update (optional - defaults to false): specifies that UPDATE SQL should be generated at runtime and can contain only those columns whose values have changed. You'd need to use select-before-update or optimistic locking with this. select-before-update might be worse-performing than updating all the fields. Apparently this is implementation-specific and not part of JPA.
type: Answer
has comment: http://stackoverflow.com/comment/42109034
accepted answer of: http://stackoverflow.com/q/26761870
answers question: http://stackoverflow.com/q/26761870
upvote count: 3
has comment: http://stackoverflow.com/comment/42105938
score: 3
has comment: http://stackoverflow.com/comment/42106078

http://stackoverflow.com/comment/83279670
type: Comment
has text: @DanielFerreiraCastro Of course. Have a look [here](https://github.com/cassiomolin/jersey-jwt).
type: AnswerComment
score: 12
comment on: http://stackoverflow.com/a/45814178

http://stackoverflow.com/a/26693665
answers question: http://stackoverflow.com/q/26693648
has body: They should be inside your jar file, and loaded as resources.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/26682347
answers question: http://stackoverflow.com/q/26682300
has comment: http://stackoverflow.com/comment/41963551
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41963756
type: Answer
has comment: http://stackoverflow.com/comment/41963460
score: 3
upvote count: 3
has body: You aren't assigning the result of your addition to anything. You are missing a semicolon on break. And you didn't increment a. The call to print is missing parenthesis, but I think you wanted to use System.out.println(). And, I recommend you use brackets (even on single line statements). Putting it all together, I believe you wanted something like, while (a &lt; 1000) { if ((a + 1) % 3 == 0) { x = (x + a); } else if ((a + 1) % 5 == 0) { x = (x + a); } else { x = (a + 1); } if (a == 1000) { break; // &lt;-- missing semicolon. } System.out.println(x); // &lt;-- print. a++; // &lt;-- increment a. } Finally, you could use an or and you could use += like while (a &lt; 1000) { if ((a + 1) % 3 == 0 || (a + 1) % 5 == 0) { x += a; } else { x += a + 1; } if (a == 1000) { break; } System.out.println(x); a++; }
accepted answer of: http://stackoverflow.com/q/26682300
has comment: http://stackoverflow.com/comment/41963768

http://stackoverflow.com/comment/42046427
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26717066
has text: hi avsej, i am using couchbase client version 1.4.5
score: 0

http://stackoverflow.com/comment/42230822
type: QuestionComment
has text: Since hibernate takes care of these queries how do i fix this ?
comment on: http://stackoverflow.com/q/26831728
score: 0
type: Comment

http://stackoverflow.com/comment/41982245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26693369
has text: possible duplicate of [Is it good practice to use java.lang.String.intern()?](http://stackoverflow.com/questions/1091045/is-it-good-practice-to-use-java-lang-string-intern)
score: 0

http://stackoverflow.com/q/26703137
upvote count: 1
accepted answer: http://stackoverflow.com/a/26705591
has title: How to validate the contents of text file?
downvote count: 0
has body: I need some help with a program that must read in the specified text file and then validate its contents. The results of each valid match should be output to the console (stdout) in the following format: HomeTeamName [HomeTeamScore] | AwayTeamName [AwayTeamScore] At the end of the output I need to have generated statistics showing the total number of valid and invalid matches that were processed. Also i need it to show the total number of goals that were scored. The code I have so far is: public class Generator { public static void main(String[] args) throws FileNotFoundException { Scanner s = new Scanner(new File("results.txt")); String line; while ( s.hasNext() ) { line = s.nextLine(); System.out.println(line); } System.out.println("\nEOF"); // Output and End Of File message. } } The sample input file is: Aston Villa : Middlesbrough : 3 : 1 Chelsea : Manchester City : 1 // only 3 fields provided Tottenham Hotspur : Stoke City : 0 : 0 Hull : : 2 : 3 // missing away team name West Ham United : Wigan Athletic : 2 : 1 : : 2 : 0 // both team names missing Fulham : Liverpool : 1 : 2 Arsenal Liverpool : 2 : 2 // missing delimiter (:) between teams Sunderland : Newcastle United : 0 : 4 Hull : Liverpool : 5 : x // ‘x’ given instead of away team score
type: AnsweredQuestion
tagged with: validation
score: 1
has comment: http://stackoverflow.com/comment/42002911
favorite count: 0
has comment: http://stackoverflow.com/comment/41999848
has answer: http://stackoverflow.com/a/26705591
type: Question
tagged with: count
answer count: 1
tagged with: java
tagged with: stdout

http://stackoverflow.com/comment/41986925
type: Comment
has text: hmmm... i wonder why i don't get the value. this is what i get then i run the code
comment on: http://stackoverflow.com/a/26696022
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42347585
type: AnswerComment
type: Comment
has text: I tried your updated answer and I am getting this error Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j/res.java (Is a directory)
score: 0
comment on: http://stackoverflow.com/a/26842710

http://stackoverflow.com/a/26748581
has body: The modulus size is not the problem. The problem is more likely that you are expecting the same values to be generated. They are not, not even in the VB code or Java code by itself (run the code snippets twice!). RSA PKCS#1 v1.5 padding contains random numbers, ensuring that the encryption will always result in a different value. This is the same for OAEP padding by the way. Note that you might want to look at OAEP mode and a hybrid cryptosystem instead of what you are doing now. Then you will be safer and you will be able to handle any size of data, although the amount of ciphertext will be larger of course.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42090003
accepted answer of: http://stackoverflow.com/q/26739249
has comment: http://stackoverflow.com/comment/42109734
has comment: http://stackoverflow.com/comment/42090246
answers question: http://stackoverflow.com/q/26739249
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42095413

http://stackoverflow.com/comment/42253014
type: QuestionComment
comment on: http://stackoverflow.com/q/26820248
score: 0
has text: I just used an online tool, but I don't think that will be a coding issue in Java.
type: Comment

http://stackoverflow.com/comment/42113693
type: Comment
comment on: http://stackoverflow.com/q/26766079
type: QuestionComment
score: 0
has text: @please don't change the question like that since some it may no longer reflect what's in some answers which will make them prone for down votes. If you tried something that didn't work just add it.

http://stackoverflow.com/comment/42146072
score: 0
comment on: http://stackoverflow.com/a/26782840
type: AnswerComment
type: Comment
has text: While agreeing using Interface is good, how exactly differs your undead class from OPs enemy class with option 2? So basically you would subclass undead class too for different movementstrategies

http://stackoverflow.com/q/26780699
upvote count: 1
type: Question
tagged with: short
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42138876
answer count: 1
linked to: http://stackoverflow.com/q/13366060
tagged with: hashset
has body: Set&lt;Short&gt; set = new HashSet&lt;Short&gt;(); short i = 0; for (i = 0; i &lt; 100; i++) { set.add(i); set.remove(i-1); } System.out.println(set.size()); When we run above program output comes 100. I understood it that As we are inserting short values in set and trying to remove integer value. So It's not removing from set. But if we modify remove statement as below set.remove(i); Output coming 0. Any idea?
favorite count: 0
duplicate of: http://stackoverflow.com/q/13366060
type: UnansweredQuestion
has title: Program output explanation HashSet
has comment: http://stackoverflow.com/comment/42138979
has comment: http://stackoverflow.com/comment/42138853
has answer: http://stackoverflow.com/a/26780804
downvote count: 2

http://stackoverflow.com/comment/42023595
score: 0
comment on: http://stackoverflow.com/q/26716740
type: Comment
type: QuestionComment
has text: Why do you need the "A", "B","C" there? You can have an array of HashSets if you like.

http://stackoverflow.com/q/26826299
possible better answer: http://stackoverflow.com/a/26826379
accepted answer: http://stackoverflow.com/a/26826343
type: AnsweredQuestion
tagged with: recursion
score: 3
has comment: http://stackoverflow.com/comment/42249784
upvote count: 3
tagged with: java
has title: binary search guessing number recursively
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26826343
tagged with: binary-search
has answer: http://stackoverflow.com/a/26826379
has body: I am coding a binary search algorithm and I want to get the count minimum guesses does it take to search the number that I provide.suppose that the number which I provide is 33, then it should count 7 steps. Step no number guessed result range of possible values 0 1-100 1 50 too high 1-49 2 25 too low 26-49 3 37 too high 26-36 4 31 too low 32-36 5 34 too high 32-33 6 32 too low 33-33 7 33 correct so this is my code for this package binarySearch; public class Binary { int gussedNo; public static int count =0; void search(int lowerBound,int upperBound,int num){ gussedNo=upperBound+lowerBound/2; count(); if(gussedNo==num){ System.out.println(count);} else if(gussedNo&gt;num){ upperBound=gussedNo-1; search(lowerBound,upperBound,num); } if(gussedNo&lt;num){ lowerBound=gussedNo+1; search(lowerBound,upperBound,num); } } int count(){ count=count+1; return count; } } I created a a separate method. here is my my main class.. package binarySearch; public class MainClass { public static void main (String[] args){ Binary search= new Binary(); search.search(1, 100,33 ); } } Here I have given lowerbound as 1 and uperbound as 100, and the number I want to count guesses for it is 33. But when I execute the code I get the count as 68..but it should be 7 according to binary search
favorite count: 0

http://stackoverflow.com/comment/41981889
score: 0
has text: @Pshemo I have put the code for saving
comment on: http://stackoverflow.com/q/26692834
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42102564
comment on: http://stackoverflow.com/q/26760209
has text: @KevinWorkman I am giving the JVM the devault value of memory, but this amount is not my problem since i have 16G of memory, the problem is the increasing number of memory needed. Thanks for the hint with frame.dispose() !
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42081176
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26747983
has text: What do you mean by "(not so)"?

http://stackoverflow.com/q/26790642
tagged with: android
tagged with: memory-leaks
answer count: 0
type: UnansweredQuestion
score: 0
has body: I analyzed my hprof file for memory leaks in Eclipse today, and I noticed that one of the biggest offenders is a resource I am not familiar with. One instance of "olt" loaded by "dalvik.system.PathClassLoader @ 0x421c26c8" occupies 7,877,440 (13.76%) bytes. The memory is accumulated in one instance of "java.util.HashMap$HashMapEntry" loaded by "&lt;system class loader&gt;". What is olt? And why is it accumulated in a HashMap? Even looking at the path to GC root, I don't see any references that are meaningful. Instead, there are more weird acronyms like nnu, olw, oiy, olu etc... Is there anything meaninful to be gleaned from this leak suspect?
has comment: http://stackoverflow.com/comment/42157567
tagged with: java
tagged with: eclipse
type: Question
has title: Android: olt Memory Leak reported by Eclipse Memory Analyzer
has comment: http://stackoverflow.com/comment/42157888

http://stackoverflow.com/a/26770072
answers question: http://stackoverflow.com/q/26769969
type: Answer
has body: First problem I see in the second method is that you are only returning something in the case when the statement if (this.k.compareTo(k) == 0) is true. The compiler should give you an error because your method is declared to return List&lt;K&gt; private List&lt;K&gt; someMethod(K k, List&lt;K&gt; L, int n) To solve this, you should return something either in each if statement, or at the bottom of your method. Based on your logic, you want to return an error value when no matches satisfying the above if statement are found. Thus, for example, you could return null by putting this statement at the bottom of your method: return null; Or, if you don't want to deal with null values, return an empty list: return new ArrayList&lt;K&gt;(); If you make this change your code compiles fine on my machine. Here is an Ideone example that compiles fine with the change I suggested. Furthermore, as @ajb mentioned in the comments, you aren't really taking care of the base case for your recursion. Meaning, you are not changing the arguments: K k, List&lt;K&gt; L, int n of your recursive method when you pass them through recursion and thus will end up in an "infinite" recursion causing StackOverFlowError in the case where no elements satisfy the condition if(this.k.compareTo(k) == 0) { L.add(this.k); return list; // this returns from recursion but nothing else } You should define some sort of a base case that will stop the recursion no matter if you find matches or not.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26769969
score: 0

http://stackoverflow.com/comment/42158747
has text: @arcy your answer was exactly what I needed, I was just having a bit of a derp moment and couldn't think how to get around it, the error message was that I couldn't invoke without a main method, I've fixed my work now with what you suggested, so thanks a lot.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26784574
type: Comment

http://stackoverflow.com/comment/42203817
type: Comment
comment on: http://stackoverflow.com/q/26816496
has text: @user432 Both your suggestions could work indeed. But I would prefer some "magic" annotation or configuration that does it automatically for me if that exists (maybe not).
score: 0
type: QuestionComment

http://stackoverflow.com/q/26806123
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26806437
tagged with: java
has comment: http://stackoverflow.com/comment/42185333
type: Question
has comment: http://stackoverflow.com/comment/42187828
has body: I got SQLSyntaxErrorException. Here a short extract of the error trace. Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: Syntaxfehler: Encountered ":" at line 1, column 40. Error Code: 20000 Call: select * from book where price between :min59 and :max59 Query: ReadAllQuery(referenceClass=Book sql="select * from book where price between :min59 and :max59") I called createNativeQuery("select * from book where price between :min59 and :max59", Book.class) Then I set the two parameter with query.setParameter("min59", 20.0); query.setParameter("max59", 30.0); The exception occurs during query.getResultList(); Environment: EclipseLink 2.5.1 Apache Derby 10.X Any ideas what's wrong?
has title: java.sql.SQLSyntaxErrorException: Syntaxfehler: Encountered ":"
score: 0
tagged with: sql
answer count: 1
tagged with: jpa

http://stackoverflow.com/a/26768748
answers question: http://stackoverflow.com/q/26768663
has comment: http://stackoverflow.com/comment/42118536
has body: Since your exception is: ClassNotFoundException: Didn't find class "com.kpbird.fusedlocation.MainActivity" into your AndroidManifest.xml add the complete package were your activity is located: &lt;activity android:name="com.kpbird.fusedlocation.MainActivity" or be sure to have to correct package name defined: package="com.kpbird.fusedlocation" I think you typed incorrectly the package of your application in some place of your code!
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42118658
type: Answer
has comment: http://stackoverflow.com/comment/42118946
upvote count: 11
has comment: http://stackoverflow.com/comment/42118913
score: 11
accepted answer of: http://stackoverflow.com/q/26768663

http://stackoverflow.com/a/26802835
accepted answer of: http://stackoverflow.com/q/26802657
answers question: http://stackoverflow.com/q/26802657
score: 0
type: AcceptedAnswer
has body: With Eclipse you can use the menu option Source > Externalize Strings... This only works on a single file at a time however.
type: Answer

http://stackoverflow.com/comment/42228829
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26831043
has text: You dont require long click listener for dialog
score: 0

http://stackoverflow.com/q/26808626
has comment: http://stackoverflow.com/comment/42190145
has comment: http://stackoverflow.com/comment/42190164
score: 0
has comment: http://stackoverflow.com/comment/42190018
has comment: http://stackoverflow.com/comment/42190102
answer count: 1
has comment: http://stackoverflow.com/comment/42189987
tagged with: bufferedreader
has title: Reading in specific lines from an Excel spreadsheet saved as CSV file
favorite count: 0
has body: I've got a class called TemperatureProfile, whose objects hold two attributes: an array of month names (type String[]), and and an array of temperatures (type double[]). Now, the data for these two attributes must be read from an Excel spreadsheet saved as CSV file. The month names are in the first column, and the temperatures in the second. I'm having trouble reading in the data from these separate columns. public class TemperatureProfile { private double[] temperatures; private String[] monthNames; public TemperatureProfile(String filename){ ///Read data here, and store result in monthNames and temperatures respectively. } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26808841
upvote count: 1
downvote count: 1
tagged with: excel
type: Question
tagged with: java

http://stackoverflow.com/comment/42065134
type: QuestionComment
comment on: http://stackoverflow.com/q/26739402
score: 0
has text: possible duplicate of [Java: Max/min value in an array?](http://stackoverflow.com/questions/1484347/java-max-min-value-in-an-array)
type: Comment

http://stackoverflow.com/comment/42213016
has text: @DavidWallace Oops I thought I did. Thanks for mentioning!
type: Comment
comment on: http://stackoverflow.com/a/26814257
score: 0
type: AnswerComment

http://stackoverflow.com/q/26813744
tagged with: java
upvote count: 11
has body: I have a parent fragment, within this. Upon a button click, a child dialog fragment is getting created. Now I would like to know how to call parent fragment function from child dialog fragment. Here is the sample code : /**SampleFragment.java**/ public class SampleFragment extends Fragment { // Instantiate view &amp; add event handlers public void onButtonClick(....) { // Create a dialog framgent } public void refreshView() { } } /**SampleDialogFragment.java**/ public class SampleDialogFragment extends DialogFragment { // Instantiate view for dialog public void onButtonClick(...) { // Call parent fragment method, i.e call refreshView() of SampleFragment } }
has answer: http://stackoverflow.com/a/39017790
has title: Call parent fragment method from dialog fragment
has answer: http://stackoverflow.com/a/26814141
tagged with: android
answer count: 4
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/26813817
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26813938
score: 11
type: Question
tagged with: android-fragments

http://stackoverflow.com/q/26716740
has title: Java array values as hashset
has comment: http://stackoverflow.com/comment/42023536
has body: I am new to Java and I literally have no idea how to do this. I have this Java array: String luni[]; luni = new String[] {"A","B","C"}; and I want each value A,B,C from the array to become a HashSet variable, like this: Set&lt;String&gt; luni[0] = new HashSet&lt;&gt;(500); Set&lt;String&gt; luni[1] = new HashSet&lt;&gt;(500); Set&lt;String&gt; luni[2] = new HashSet&lt;&gt;(500); Eventually having A,B,C as HashSet to which I can later use luni[0].add("string"); I hope you get the idea. How can I do this, it seems it won't work as I wrote it?
possible better answer: http://stackoverflow.com/a/26716809
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26716809
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42023637
has answer: http://stackoverflow.com/a/26716975
has comment: http://stackoverflow.com/comment/42023487
score: -1
has answer: http://stackoverflow.com/a/26717255
accepted answer: http://stackoverflow.com/a/26716975
has comment: http://stackoverflow.com/comment/42023523
answer count: 3
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42023595
tagged with: hashset
favorite count: 0

http://stackoverflow.com/q/26769081
has comment: http://stackoverflow.com/comment/42123968
has comment: http://stackoverflow.com/comment/42122559
tagged with: operator-precedence
favorite count: 0
upvote count: 2
has title: Operator Precedence Algorithm
has body: I am currently writing a compiler for a custom programming language. The compiler converts every single operator or call to an object of the form Call : Value { Value instance String name Value[] arguments } For example, the expression 3 + 4 (= 3.+(4)) becomes Call : Value { instance = Value(3) name = "+" arguments = [ Value(4) ] } The expression 3 + 4 * 5 would be evaluated by the parser as 3.+(4).*(5). Call : Value { instance = Call { instance = Value(3) name = "+" arguments = Value(4) } name = "*" arguments = [ Value(5) ] } I know have a function that creates a list of the calls in this structure and sorts them by operator precedence, and the result would look like this: [ 3.+(4).*(5), 3.+(4) ] (in the above form) What I need now is an algorithm that sorts them so that the first expression is 3.+(4.*(5)). The problem about this is that the result from above can have any length. My current implementation (which relies on it being 2 or less infix operators) does it like this: (go through all elements) { current.arguments = [ prev ] prev.instance = current.arguments[0] } I know that operator precedence is usually achieved with special constructs in BNF files for parser generation, but since I am using a custom parser that will always evaluate this left-to-right, I cannot use such solutions.
tagged with: compiler-construction
score: 2
has answer: http://stackoverflow.com/a/26771891
accepted answer: http://stackoverflow.com/a/26771891
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42197799
tagged with: java
type: Question
tagged with: algorithm
answer count: 1
tagged with: evaluation
downvote count: 0

http://stackoverflow.com/q/26749032
type: Question
has comment: http://stackoverflow.com/comment/42120765
has body: I am running into a NucleusUserException while querying an entity from DB. I have tried a long time and couldn't figure out what caused this problem. I am hoping some of you can point me into the right direction. Any help will be greatly appreciated Entity Class @PersistenceCapable(detachable = "true") public class Position implements IsSerializable, Serializable { @PrimaryKey @Persistent protected String key; @Persistent protected Double quantity; // getter and setter omitted } JDO MetaData &lt;jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo http://java.sun.com/xml/ns/jdo/jdo_3_0.xsd"&gt; &lt;package name="org.sly.main.shared.data.finance.trading"&gt; &lt;class name="Position" detachable="true" cacheable="false"&gt; &lt;version strategy="version-number" /&gt; &lt;field name="key" persistence-modifier="persistent" value-strategy="increment" primary-key="true"&gt; &lt;column length="32" jdbc-type="VARCHAR" /&gt; &lt;/field&gt; &lt;field name="quantity" persistence-modifier="persistent" /&gt; &lt;/class&gt; &lt;/package&gt; &lt;/jdo&gt; The code that i used to retrieved PersistenceManager pm = pmf.getPersistenceManager(); Extent e = pm.getExtent(Position.class, true); Query query = pm.newQuery(e); query.setFilter("key == my_key"); query.declareParameters("String my_key"); Object[] params = { "1234" }; List&lt;Position&gt; managerList = (List&lt;Position&gt;) query.executeWithArray(params); The Exception i Got is below: Cannot find mapping for field org.sly.main.shared.data.finance.trading.Position.key in table `POSITION` [`POSITION`.`KEY`, `POSITION`.`QUANTITY`] org.datanucleus.exceptions.NucleusUserException: Cannot find mapping for field org.sly.main.shared.data.finance.trading.Position.key in table `POSITION` [`POSITION`.`KEY`, `POSITION`.`QUANTITY`] at org.datanucleus.store.rdbms.table.AbstractClassTable.addApplicationIdUsingClassTableId(AbstractClassTable.j…
score: 0
tagged with: datanucleus
has title: NucleusUserException: Cannot find mapping for field
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: jdo
has comment: http://stackoverflow.com/comment/42353108

http://stackoverflow.com/a/31372959
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26695923
has body: In DetailActivity.Java you need to declare variable like this TextView myTextView; Then inside the onCreate method you need to add this String bookTitle = this.getIntent().getExtras().getString("bookTitle"); Still inside onCreate method you need to check if there is valid bookTitle if (bookTitle.length() &gt; 0) { myTextView = (TextView) findViewById(R.id.text_title); myTextView.setText(String.valueOf(bookTitle)); } In activity_detail.xml the only thing that was missing on your xml file is 'android:text="@string/textview"' at the top Change this to look something like below. Have it in mind that you will need to edit layout position to suits your app. &lt;TextView android:text="@string/textview" android:id="@+id/text_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="25dp"/&gt; The book title should now show up. Follow the same procedure to display the author name. I hope this helps.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42113065
type: Comment
comment on: http://stackoverflow.com/a/26765451
type: AnswerComment
score: 0
has text: Try comparing both the projects using beyond compare after removing the build files, if possible let me know the difference which caused the issue.

http://stackoverflow.com/a/26814759
has comment: http://stackoverflow.com/comment/42205468
type: Answer
accepted answer of: http://stackoverflow.com/q/26814673
score: 1
answers question: http://stackoverflow.com/q/26814673
upvote count: 1
has body: try like this may help you, public void agencySearch(String tsearch) { // Setting the URL for the Search by Town String url_search_agency = "http://www.infinitycodeservices.com/get_agency_by_city.php"; // Building parameters for the search List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("City", tsearch)); // Getting JSON string from URL JSONArray json = jParser.getJSONFromUrl(url_search_agency, params); ArrayList&lt;HashMap&lt;String, String&gt;&gt; resultsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); for (int i = 0; i &lt; json.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); try { JSONObject c = json.getJSONObject(position); //Fill map Iterator&lt;String&gt; iter = c.keys(); while(iter.hasNext()) { String currentKey = it.next(); map.put(currentKey, c.getString(currentKey)); } resultsList.add(map); } catch (JSONException e) { e.printStackTrace(); } }; MainActivity.setResultsList(resultsList); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26690297
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26691792
answer count: 1
score: 0
tagged with: exception
has title: java.net.ConnectException timed out
has answer: http://stackoverflow.com/a/26691792
has body: I'm using NetBeans with Java. I'm trying to extract data from a website that needs logging, I'm go into an account I extract data and then go into another, my code is working but always after a while I get: java.net.ConnectException: Connection timed out: connect. I'm using Apache HttpClient. If I use the code works on another site without the exception, if someone could help me ... Thanks. java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at navegadorsite.NavegadorSite.openPage(NavegadorSite.java:80) at navegadorsite.NavegadorSite.main(NavegadorSite.java:174)
type: AnsweredQuestion

http://stackoverflow.com/q/26830764
has title: Extract name from facebook tag in facebook graph api
has answer: http://stackoverflow.com/a/26831853
answer count: 1
score: 0
has body: I am using facebook graph api to display on my website the last facebook album of the corresponding facebook page. However in the album description, when someone has been "tagged", you get in the JSON data something like {... description : "this is the album desccription blabla the photograph is @[123456:123:PhotographerName] blabla..." ...} Is there a way to get rig of the extra stuff? I would like either only the name or a usable HTML link. Is there something possible with Facebook4j or with regexp??. Thanks! Edit : The wanted result is : {... description : "this is the album desccription blabla the photograph is PhotographerName blabla..." ...}
tagged with: regex
tagged with: facebook-graph-api
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/comment/42082190
type: AnswerComment
type: Comment
score: 0
has text: I tried that but even more errors occur because of that change. I didn't mean to add the semicolon at the end, thanks for catching that. But adding the if, as I said, gave me a lot more errors. From 1 error to 15.
comment on: http://stackoverflow.com/a/26747360

http://stackoverflow.com/comment/42061748
has text: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#01_03
type: QuestionComment
comment on: http://stackoverflow.com/q/26737840
type: Comment
score: 1

http://stackoverflow.com/q/26718277
has answer: http://stackoverflow.com/a/26719528
has comment: http://stackoverflow.com/comment/42027172
answer count: 2
accepted answer: http://stackoverflow.com/a/26719874
has comment: http://stackoverflow.com/comment/42029154
downvote count: 0
possible better answer: http://stackoverflow.com/a/26719528
favorite count: 0
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42028009
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42116769
has body: I am creating a class in the service layer of my Spring application. One method is: /** * Creates a new user account. * @return Returns true if the password reset went ok, otherwise false. */ boolean confirmPasswordReset(UserAccount account, String confirmationId, String newPassword); However, this method signature is unable to give the caller any information about what could have made the confirmation to fail. I have validation rules; the password must not be the username, the password must have 8 characters and so on. If the user fails to provide a strong password I want to reject the confirmation and return false. However I also want to communicate the validation errors. So I have the following solution, but I am unsure whether or not it is a good idea. This is my attempt: (I use Java 8, hence the Optional class) public class OperationResult&lt;T&gt; { private Optional&lt;T&gt; returnObject; private List&lt;ConstraintViolation&gt; violations; public OperationResult(Optional&lt;T&gt; returnObject, List&lt;ConstraintViolation&gt; violations) { this.returnObject = returnObject; this.violations = violations; } public Optional&lt;T&gt; getReturnObject() { return returnObject; } public List&lt;ConstraintViolation&gt; getViolations() { return violations; } } Then I change the return value of the service layer method to: OperationResult&lt;Boolean&gt; confirmPasswordReset(UserAccount account, String confirmationId, String newPassword); This is just one example, but I have several methods where this would be useful. Does this look bad from a design point of view? Throwing an exception because the password is to weak, or the password is the same as the username does not look like a good solution.
type: Question
tagged with: jakarta-ee
has title: How to communicate return value and validation errors to the caller of a method?
has answer: http://stackoverflow.com/a/26719874

http://stackoverflow.com/a/27517878
has comment: http://stackoverflow.com/comment/57345546
has comment: http://stackoverflow.com/comment/45295705
answers question: http://stackoverflow.com/q/26788464
has body: Looking at the Toolbar and TintManager source, drawable/abc_ic_ab_back_mtrl_am_alpha is tinted with the value of the style attribute colorControlNormal. I did try setting this in my project (with @color/my_awesome_color in my theme), but it's still black for me. Update: Found it. You need to set the actionBarTheme attribute (not actionBarStyle) with colorControlNormal. Eg:
score: 213
downvote count: 5
upvote count: 218
has comment: http://stackoverflow.com/comment/57980762
has comment: http://stackoverflow.com/comment/46055248
type: Answer

http://stackoverflow.com/q/26706305
score: 2
tagged with: audio
has title: Quality issue with audio conversion
downvote count: 0
has comment: http://stackoverflow.com/comment/42006345
has comment: http://stackoverflow.com/comment/42006549
tagged with: java
type: Question
has body: I am converting a mono PCM Wave file with 16bit and 48 kHz to a mono signed linear PCM AU file with 16bit and 8 kHz suitable for telephony using javax.sound.sampled: public void convertSO(final String in, final String out) throws Exception { try (final AudioInputStream ais = AudioSystem.getAudioInputStream(new File(in))) { final AudioFormat af = new AudioFormat(Encoding.PCM_SIGNED, 8000f, 16, 1, 2, 8000, false); try (final AudioInputStream cais = AudioSystem.getAudioInputStream(af, ais)) { AudioSystem.write(cais, AudioFileFormat.Type.AU, new File(out)); } } } It works like that and it sounds okay, but if I compare the quality with a similar conversion done with SoX like sox in.wav -b 16 -r 8000 -c 1 -e signed-integer out.au the high frequency range of the conversion done with javax.sound.sampled sounds scratchy while with SoX it sounds pretty smooth. Both output files have the same size and there is no difference comparing their properties with mediainfo. I am mainly wondering where the difference can come from. Is it the conversion of sample rate from 48 kHz to 8 kHz that SoX does a better job at? Or does SoX apply some fancy filter or psychoacoustic model to improve the sound quality?
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26725500
type: UnansweredQuestion
tagged with: javasound

http://stackoverflow.com/q/26792175
has answer: http://stackoverflow.com/a/26792560
linked to: http://stackoverflow.com/q/4302248
has comment: http://stackoverflow.com/comment/42160035
has comment: http://stackoverflow.com/comment/42159954
has comment: http://stackoverflow.com/comment/42159911
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42160059
has comment: http://stackoverflow.com/comment/42159978
tagged with: collections
type: Question
has body: It appears to me that it is very logical to give ArrayList an constructor which takes an array as an argument and creates an ArrayList that is equivalent to the array passed. However at the moment we do not have such constructor. Instead we have to use Arrays.asList API to convert an array to ArrayList. Why is it the case that conversion of Array to ArrayList is separated into Arrays API ? Is there any deeper thought into this design decision ?
tagged with: java
has title: Is there any good reason why ArrayList does not take Array as a constructor argument?
answer count: 1

http://stackoverflow.com/a/26773055
has body: Class.getDeclaredFields() returns the fields in the order of declaration. To get only the private ones: for (Field field : YourClass.cass.getDeclaredFields()) if (Modifier.isPrivate(field.getModifiers())) System.out.println(field.getName()); Note that inherited fields are not included, quoting from the javadoc: Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields. For that, you have to do the same for the super class and implemented interfaces (recursively). Warning: Quoting from the javadoc: The elements in the returned array are not sorted and are not in any particular order. The API does not require the returned Field array to be sorted in any way, but in practice (Oracle implementation), they are in the same order as you declared them.
type: Answer
accepted answer of: http://stackoverflow.com/q/26772952
answers question: http://stackoverflow.com/q/26772952
has comment: http://stackoverflow.com/comment/42125634
score: 3
has comment: http://stackoverflow.com/comment/42125720
upvote count: 3
has comment: http://stackoverflow.com/comment/42125805
type: AcceptedAnswer
downvote count: 0

compareto
tags question: http://stackoverflow.com/q/26789205
tags question: http://stackoverflow.com/q/26718422
type: Tag
tag name: compareto
tags question: http://stackoverflow.com/q/26832162

http://stackoverflow.com/comment/42342932
comment on: http://stackoverflow.com/a/26871345
type: AnswerComment
score: 0
has text: This looks exactly like what I was going for. I will try it later today to check with my particular use case.
type: Comment

http://stackoverflow.com/a/26801830
accepted answer of: http://stackoverflow.com/q/26801798
has comment: http://stackoverflow.com/comment/42177070
has body: public static String printStrings(String a,int b) { String s = ""; for(int i = 1; i &lt;= b; i++) { s=s+a+" "; } return s; } public static void main(String[] args) { System.out.println(printStrings("abc",5)); }
downvote count: 1
has comment: http://stackoverflow.com/comment/42177135
score: -1
has comment: http://stackoverflow.com/comment/42177019
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42177515
has comment: http://stackoverflow.com/comment/42177108
has comment: http://stackoverflow.com/comment/42177351
type: Answer
answers question: http://stackoverflow.com/q/26801798
has comment: http://stackoverflow.com/comment/42177198
has comment: http://stackoverflow.com/comment/42177110

http://stackoverflow.com/comment/42081768
has text: @CodesInChaos On the bright side, the `getRawKey` is still better than the one from Android snippets :P
comment on: http://stackoverflow.com/q/26732703
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42130652
score: 0
type: Comment
has text: The class `com.lowagie.text.Table` has been removed from iText a very long time ago. iText 1.3.1 dates from May 2005. You should not expect an answer on your question. That version was EOL years ago! You should switch to using `PdfPTable`. (And you should upgrade!)
type: QuestionComment
comment on: http://stackoverflow.com/q/26776013

http://stackoverflow.com/q/26769232
has comment: http://stackoverflow.com/comment/42119480
favorite count: 0
tagged with: icedtea
has answer: http://stackoverflow.com/a/26769462
accepted answer: http://stackoverflow.com/a/26769462
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42119118
type: Question
has body: I'm having a weird problem with BigDecimal. I have a parse method as follows: protected BigDecimal parseBigDecimalFromText(String text) { Logger.info("parseBigDecimalFromText("+text+")"); return new BigDecimal(text); } Now when I run my test the code properly works. @Test public void parseBigDecimalFromZero() { Logger.createLogger(); // given String text = "0"; // when BigDecimal bigDecimal = basicPage.parseBigDecimalFromText(text); // then Assert.assertEquals(new BigDecimal("0"), bigDecimal); } But when I execute my application passing exactly the same String "0" I got a "java.lang.NumberFormatException" Following is the log: 2014-11-05 23:21:33.142: INFO - parseBigDecimalFromText(0) 2014-11-05 23:21:33.142: SEVERE - null java.lang.NumberFormatException at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:470) at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:739) at com.aa.travian.pages.BasicPage.parseBigDecimalFromText(BasicPage.java:121) I know that when my app starts I'm setting a specific Locale: Locale locale = getConfig().getLocale(); ResourceBundle = ResourceBundle.getBundle("translations", locale); but I don't see how this should break my parseBigDecimalFromText method. Following is my java version: java -versionjava version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) Any idea what is happening here? Looking at the BigDecimal source code it looks like it falls while parsing the exponent: // exponent expected if ((c != 'e') &amp;&amp; (c != 'E')) throw new NumberFormatException(); Thanks in advance for your time.
score: 3
tagged with: bigdecimal
tagged with: numberformatexception
has title: new BigDecimal("0") NumberFormatException
answer count: 1
downvote count: 0

jar
tags question: http://stackoverflow.com/q/26706030
tags question: http://stackoverflow.com/q/26749082
tags question: http://stackoverflow.com/q/26754311
tags question: http://stackoverflow.com/q/26722623
tags question: http://stackoverflow.com/q/26798131
tags question: http://stackoverflow.com/q/26830602
tags question: http://stackoverflow.com/q/26830784
tags question: http://stackoverflow.com/q/26810859
tags question: http://stackoverflow.com/q/26689103
tags question: http://stackoverflow.com/q/26673437
tags question: http://stackoverflow.com/q/26807877
type: Tag
tags question: http://stackoverflow.com/q/26712475
tags question: http://stackoverflow.com/q/26744577
tags question: http://stackoverflow.com/q/26707831
tags question: http://stackoverflow.com/q/26787816
tags question: http://stackoverflow.com/q/26688365
tags question: http://stackoverflow.com/q/26776452
tag name: jar
tags question: http://stackoverflow.com/q/26791859
tags question: http://stackoverflow.com/q/26693640
tags question: http://stackoverflow.com/q/26714908
tags question: http://stackoverflow.com/q/26741849
tags question: http://stackoverflow.com/q/26759649
tags question: http://stackoverflow.com/q/26783215
tags question: http://stackoverflow.com/q/26732843
tags question: http://stackoverflow.com/q/26749408
tags question: http://stackoverflow.com/q/26823044
tags question: http://stackoverflow.com/q/26724228
tags question: http://stackoverflow.com/q/26721734
tags question: http://stackoverflow.com/q/26710310
tags question: http://stackoverflow.com/q/26700910
tags question: http://stackoverflow.com/q/26755460
tags question: http://stackoverflow.com/q/26807547
tags question: http://stackoverflow.com/q/26793116
tags question: http://stackoverflow.com/q/26732452
tags question: http://stackoverflow.com/q/26790508
tags question: http://stackoverflow.com/q/26736595
tags question: http://stackoverflow.com/q/26674806
tags question: http://stackoverflow.com/q/26689689
tags question: http://stackoverflow.com/q/26728317
tags question: http://stackoverflow.com/q/26734836

http://stackoverflow.com/comment/42018001
has text: Sadly, we are not allowed to touch AJAX as of yet. jQuery and JS is allowed (but minimal).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26713484

http://stackoverflow.com/comment/42257178
score: 0
has text: Sorry for the late reply. So, the basic thing I want to do is compare two list of objects and sending the logic for comparison as a pointer function/Comparable/Closure etc. The objects in list do not have to be of the same type but may have some common properties.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26811861

http://stackoverflow.com/q/26769356
type: Question
has body: currently I can recognize speech to text using google's speech api. Now that I have this, I was just wondering if there is a way I can stream the response of transcribed text and give it more text to transcribe at the same time. In other words I want to speak into the microphone, and as I speak I want a response from the google servers. The code I am using currently: System.out.println("openning connection"); HttpsURLConnection httpConn = null; ByteBuffer buff = ByteBuffer.wrap(data); byte[] destdata = new byte[2048]; int resCode = -1; OutputStream out = null; try { URL url = new URL(urlStr); URLConnection urlConn = url.openConnection(); if (!(urlConn instanceof HttpsURLConnection)) { throw new IOException ("URL must be HTTPS"); } httpConn = (HttpsURLConnection)urlConn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("POST"); httpConn.setRequestProperty("User-Agent", USER_AGENT); httpConn.setDoOutput(true); httpConn.setRequestProperty("AcceptEncoding", "gzip,deflate,sdch"); httpConn.setChunkedStreamingMode(0); //TransferType: chunked httpConn.setRequestProperty("Content-Type", "audio/l16; rate=" + sampleRate); // this opens a connection, then sends POST &amp; headers. out = httpConn.getOutputStream(); //beyond 15 sec duration just simply writing the file // does not seem to work. So buffer it and delay to simulate // bufferd microphone delivering stream of speech // re: net.http.ChunkedOutputStream.java while(buff.remaining() &gt;= destdata.length){ buff.get(destdata); out.write(destdata); }; byte[] lastr = new byte[buff.remaining()]; buff.get(lastr, 0, lastr.length); out.write(lastr); out.close(); resCode = httpConn.getResponseCode(); if(resCode &gt;= HttpURLConnection.HTTP_UNAUTHORIZED){//Stops here if Google doesn't like us/ System.out.println("unauthorized"); throw new HTTPException(HttpURLConnection.HTTP_UNAUTHORIZED);//Throws } String line;//Each line that is read back from Google. BufferedReader br…
downvote count: 0
tagged with: speech-recognition
favorite count: 0
answer count: 0
tagged with: google-api
type: UnansweredQuestion
upvote count: 1
has title: Streaming Google Speech api
has comment: http://stackoverflow.com/comment/53526510
score: 1
tagged with: java

http://stackoverflow.com/comment/42094037
score: 0
comment on: http://stackoverflow.com/a/26746069
type: Comment
has text: Yes, I have to mannually convert JSON -> Object -> JSON for the inputs/outputs to be the same. This Jackson case insensitive design is flawed.
type: AnswerComment

http://stackoverflow.com/comment/42114305
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26766159
score: 0
has text: The computer is 32 bits but looks like java is 64 bit. should i install java 32 or just eclipse 64 bit?

http://stackoverflow.com/a/26748815
has body: When you say ArrayList&lt;T&gt; a = new ArrayList&lt;T&gt; (b); it will create a new ArrayList with a copy of the data from b. However, although a new ArrayList is created, it does not copy the objects that the elements refer to. Thus, each element of a will refer to the same object as the corresponding element of b. Thus, in particular: ArrayList&lt;ArrayList&lt;Integer&gt;&gt; myTrace = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(list); only creates one new ArrayList. It does not make copies of all the ArrayList&lt;Integer&gt; elements. Thus, after the above, myTrace.get(0) == list.get(0) will be true because they are the same reference [if the lists aren't empty]. And if you do something that modifies an element, the modification will show up in both: myTrace.get(n).set(x,y) will also affect the ArrayList&lt;Integer&gt; referred to by list.get(n), because myTrace.get(n) and list.get(n) will return the same reference. You'll need a loop to copy the arrays: ArrayList&lt;ArrayList&lt;Integer&gt;&gt; myTrace = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for (ArrayList&lt;Integer&gt; sublist : list) { myTrace.add(new ArrayList&lt;Integer&gt;(sublist)); // makes a copy of the sublist } or use a stream in Java 8: ArrayList&lt;ArrayList&lt;Integer&gt;&gt; myTrace = new ArrayList&lt;&gt; ( list.stream().map(ArrayList::new).collect(Collectors.toList()));
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26748537
type: Answer
answers question: http://stackoverflow.com/q/26748537
upvote count: 1
score: 1

http://stackoverflow.com/comment/42082411
comment on: http://stackoverflow.com/q/26748506
score: 0
type: Comment
type: QuestionComment
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example). 2) One way to get images for an example, is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556).

http://stackoverflow.com/a/26718513
has comment: http://stackoverflow.com/comment/42149801
type: Answer
has comment: http://stackoverflow.com/comment/42146081
has body: You can add any attribute to any widget/element in GWT: myWidget.getElement().setAttribute("capture", "camera"); or myWidget.getElement().setAttribute("accept", "image/*;capture=camera");
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26716022
answers question: http://stackoverflow.com/q/26716022
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26758402
answers question: http://stackoverflow.com/q/26757128
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: Yeps, as lewthor says multiple tabs share a session. One way to deal with the situation is to have a tab specific url component that will be included in the session key. If you are on a product listing page, and you're opening a new tab per product, if you make sure that the urls upon tab opening are different e.g. by using product id in the url /product/{product.id}, all you have to do make the proper behaviour is append the id to session key searchresults{product.id} There is also a @SessionAttribute centric solution, a customization that serves just this purpose, descibed in the blog here and based on the older blog described here. The solution implements a CustomSessionAttributeStore, and maintaines a Map of Maps where the inner Map is the deafult SessionAttributes, identified by the conversation id (in your case the tab id) public class ConversationalSessionAttributeStore implements SessionAttributeStore, InitializingBean { @Inject private RequestMappingHandlerAdapter requestMappingHandlerAdapter; private Logger logger = Logger.getLogger(ConversationalSessionAttributeStore.class.getName()); private int keepAliveConversations = 10; public final static String CID_FIELD = "_cid"; public final static String SESSION_MAP = "sessionConversationMap"; @Override public void storeAttribute(WebRequest request, String attributeName, Object attributeValue) { Assert.notNull(request, "WebRequest must not be null"); Assert.notNull(attributeName, "Attribute name must not be null"); Assert.notNull(attributeValue, "Attribute value must not be null"); String cId = getConversationId(request); if (cId == null || cId.trim().length() == 0) { cId = UUID.randomUUID().toString(); request.setAttribute(CID_FIELD, cId, WebRequest.SCOPE_REQUEST); } logger.debug("storeAttribute - storing bean reference for (" + attributeName + ")."); store(request, attributeName, attributeValue, cId); } private String getConversationId(WebRequest request) { return request.getParameter(CID_FIELD); } } The whole…

http://stackoverflow.com/a/26765811
has body: Why do You Want to choose that Kind of Design Where there is Type Mismatch?.Its a Best Practice to have consistent data type in POJO and Tables unless and until there is solid usecase for such exceptional scenario.
score: -2
has comment: http://stackoverflow.com/comment/94536482
answers question: http://stackoverflow.com/q/26732775
upvote count: 0
type: Answer
downvote count: 2

http://stackoverflow.com/a/26785934
has comment: http://stackoverflow.com/comment/42148797
upvote count: 2
has comment: http://stackoverflow.com/comment/42149443
has comment: http://stackoverflow.com/comment/42148964
score: 2
has comment: http://stackoverflow.com/comment/42148664
answers question: http://stackoverflow.com/q/26785843
has body: getActivity().findViewById will not work on onCreateView because the view is not attached yet. Use V.findViewById instead
downvote count: 0
has comment: http://stackoverflow.com/comment/42149773
type: Answer

http://stackoverflow.com/a/26767098
has comment: http://stackoverflow.com/comment/42124982
type: Answer
has body: Programmatically, you can use DatatypeConverter
has comment: http://stackoverflow.com/comment/42116932
score: 0
answers question: http://stackoverflow.com/q/26767034

http://stackoverflow.com/comment/42088544
has text: "the browser wont allow us to do so" : can you be more specific ?
comment on: http://stackoverflow.com/q/26752613
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26683052
tagged with: arraylist
score: 0
has title: Store and get data based on their ids
answer count: 1
accepted answer: http://stackoverflow.com/a/26683086
tagged with: store
has body: I am trying to store data and get it back based on their ids.The datatypes are. int Q_ID -------&gt; Id of the Question int Type_Question ----&gt; Which type is the Question ArrayList&lt;String&gt; Options ----&gt; The options are multiple and are determined at run based on users selection of the options Now i want to store the data.For example in this way. Q_ID=0 Type_question=1 Options.add("handpump"); Options.add("Well"); Q_ID=1 Type_question=1 Options.add("random"); Options.add("answer"); Is there a way i can store them so that when i enter the Q_ID = 0 and Type_Question=1; it returns only hand pump and well and if enter Q_ID = 1 and Type_question=1 it returns only random and answer. It may be too obvious but i couldn't think of anything.Any ideas?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26683086
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41965350

http://stackoverflow.com/q/26713780
has title: Overloading methods
answer count: 3
has answer: http://stackoverflow.com/a/26713925
favorite count: 0
has answer: http://stackoverflow.com/a/26713823
has body: I saw below question posted on this site. "What happens when we pass int arguments to the overloading method having float as a parameter for one method and another having double param". I thought I understood the concept and wrote this code: public class TestClass { public static void main(String args[]) { TestClass t=new TestClass(); t.sum(1/4); } void sum(double d) { System.out.println("Double==="+d); } void sum(int i) { System.out.println("Integer==="+i); } void sum(short s) { System.out.println("Short==="+d); } } According to my understanding explained on this site (as mentioned above), I thought it will print Short===0, but to my surprise it prints Integer===0. Can any one explain this to me?
tagged with: overloading
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26713917
downvote count: 0
score: 1
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/26713917
upvote count: 1
possible better answer: http://stackoverflow.com/a/26713823

http://stackoverflow.com/comment/42013330
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26709941
score: 1
has text: The public key is only part of it. Because of the other fields, the Strings you are comparing do not match

http://stackoverflow.com/q/26787761
accepted answer: http://stackoverflow.com/a/26787827
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/219585
tagged with: jdbc
type: AnsweredQuestion
has title: not able to connect to mysql db using java
upvote count: 0
has body: Here is the code that i am using to connect to MysSQL database using java..... I am getting a runtime error... import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Java2MySql { public static void main(String[] args) { String url = "jdbc:mysql://localhost:3306/"; String dbName = "java_test"; String driver = "com.mysql.jdbc.Driver"; String userName = "root"; String password = "plsdonthack"; try { Class.forName(driver).newInstance(); Connection conn = DriverManager.getConnection(url+dbName,userName,password); conn.close(); } catch (Exception e) { e.printStackTrace(); } } } I am running it like this : java -cp "$HOME/OOPS-Files/Code/learn/Driver/mysql-connector-java-5.1.34-bin.jar" Java2MySql I have the .jar file there. Here is the Error Message That i get when i run it. I have physically gone and checked the folder com/mysql/jdbc and have found the file called Driver.java there.... Error: Could not find or load main class Java2MySql
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/26787966
type: Question
has comment: http://stackoverflow.com/comment/42151950
score: -1
possible better answer: http://stackoverflow.com/a/26787966
answer count: 2
has answer: http://stackoverflow.com/a/26787827

http://stackoverflow.com/comment/42093051
has text: There's `System.setOut`, and `PipedInputStream` and `PipedOutputStream`. (I really doubt this is the best way to go, but I'm not going to argue)
comment on: http://stackoverflow.com/q/26754727
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42118835
comment on: http://stackoverflow.com/q/26769028
score: 1
type: Comment
type: QuestionComment
has text: `Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam.` but, yeah, you could give this one a try ...

http://stackoverflow.com/q/26734102
has comment: http://stackoverflow.com/comment/42055964
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: Can you divide code using pragma-like directives in eclipse?
has body: I am currently developing a Java tool in eclipse and some files are getting pretty messy. Unfortunately it seems like one cannot spread Java classes over several files, yet I would like to keep my code organized in a some way. Back when I used Xcode for development, I could use a preprocessor directive called #pragma mark - to insert code divisions and #pragma mark TITLE to insert a title into the code division overview. See: Is there something alike in Java for eclipse? Nevertheless, there is a nice outline view which would be best suited for such a task. Thanks &amp; Regards Max UPDATE I've been made aware that the length of my class may be the key issue here, yet I don't see how I could reduce it. Before carrying on, I should mention that the example above was just to show the concept of using the #pragma mark directive and has nothing to do with my actual code. The class is a converter that parses through an RDF/XML file to extract objects from that file so they can be stored in a local HashSet&lt;&gt;. Although this code is not fully working, it contains some essential functions and (in my mind) won't get much shorter. See: Any help as to how I could organize this in a better and tidier way would be very appreciated. Thanks &amp; Regards Max
has comment: http://stackoverflow.com/comment/42055451
tagged with: pragma
tagged with: java
has comment: http://stackoverflow.com/comment/42055557
has comment: http://stackoverflow.com/comment/42055020
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42055769
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42055374
has comment: http://stackoverflow.com/comment/42055698
favorite count: 0
has comment: http://stackoverflow.com/comment/42054882
tagged with: code-organization
tagged with: xcode

http://stackoverflow.com/q/26732406
upvote count: 1
has title: Mockito throwing java.lang.NoClassDefFoundError and java.lang.VerifyError
tagged with: unit-testing
type: Question
linked to: http://stackoverflow.com/q/15617610
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/20311976
tagged with: eclipse
tagged with: mockito
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26732789
favorite count: 0
has body: I have these two classes(SimManager and Sim) that I want to create mock objects of and then use stub methods from them. 1 public class ContactTypeTest extends AndroidTestCase { 2 3 @Override 4 public void setUp() throws Exception { 5 super.setUp(); 6 7 SimManager mockSimManager = mock(SimManager.class); 8 Sim mockSim = mock(Sim.class); 9 10 when(mockSim.getOperator()).thenReturn("operator"); 11 when(mockSim.getCircle()).thenReturn(circle); 12 when(mockSimManager.findSimBySerial("simSerial")).thenReturn(mockSim); 13 14 } 15 16 } the tests are throwing these two error traces on line no 9 above. first: java.lang.VerifyError: org/mockito/cglib/core/ReflectUtils at org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167) at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217) at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117) at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109) at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105) at org.mockito.cglib.proxy.Enhancer.(Enhancer.java:70) at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:85) at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:62) at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:56) at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23) at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26) at org.mockito.internal.MockitoCore.mock(MockitoCore.java:51) at org.mockito.Mockito.mock(Mockito.java:1243) at org.mockito.Mockito.mock(Mockito.java:1120) at in.mubble.bi.test.core.message.ContactTypeTest.setUp(ContactTypeTest.java:25) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java…
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/comment/42197067
has text: This bit is from when [it was proposed](http://community.jedit.org/?q=node/view/1663) that jEdit use Maven.
comment on: http://stackoverflow.com/a/26787869
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26832909
score: 1
has body: I'm pretty convinced from RFC5246 [1] that it's not possible. If the client has sent a certificate with signing ability, a digitally-signed CertificateVerify message is sent to explicitly verify possession of the private key in the certificate. After all, what's the point of a private key if you make it public? I'll just get the server I'm connecting to to give my system user increased privileges. 1 https://www.rfc-editor.org/rfc/rfc5246
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26809772
answers question: http://stackoverflow.com/q/26809772
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26705287
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42003736
has comment: http://stackoverflow.com/comment/42003618
possible better answer: http://stackoverflow.com/a/26705500
tagged with: java
has answer: http://stackoverflow.com/a/26705500
type: Question
upvote count: 0
tagged with: palindrome
has comment: http://stackoverflow.com/comment/42003840
has body: Okay so I have no idea about how to do this problem! I need to write a code that will find the sum of all numbers less than 1 million that are palindromes in both base 10 and base 2. Could someone please help me get this problem started!
has comment: http://stackoverflow.com/comment/42003728
tagged with: radix
has comment: http://stackoverflow.com/comment/42003812
has comment: http://stackoverflow.com/comment/42003594
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/42003516
favorite count: 0
has answer: http://stackoverflow.com/a/26705480
has title: Java: Palindrome in both bases
has comment: http://stackoverflow.com/comment/42003820
score: -4
accepted answer: http://stackoverflow.com/a/26705480
has comment: http://stackoverflow.com/comment/42003821
has comment: http://stackoverflow.com/comment/42003496

http://stackoverflow.com/q/26714352
tagged with: jvm
type: UnansweredQuestion
tagged with: java
tagged with: solaris
type: Question
tagged with: crash
has answer: http://stackoverflow.com/a/27124249
score: 0
answer count: 1
has title: JVM crashing in Solaris box Problematic frame: # C [libc.so.1]# [ timer expired, abort... ]
has body: JVM(JDK 1.7) crashing in Solaris(5.11) box with following error. # A fatal error has been detected by the Java Runtime Environment: # # SIGBUS (0xa) at pc=0xffffffff7eb83be0, pid=11981, tid=3599 # # JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode solaris-sparc compressed oops) # Problematic frame: # C [libc.so.1+0x83be0]# [ timer expired, abort... ] $ pkg info entire Name: entire Summary: Incorporation to lock all system packages to the same build Description: This package constrains system package versions to the same build. WARNING: Proper system update and correct package selection depend on the presence of this incorporation. Removing this package will result in an unsupported system. Category: Meta Packages/Incorporations State: Installed Publisher: solaris Version: 0.5.11 Build Release: 5.11 Branch: 0.175.1.0.0.24.2 Packaging Date: September 19, 2012 07:01:35 PM Size: 5.46 kB FMRI: pkg://solaris/entire@0.5.11,5.11-0.175.1.0.0.24.2:20120919T190135Z java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode

http://stackoverflow.com/q/26703236
has comment: http://stackoverflow.com/comment/42000847
score: 0
has title: How to make the code run reversly? from Roman number to decimal number
has comment: http://stackoverflow.com/comment/41999798
tagged with: java
type: UnansweredQuestion
tagged with: methods
has comment: http://stackoverflow.com/comment/41999929
answer count: 0
has comment: http://stackoverflow.com/comment/42000814
has body: I already wrote a code that convert from decimal number to roman number, however, i want it to do opposite way so how can i make it possible? (This is my previous code: http://pastebin.com/QFKi0xJh ) thank you! and here is my code right now. I am just a beginner so my code is look little bit basic, please apology for that. public static void main(String[] args) { // Fill in the body Scanner in= new Scanner(System.in); String user = promptUserForNumeral(in); while (user.length()!=0) { int numb= convertNumeralToNumber(user); System.out.println("The numeral "+user+ " is the decimal number "+numb); user = promptUserForNumeral(in); } } private static String promptUserForNumeral(Scanner inScanner) { // Fill in the body System.out.println("Enter a roman numeral (Q to quit): "); String i = inScanner.nextLine(); while (i.length()&gt;=0) { if (i.length()==0) { System.out.println("ERROR! You must enter a non-empty line!"); System.out.println("Enter a roman numeral (Q to quit): "); i = inScanner.nextLine(); } else if ( i.length()==1 &amp;&amp; i.charAt(0)=='q' || i.charAt(0)=='Q') { System.out.println("Goodbye!"); System.exit(0); } } return i; } private static int convertNumeralToNumber(String numeral) { // Fill in the body int n=0; if (numeral.equalsIgnoreCase("m")) { n-=1000; } else if (numeral.equalsIgnoreCase("d")) { n=500; } else if (numeral.equalsIgnoreCase("c")) { n=100; } else if (numeral.equalsIgnoreCase("l")) { n=50; } else if (numeral.equalsIgnoreCase("x")) { n=10; } else if (numeral.equalsIgnoreCase("v")) { n=5; } else if (numeral.equalsIgnoreCase("i")) { n=1; } return n; }
tagged with: while-loop
type: Question
has comment: http://stackoverflow.com/comment/41999893

http://stackoverflow.com/a/29308182
upvote count: 1
has body: Kinda late, but I may have something. Not sure what's the cause of this problem, I`ll make some research later, but here in my Project happened the same error after I updated the android-support lib. Using an older version (that was inside HoloEverywhere library) worked normally. Try using an older version of android-support to see if works better. Maybe something went deprecated in a recent version, but I'm not sure.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26747828

http://stackoverflow.com/comment/42154757
score: 0
type: AnswerComment
type: Comment
has text: I want learn to sort strings alphabetically without the use of .compareTo
comment on: http://stackoverflow.com/a/26789261

http://stackoverflow.com/q/26721094
tagged with: http://stackoverflow.com/tag/xlsx
has body: I try to read this excel file: Test.xlsx, to do this I used an example I found on the internet, but I used this link as en example: http://howtodoinjava.com/2013/06/19/readingwriting-excel-files-in-java-poi-tutorial/ it doens't work. I copied the url for the file, so there is no error there. Whenever I run it, it doensnt show errors just : [] When I debug it, it shows me that the listsize = 0 What should I change? ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); @Override public List&lt;String&gt; getExcel(){ try { FileInputStream file = new FileInputStream(new File("C:\\Users\\user\\Documents\\Test.xlsx")); //Create Workbook instance holding reference to .xlsx file HSSFWorkbook workbook = new HSSFWorkbook(file); //Get first/desired sheet from the workbook HSSFSheet sheet = workbook.getSheet("Sheet1"); //Iterate through each rows one by one Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through all the columns if (row.getRowNum() &lt;= 7) { continue;// skip to read the first 7 row of file } Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); list.add(cell.getStringCellValue()); } //System.out.println(""); } file.close(); } catch (Exception e) { e.printStackTrace(); } return list; }
has comment: http://stackoverflow.com/comment/42032259
tagged with: netbeans
tagged with: return
score: 0
tagged with: excel
type: AnsweredQuestion
has title: reading an excel in java, variables are empty
tagged with: java
has answer: http://stackoverflow.com/a/26721277
type: Question
has comment: http://stackoverflow.com/comment/42032153
answer count: 1
accepted answer: http://stackoverflow.com/a/26721277

http://stackoverflow.com/a/26830818
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26827487
score: 2
has comment: http://stackoverflow.com/comment/42228985
answers question: http://stackoverflow.com/q/26827487
has body: Have you set chlauth (channel authentication) for the user on the svrconn channel? Channel authentication is new from MQ 7.1 onwards. The password validation is available from MQ 8 only. Basically you need to allow the remote connections from your client IP on the qmgr svrconn channel. try in the mqsc console SET CHLAUTH(MY_SVRCONN) TYPE(ADDRESSMAP) ADDRESS(ip of the client machine) USERSRC(CHANNEL) If this doesnt work, check the qmgr log. It should exactly say what is causing the 2035. A good technote is found here http://www-01.ibm.com/support/docview.wss?uid=swg21577137 Morag's really useful blog https://www.ibm.com/developerworks/community/blogs/aimsupport/entry/blocked_by_chlauth_why?lang=en
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42021550
type: QuestionComment
comment on: http://stackoverflow.com/q/26678346
has text: Note than Eclipse and Maven work nicely together. And most of eclipse configuration is automatically done when eclipse read the maven pom.xml file. We use maven only for most of our project and for some that requires some custom stuff we use maven+gradle.
score: 0
type: Comment

http://stackoverflow.com/comment/42133832
score: 0
type: AnswerComment
has text: Still, please post the ContentHandler implementation (maybe the fixed version), so other people may learn something.
type: Comment
comment on: http://stackoverflow.com/a/26764293

http://stackoverflow.com/a/26902069
score: 0
answers question: http://stackoverflow.com/q/26729809
type: Answer
has body: Try to replace this code : compile files('libs/gama_wheel_v1.0.jar') compile files('libs/PayPalAndroidSDK.jar') With this code : compile fileTree(dir: 'libs', include: '*.jar')
has comment: http://stackoverflow.com/comment/66393603

http://stackoverflow.com/q/26828793
has title: Using scanner to read file and group data
has comment: http://stackoverflow.com/comment/42224955
score: 0
tagged with: file-io
tagged with: text-files
answer count: 0
type: UnansweredQuestion
tagged with: filestream
has comment: http://stackoverflow.com/comment/42225330
type: Question
tagged with: text
tagged with: java
has body: I'm using scanner to read file and group data , ive done some work but facing problem when im tring to deal with The data sets is this. You can see a example here, that explain everything. What i ve done is this : import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class TextScanner { // static File f = new File("nrp1.txt"); public static void main(String[] args) throws FileNotFoundException { TextScanner ts = new TextScanner(); ts.readfile(); } public void readfile() throws FileNotFoundException { FileInputStream fis = new FileInputStream("nrp1.txt"); Scanner scanner = new Scanner(fis); int lineCount = 0; String firstline = scanner.nextLine(); String secondline = scanner.nextLine(); String thirdline = scanner.nextLine(); String fourthline = scanner.nextLine(); String fifthline = scanner.nextLine(); String sixthline = scanner.nextLine(); String seventhline = scanner.nextLine(); String eighththline = scanner.nextLine(); List&lt;Integer&gt; intArrRIDA = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; intArrRIDB = new ArrayList&lt;Integer&gt;(); int[] intRIDA = new int[Integer.parseInt(eighththline)]; int[] intRIDB = new int[Integer.parseInt(eighththline)]; List&lt;Integer&gt; intArrPOC = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; intArrNORBC = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; intArrRL = new ArrayList&lt;Integer&gt;(); String NoC=""; // COR arrays thirdline.trim(); String[] CoR1 = thirdline.split(" "); int[] intCoR1 = new int[CoR1.length]; for (int i = 0; i &lt; intCoR1.length; i++) { intCoR1[i] = Integer.parseInt(CoR1[i]); } fifthline.trim(); String[] CoR2 = fifthline.split(" "); int[] intCoR2 = new int[CoR2.length]; for (int i = 0; i &lt; intCoR2.length; i++) { intCoR2[i] = Integer.parseInt(CoR2[i]); } seventhline.trim(); String[] CoR3 = seventhline.split(" "); int[] intCoR3 = new int[CoR3.…

http://stackoverflow.com/a/26793089
accepted answer of: http://stackoverflow.com/q/26793075
has comment: http://stackoverflow.com/comment/42161649
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Move the declaration of numone outside the try block. Basically, numone was declared within the scope of the try block and was not available outside the scope of the try block, so moving it out would give it a wider visibility. String numone = null; int temp = 0; try { ... numone = stdIn.readLine(); temp = Integer.parseInt(numone) ; System.out.println("Your temperature is " + temp + "ºC"); if (temp &gt; 39) { System.out.println("You have fever! Go see a doctor!"); } else{ System.out.println("Don't worry, your temperature is normal"); } } catch(..) { ... }
has comment: http://stackoverflow.com/comment/42161479
has comment: http://stackoverflow.com/comment/42161772
has comment: http://stackoverflow.com/comment/42161430
has comment: http://stackoverflow.com/comment/42161514
has comment: http://stackoverflow.com/comment/42161733
type: Answer
has comment: http://stackoverflow.com/comment/42161457
upvote count: 1
answers question: http://stackoverflow.com/q/26793075
has comment: http://stackoverflow.com/comment/42161406

http://stackoverflow.com/a/26752786
answers question: http://stackoverflow.com/q/26752720
has body: public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter elemnt size "); int size = input.nextInt(); int x = 0; int[] list1Array = new int[size]; for (int y = 0 ; y &lt; size ; y++) { System.out.println("Enter number"); list1Array[x] = input.nextInt(); x++; } System.out.println(Arrays.toString(list1Array)); } Output Enter elemnt size 4 Enter number 2 Enter number 3 Enter number 4 Enter number 2 [2, 3, 4, 2]
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/28087626
has body: I'm just reading up on this, but could it be that type Integer cannot be applied to the Pattern constraint? It would explain why an UnexpectedTypeException is thrown, as it is only thrown if the type annoted does not match the constraints specification. I found the following for the Pattern constraint for EE7: "The annotated CharSequence must match the specified regular expression. The regular expression follows the Java regular expression conventions see Pattern. Accepts CharSequence. null elements are considered valid." src: http://docs.oracle.com/javaee/7/api/javax/validation/constraints/Pattern.html In EE6 it seems to be limited to String: "The annotated String must... Accepts String. null elements are considered valid." src: http://docs.oracle.com/javaee/6/api/javax/validation/constraints/Pattern.html example: @Pattern(regexp = "&lt;insert regex here&gt;") Integer evaluateMe; This should result in an UnexpectedTypeException as the Pattern constraint expects a CharSequence (EE7) or String (EE6), but finds type Integer. After typing this I read Sridhar DD's reference, which confirms it :)
answers question: http://stackoverflow.com/q/26772748
upvote count: 5
has comment: http://stackoverflow.com/comment/57151652
downvote count: 0
type: Answer
score: 5

http://stackoverflow.com/comment/42160349
has text: Well, regardless of the assignment wording or how you want to implement it (although I don't understand how an array of lists would implement a deque), my point is that this is probably what's causing your exception. The statement `new DoublyLinkedList[maxSize]` creates an array of lists, but each of them starts as `NULL`, when you later call `myList[right].insertLast(j)` in your `insertRight` function, `myList[right]` is still `NULL`.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26792197
score: 1

http://stackoverflow.com/comment/41948137
type: QuestionComment
comment on: http://stackoverflow.com/q/26673544
has text: Refer to the other answers then since you will have to override URLLoading so you wont get redirected.
score: 0
type: Comment

http://stackoverflow.com/q/26728782
type: UnansweredQuestion
tagged with: android
tagged with: android-activity
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26728812
has answer: http://stackoverflow.com/a/26728850
type: Question
has comment: http://stackoverflow.com/comment/42045755
score: -2
has comment: http://stackoverflow.com/comment/42045792
has comment: http://stackoverflow.com/comment/42045809
has title: Start Activity for result not working
answer count: 2
upvote count: 0
has body: I'm using start Activity result for starting a new activity to select a image from gallery and it will return a image path to my main activity to , so that it will insert image in my main activity, here is my code Intent intent = new Intent(getApplicationContext(), Image.class); intent.putExtra(UUID, image.getUuid().toString()); startActivityForResult(intent, PICK_IMAGE); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PICK_IMAGE: if (resultCode != RESULT_OK) return; String uuidStr = data.getStringExtra(UUID); log.v("image url",uuiStr); break; } } but i'm getting following crashes java.lang.RuntimeException: Unable to resume activity java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1,data=Intent { (has extras) }} to activity {com.write.example/com.write.example.MainWriterActivity}: java.lang.NullPointerException
favorite count: 0

http://stackoverflow.com/comment/42095603
type: Comment
has text: "show us the code where you populate rcdQuakes list." - this is part of my problem. I'm unsure how to populate this list with only earthquakes related to an individual observatory. If I could do this, I believe the method call would be closer to working. Also, thanks for the suggestions - I'll look into them!
type: QuestionComment
comment on: http://stackoverflow.com/q/26756360
score: 0

http://stackoverflow.com/comment/42066573
type: AnswerComment
has text: What exactly you need then? Can you add example in your question as well?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26739793

http://stackoverflow.com/comment/42043845
has text: @user3511198 Yes, and I do not see a format specifier for `a`.
type: Comment
comment on: http://stackoverflow.com/a/26727688
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42101905
score: 0
type: Comment
type: QuestionComment
has text: Some cases are even weirder than leap years: http://stackoverflow.com/a/11221765/2136410 and http://stackoverflow.com/a/6841479/2136410
comment on: http://stackoverflow.com/q/26760106

http://stackoverflow.com/comment/41996155
type: QuestionComment
comment on: http://stackoverflow.com/q/26701289
score: 2
has text: This question appears to be off-topic because it requires an introduction to OO programming. Stack Overflow is not a substitute for a good book, tutorial or teacher.
type: Comment

http://stackoverflow.com/a/26742096
downvote count: 0
answers question: http://stackoverflow.com/q/26742042
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42070265
has body: Well, it's actually very simple and can be illustrated using C code. In C, there are various ways of accessing a value. Using the * indicates a pointer, the &amp; indicates a memory address, and neither of those defaults to the value. For example: int *myValue; // A pointer to an integer value. Now, Java hides this from you, but it doesn't change the fact that this is what happens. Object myObject; // A pointer to an Object. == works the way it does because the compiler will take the actual value of the operands; not the values they point too. When it resolves the two objects, it is left with the memory addresses and that is what it compares. This creates the illusion that it is checking if they are the same object. Example When you type.. int x = 5; int y = 4; if(x == y) { System.out.println("Do something"); } the == is seen, and x and y are replaced with their actual values, so it becomes.. if(5 == 4) Which, any compiler worth its salt can evaluate to.. if(false) Now let's do the same thing with Objects. Object object = new Object(); Object object2 = new Object(); Now we've declared two pointers to two separate objects. The actual value of object is a memory address, as is object2, so when we compare them.. if(object == object2) this gets replaced with their memory address.. if(92305204950249t00 == 94205924059204t924) // Just random values indicating memory addresses And they are compared. They are different, so it becomes.. if(false) In exactly the same way as it would with an int.
type: Answer
accepted answer of: http://stackoverflow.com/q/26742042
score: 7
upvote count: 7

http://stackoverflow.com/comment/41948527
score: 0
type: AnswerComment
has text: i need create a subclass? (netbeans show one error to create)
type: Comment
comment on: http://stackoverflow.com/a/26673724

http://stackoverflow.com/q/26696342
tagged with: sockets
has comment: http://stackoverflow.com/comment/41990722
tagged with: readline
has body: I'm making java chatting program I read log in Server, and send it to Client First, I tested in Server public synchronized void SendLogLine(String time, String sender, String fontSize, String fontColor, String fontStyle, String msg) { System.out.println(time + "\t" + sender + "\t" + fontSize + "\t" + fontColor + "\t" + fontStyle + "\t" + msg); roomSocketWriter.println("Start Sending Log"); roomSocketWriter.println(time); roomSocketWriter.println(sender); roomSocketWriter.println(fontSize); roomSocketWriter.println(fontColor); roomSocketWriter.println(fontStyle); roomSocketWriter.println(msg); roomSocketWriter.println(delimiter); } If I print information, Server's console shows like this [14-11-01 00:06:00] room 13 black 0 user_exits However, if I print same thing in Client, it doesn't have some data. Here is Client's code String input = roomSocketReader.readLine(); while(!input.equals("end of log")) { System.out.println(input); input = roomSocketReader.readLine(); } And here is the Result of Print black 0 user_exits user_entered delimiter Start Sending Log 13 black 0 user_entered delimiter Start Sending Log [14-11-01 09:37:26] room 13 black 0 user_exits delimiter As you see, many data is lost :( (empty line is lost data) Does anyone know reason and solution? =================================================================================== I found where Client stops I tried debug. When doing the first line of Client -> String input = roomSocketReader.readLine(); debug line goes via public String readLine() throws IOException { return readLine(false); &lt;- HERE } and stops at here! String readLine(boolean ignoreLF) throws IOException { StringBuffer s = null; int startChar; boolean omitLF = ignoreLF || skipLF; synchronized (lock) { &lt;- EXACTLY DEBUG LINE DISAPPEARS AT HERE! ensureOpen();
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
type: Question
downvote count: 0
tagged with: bufferedreader
score: 1
has title: Java Socket - BufferedReader lost data
favorite count: 0
tagged with: synchronized
has comment: http://stackoverflow.com/comment/41992888

http://stackoverflow.com/comment/42002436
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26704675
has text: In your for loop, have a counter variable that goes up every time the if statement is successful, then print it after the loop.

http://stackoverflow.com/a/26730185
type: Answer
has comment: http://stackoverflow.com/comment/42049681
has comment: http://stackoverflow.com/comment/42049844
has comment: http://stackoverflow.com/comment/42050142
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26730150
has body: mat = new Row3(long [] array); should be mat = new Row3(array); When you are calling a method (or constructor) you don't have to specify the type of the argument you are passing.
score: 0
accepted answer of: http://stackoverflow.com/q/26730150

http://stackoverflow.com/a/26801930
has body: public void printStrings(String a, int b) { String printString = ""; for (int i = 0; i&lt;b; i++){ printString = printString+" "+a; } System.out.println(printString); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26801798

http://stackoverflow.com/comment/42014430
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26710309
has text: How is it used with ant <jvmarg /> ?
score: 0

http://stackoverflow.com/comment/42180906
has text: Thanks for the reply! Using that it gets rid of all the errors but when I build and run the code I get this: run: Exception in thread "main" java.io.FileNotFoundException: numbers.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:131) at java.util.Scanner.<init>(Scanner.java:611) at test2.RangeAverage.main(RangeAverage.java:17) Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds)
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26803581

drawable
tags question: http://stackoverflow.com/q/26803400
tag name: drawable
type: Tag

http://stackoverflow.com/comment/42134655
has text: I want to get it for the portlet the method is being called from
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26777941
score: 0

http://stackoverflow.com/comment/42019567
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26714061
type: Comment
has text: After putting JSON file in src file, try this : MainFrameTest.class.getClassLoader().getResource("/report.json");

http://stackoverflow.com/comment/42099644
has text: `setBackground` rather than `setForeground` should work.
score: 0
comment on: http://stackoverflow.com/q/26758451
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26751227
answers question: http://stackoverflow.com/q/26750895
has body: Instead of Query q = em.createNativeQuery("MyCounter.getSizeList"); Try this: Query q = em.createNamedQuery("MyCounter.getSizeList");
upvote count: 0
score: -2
type: Answer
downvote count: 2

http://stackoverflow.com/a/26822042
upvote count: 4
downvote count: 0
has body: Yes, this is correct. You should get a massive FPS jump by not having Display.update() because the application is literally doing nothing other than iterating through a loop and counting the time it takes to perform that iteration. It's hard to see this now since you don't have any components render to the Display, but not calling Display.update() would prevent anything from being rendered in the display window. In short, you need Display.update() to actually do anything in LWJGL. Other than that, you have a good framework for managing time in your application. I would suggest adding a 'throttle' to cap the FPS. Running the game at max speed makes you unable to standardize time and hurts your processor.
answers question: http://stackoverflow.com/q/26817143
type: Answer
has comment: http://stackoverflow.com/comment/42266080
score: 4

http://stackoverflow.com/q/26728377
answer count: 1
has body: I know storage allocation is mapping of the data code into appropriate location in main memory. But why seperate portion for different data for example stack data in java is stored in classInformation area,dynamic(object) data in heap,String data in ConstantPool(via literal when we make),Function in method area etc So Is the need for storage allocation is only to provide Ease of access as well as making our code cleaner while storing in mainmemory?
favorite count: 0
has title: why we need storage allocation in compiler
type: UnansweredQuestion
tagged with: compiler-construction
downvote count: 1
tagged with: java
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26728485
score: -1

http://stackoverflow.com/q/26798377
has title: what should be the correct format of using anotation @repository in DAO layer?
has answer: http://stackoverflow.com/a/26798630
has body: is it like @Repository or @Repository("DAOname") ? which is appropriate? why? and one major doubt regarding update and delete method in DAO layer! Is it safe to have logics in DAO layer? i mean, for eg: DAO layer @Transactional public void deleteMethod(List list) { for(list) { deleteNamedQuery(list); } }
has answer: http://stackoverflow.com/a/33993244
tagged with: dao
answer count: 2
has comment: http://stackoverflow.com/comment/55678349
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/55741904
has comment: http://stackoverflow.com/comment/55741841
type: Question

http://stackoverflow.com/comment/42203194
comment on: http://stackoverflow.com/a/26815103
score: 0
type: AnswerComment
has text: Actually when I quit by typing exit I will also get the same problem
type: Comment

http://stackoverflow.com/q/26709282
linked to: http://stackoverflow.com/q/218384
tagged with: java
has comment: http://stackoverflow.com/comment/42010392
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/3988788
favorite count: 0
has answer: http://stackoverflow.com/a/26710161
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42010789
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42010745
tagged with: swing
has body: I got null pointer exception during content adding in JFrame in Swing. public static void createAndShowGUI() { //Create and set up the window. frame = new JFrame("Data Entry Application"); //Set up the content pane. // frame = new JFrame(); addComponentsToPane(frame.getContentPane()); // null pointer exception in this line } public static void addComponentsToPane(Container pane) { if (RIGHT_TO_LEFT) { pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } Border blackline, raisedetched = null, loweredetched, raisedbevel = null, loweredbevel, empty, orangeline, redline, greenline, blueline; blackline = BorderFactory.createLineBorder(Color.black); orangeline = BorderFactory.createLineBorder(Color.ORANGE); redline = BorderFactory.createLineBorder(Color.RED); greenline = BorderFactory.createLineBorder(Color.GREEN); blueline = BorderFactory.createLineBorder(Color.blue); JButton button; pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); if (shouldFill) { //natural height, maximum width c.fill = GridBagConstraints.HORIZONTAL; } /* Header Section start*/ /* Username and designation starts */ JPanel p_username = new JPanel(); p_username.setMinimumSize(new Dimension(140, 30)); l_username = new JLabel(Login.login_username); l_designation = new JLabel("Data Entry User"); JPanel t9 = new JPanel(new GridLayout(0, 1)); t9.add(l_username); t9.add(l_designation); t9.setPreferredSize(new Dimension(140, 30)); p_username.add(t9); c.fill = GridBagConstraints.NORTH; c.gridx = 0; c.gridy = 0; c.ipady = 25; c.insets = new Insets(0, 10, 0, 0); pane.add(p_username, c); /* Username and designation end */ } Suggest some idea.
has title: Getting null pointer exception in adding frame content
downvote count: 1
type: Question

http://stackoverflow.com/comment/42095804
comment on: http://stackoverflow.com/q/26756513
score: 1
has text: @Krishna The GC will run. The CPU may be going to 100% but the JVM will have inserted 'safepoints' at the method calls, and probably the back edge of the while loop too. A safepoint is a place where the JVM checks to see if it needs to stop the application threads in order to perform GC (amongst other things too).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41963133
comment on: http://stackoverflow.com/a/26682094
type: AnswerComment
score: 0
has text: Nvm missed the "simple getter part", my bad.
type: Comment

http://stackoverflow.com/comment/42129437
type: Comment
comment on: http://stackoverflow.com/a/26752917
type: AnswerComment
score: 0
has text: Alex, thanks for the reply, I considered that, but the problem is that's many many many calls to readInt(), and then I'm just wasting time in a time critical function. Right now I'm calling readFully() with the size so it can copy it into the buffer in one shot, but then I have the type problem. So I'm trying to minimize everything in this function because it's spending too much time there as-is, ideally 1 copy out of the stream into the bmp buffer, and no iteration to do so. Never-the-less, I will try it and measure some metrics.

http://stackoverflow.com/a/48764202
upvote count: 1
score: 1
has body: This is how I resolved it: I added a dependency on eclipselink JPA https://mvnrepository.com/artifact/org.eclipse.persistence/org.eclipse.persistence.jpa I added a converter to my UUID @Id @TypeConverter(name = "uuidConverter", dataType = Object.class, objectType = UUID.class) private UUID uuid;
downvote count: 0
answers question: http://stackoverflow.com/q/26749128
type: Answer

webdriver
tags question: http://stackoverflow.com/q/26742014
type: Tag
tags question: http://stackoverflow.com/q/26824979
tags question: http://stackoverflow.com/q/26771908
tags question: http://stackoverflow.com/q/26748103
tags question: http://stackoverflow.com/q/26798746
tags question: http://stackoverflow.com/q/26772372
tag name: webdriver
tags question: http://stackoverflow.com/q/26758902
tags question: http://stackoverflow.com/q/26783915
tags question: http://stackoverflow.com/q/26752452
tags question: http://stackoverflow.com/q/26752514

http://stackoverflow.com/a/26944654
answers question: http://stackoverflow.com/q/26745364
has body: In Debian-based installations R uses /etc/R/Makeconf settings for building libraries. One of the setting there is JAVA_HOME. Try setting the correct path there and reinstall the package.
score: 0
type: Answer

http://stackoverflow.com/comment/42186646
type: Comment
has text: No problem, you are so close, just have to figure out this error. try `System.out.println(stringArr[i]);` at the start of the loop
comment on: http://stackoverflow.com/a/26805977
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42013994
score: 1
type: QuestionComment
type: Comment
has text: It is `ActionListener`, not `ActionListner`. Use a proper IDE
comment on: http://stackoverflow.com/q/26711358

http://stackoverflow.com/comment/42109743
comment on: http://stackoverflow.com/q/26764234
score: 0
type: Comment
has text: ASCII is a 7-bit character set. Do you mean you want to use the first 64 of those 128 characters?
type: QuestionComment

http://stackoverflow.com/comment/42168109
type: QuestionComment
has text: Ah, always good to know the motivation :) Posted an answer based on that.
score: 0
comment on: http://stackoverflow.com/q/26787697
type: Comment

http://stackoverflow.com/comment/42033683
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26721749
has text: Do you have installed the legacy Java SE 6 runtime? 64 bits or 32 bits version? If so, what is the path?
type: Comment

http://stackoverflow.com/a/26836260
answers question: http://stackoverflow.com/q/26825926
has comment: http://stackoverflow.com/comment/42270507
has comment: http://stackoverflow.com/comment/42295052
has body: Input to a MapReduce job is specified by the FileInputFormat.addInputPath() method. As the method name implies, the addInputPath() method may be called more than once to specify additional files and/or directories as input to the MapReduce job. There may therefore potentially be multiple paths as input to a single MapReduce job. A Mapper task operates on a single split. Thus it makes sense for a Mapper to be able to retrieve the path for the particular split that is is processing. Reducers however typically operate on the output of multiple mappers whose input splits may (possibly) have had different paths. Therefore within a Reducer there isn't a concept of an InputSplit, which is why you can't get a path to it.
score: 0
type: Answer

http://stackoverflow.com/a/26816655
score: 0
type: AcceptedAnswer
has body: Obviously I am still an amateur android developer. Blaze Tama was right that I have a very bad and inefficient code. Found a way better implementation in another stackoverflow article below which solved my problem. Wohoooo! How can I update a single row in a ListView? I encountered another issue though by which the checkbox at the bottom of my long ListView (and are not are not visible on the screen unless you scroll down) does not update. Anyway, marking this as answered. :-) Thanks guys for the interaction!
answers question: http://stackoverflow.com/q/26814614
type: Answer
accepted answer of: http://stackoverflow.com/q/26814614

http://stackoverflow.com/comment/41963308
has text: My real data has nothing to do with tracks and albums, this was just an analogy. Either way "trackNumber" is just some meta data that may or may not be there. The Hibernate delete-all query should not even depend on this column, and in fact doesn't seem to when I remove the many-to-one mapping... but alas, I require it...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26682102

http://stackoverflow.com/comment/42127100
type: Comment
type: QuestionComment
score: 1
has text: Yes, you can. Where is the code and the mapping?
comment on: http://stackoverflow.com/q/26773975

http://stackoverflow.com/q/26811140
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42194993
has answer: http://stackoverflow.com/a/26811398
has comment: http://stackoverflow.com/comment/42194945
tagged with: android-alertdialog
type: AnsweredQuestion
downvote count: 0
has title: How do I wait for user input when opening a alert dialog in android
tagged with: multithreading
has body: Okay, so I wrote this code, where I use a thread to open some alert dialogs. The problem is that the thread doesn't wait for the first dialog to close before opening the second dialog. As you can see in the code I used wait() between opening the two dialogs and usenotify() in the onClick events of the buttons in the dialogs. I use the runOnUidThread() function to show the created dialogs. For some reason, when I open the activity the dialogs won't open and the app will have a black screen and the app will eventualy stop working. When I comment out the wait() statements (including the try and catch statements), the activity shows both the alert dialogs after each other. So is it even possible to wait for user input like this? Or am I doing something completly wrong. Thank you. HEre is my code : public class EditTagActivity extends Activity { AlertDialog alertDialog1, alertDialog2; Thread dialogManager = new Thread() { @Override public void run() { runOnUiThread(showDialog1); try { synchronized(dialogManager) { Log.d("Threads", "wait()"); dialogManager.wait(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } runOnUiThread(showDialog2); try { synchronized(dialogManager) { Log.d("Threads", "wait()"); dialogManager.wait(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; Thread showDialog1 = new Thread() { @Override public void run() { Log.d("Threads", "alertDialog1.show();"); alertDialog1.show(); } }; Thread showDialog2 = new Thread() { @Override public void run() { Log.d("Threads", "alertDialog2.show();"); alertDialog2.show(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_tag); Log.d("Threads", "setup()"); setup(); } void setup() { Log.d("Threads", "g.run()"); createAlertDialog(); dialogManager.run(); } void createAlertDialog() { Builder alert = new AlertDialog.Builder(this); ale…
has comment: http://stackoverflow.com/comment/42195050
type: Question
has comment: http://stackoverflow.com/comment/42194787
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26811398
tagged with: ui-thread
has comment: http://stackoverflow.com/comment/42194964
answer count: 2
has comment: http://stackoverflow.com/comment/42195903
has comment: http://stackoverflow.com/comment/42194812
upvote count: 1
has answer: http://stackoverflow.com/a/26811207
accepted answer: http://stackoverflow.com/a/26811207

http://stackoverflow.com/a/26798562
has comment: http://stackoverflow.com/comment/42172376
answers question: http://stackoverflow.com/q/26798262
type: Answer
has comment: http://stackoverflow.com/comment/42172332
has body: There are many issues in your code: 1) Change the line : int start = browserRequest.indexOf(("Host: ") + 6); To: int start = browserRequest.indexOf("Host:") + 6; As mentioned in ToYonos's answer, becuase it is wrong. 2) You have to make sure that the two variables start and end are not equal to -1(if they doesn't exist in browserRequest): if(end&gt;start &amp;&amp; start&gt;0) { String host = browserRequest.substring(start, end-1 ); } This will avoid many Exceptions.
score: 0

http://stackoverflow.com/q/26783453
has body: I'm trying to use the Factual API Android driver as found at this link with a project: https://github.com/Factual/factual-java-driver/tree/master-android I've previously found some Factual jars that aren't compatible with Android, so I presume I need to compile this driver into a jar, but I'm not sure, and I'm having difficulty finding the driver already pre-compiled into a jar. Does anyone know where I can find pre-compiled android jars, or can point me in the direction of how I should go about compiling this driver into a jar, if that's the best way of using it?
has title: How to use Factual API Android driver?
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26784382
type: Question
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/26784382

http://stackoverflow.com/a/26764237
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: There are no such Buildins. In addition, Java does not permit operator overloading, so you would never be able to write something like: myBoundedInt i = 13; But rather: myBoundedInt i = new myBoundedInt(13); //... i.setValue(42); As far as i know, Dlang does have builtin assertions for classes to guarantee that certain conditions are fulfilled for the whole lifespan of an object. Maybe you want to look into this.
answers question: http://stackoverflow.com/q/26764041

http://stackoverflow.com/a/26883064
score: 0
type: Answer
has body: Add all jar files in following folders in your build path: .../GATE_Developer_7.1/bin/ .../GATE_Developer_7.1/lib/
has comment: http://stackoverflow.com/comment/42438308
answers question: http://stackoverflow.com/q/26826996

metadata
tags question: http://stackoverflow.com/q/26822088
tag name: metadata
type: Tag

http://stackoverflow.com/q/26725538
has title: Fetch data in database into jradiobutton java
score: 0
has answer: http://stackoverflow.com/a/26729258
type: UnansweredQuestion
tagged with: jradiobutton
type: Question
tagged with: java
tagged with: database
tagged with: mysql
has body: So far i can only get the question in my database table.It looks like this question in jtextfield. Example: Johnny's mother had three children.The first child was called April,the second child was called May.What was the third child's name? - radiobutton June - radiobutton Johny - radiobutton John - radiobutton Johnny How can i put the values in my database table to jradiobutton. and compare them to the value the user selected.
answer count: 1

http://stackoverflow.com/a/26814904
type: Answer
accepted answer of: http://stackoverflow.com/q/26814881
answers question: http://stackoverflow.com/q/26814881
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: You should replace variable i with j here: if(ta[i]&lt;ta[min]) { temp=ta[i]; ta[i]=ta[min]; ta[min]=temp; }

http://stackoverflow.com/comment/45717093
type: Comment
comment on: http://stackoverflow.com/a/28678790
score: 0
type: AnswerComment
has text: I got an answer from AWS support the same as you mentioned. Thank you anyway

http://stackoverflow.com/comment/42212161
has text: I think the purpose of having the setIsbn is to understand the methods moving forward. I don't it's necessary, but the professor wants it included just the same
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26821049
type: Comment

http://stackoverflow.com/q/26769948
has title: How can I see if two rectangles have one equal point using java?
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26770037
has body: I have rectangle A = upper left point (-4,-1), bottom right point (-2-2) and rectangle B upper left point (-2,-2), bottom right point (-1,-3) then: Rectangle first = new Rectangle(-4,-1,2,1); //x1,y1,width,height Rectangle second = new Rectangle(-2,-2,1,1); OK, I have 2 rectangles with 1 same point. I use first.intersects(second) and this returns false.. How can I use java to do this, I need something return True if One point or more into Rectangle A belongs Rectangle B? My code now: public class GeometriaRectangle2 { public static void main(String[] args) { Scanner lector = new Scanner(System.in); while (lector.hasNextLine()) { String a[] = lector.nextLine().split(","); int b[] = new int[a.length]; for (int i = 0; i &lt; a.length; i++) { b[i] = Integer.parseInt(a[i]); } int c = Math.abs(b[0] - b[2]); int d = Math.abs(b[1] - b[3]); int e = Math.abs(b[4] - b[6]); int f = Math.abs(b[5] - b[7]); Rectangle r = new Rectangle(b[0], b[1], c, d); Rectangle r2 = new Rectangle(b[4], b[5], e, f); int tw = r.width; int th = r.height; int rw = r2.width; int rh = r2.height; if (rw &lt;= 0 || rh &lt;= 0 || tw &lt;= 0 || th &lt;= 0) { System.out.println(false); } int tx = r.x; int ty = r.y; int rx = r2.x; int ry = r2.y; rw += rx; rh += ry; tw += tx; th += ty; // overflow || intersect or attached if ((rw &lt; rx || rw &gt;= tx) &amp;&amp; (rh &lt; ry || rh &gt;= ty) &amp;&amp; (tw &lt; tx || tw &gt;= rx) &amp;&amp; (th &lt; ty || th &gt;= ry)) { System.out.println(true); } else { System.out.println(false); } } } } Example: input: -3,3,-1,1,1,-1,3,-3 -3,3,-1,1,-2,4,2,2 output: False True
has comment: http://stackoverflow.com/comment/42120326
favorite count: 0
has comment: http://stackoverflow.com/comment/42120547
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26770037
downvote count: 0
has comment: http://stackoverflow.com/comment/42120385
linked to: http://stackoverflow.com/q/14616829
type: Question
has answer: http://stackoverflow.com/a/26770145
accepted answer: http://stackoverflow.com/a/26770145
tagged with: java

http://stackoverflow.com/comment/42256849
type: QuestionComment
has text: It looks like several issues you are seeing. For the insert, you were not seeing it put quotes around the '1' when you were running Liquibase on windows? In the `<insert>` tag are you using valueNumeric="1" or value="1" ? Can you include the changeLog in the question?
comment on: http://stackoverflow.com/q/26811874
score: 0
type: Comment

hypermedia
type: Tag
tags question: http://stackoverflow.com/q/26796687
tag name: hypermedia

http://stackoverflow.com/a/26699009
answers question: http://stackoverflow.com/q/26677385
score: 2
has comment: http://stackoverflow.com/comment/42054597
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42052818
type: Answer
has comment: http://stackoverflow.com/comment/42061901
accepted answer of: http://stackoverflow.com/q/26677385
upvote count: 2
has body: Is there anyway of telling the selection model that certain cells should be ignored? No, selectionModels have no notion of un/selectable. Or is it more likely I have to write a selection model from scratch? Strictly speaking, a custom TableViewSelectionModel can't be implemented from scratch - it extends MultipleSelectionModelBase which is package private (as is TableViewArrayListSelectionModel, a static class inside TableView). The nearest to "scratch" would be to basically c&amp;p TableViewArrayListSelectionModel and implement ignoring cells as needed. Would require dirty, reflective access to hidden super methods/fields ... IMO, there is no nice solution to your requirement (short of writing a TableView from scratch). A possible dirty (at a similar level as your skin laying out over-spanned cells with width 0) might be to keep the spanning cell selected if any of the spanned cells is selected. Still has a slight useability glitch in that there is no perceptible change on left/right - but at least the selection doesn't disappear. A crude version (PlainTableCell is c&amp;p default in TableColumn): public static class SpanTableCell&lt;S, T&gt; extends PlainTableCell&lt;S, T&gt; { private ListChangeListener&lt;TablePosition&gt; selectedListener = c -&gt; { while (c.next()) { if (c.wasAdded() || c.wasRemoved()) { updateSelection(); } } }; private WeakListChangeListener weakSelectedListener = new WeakListChangeListener&lt;&gt;(selectedListener); private ChangeListener&lt;TableView&gt; tableViewListener = (t, old, value) -&gt; { if (old != null &amp;&amp; old.getSelectionModel() != null) { old.getSelectionModel().getSelectedIndices().removeListener(weakSelectedListener); } if (value != null &amp;&amp; value.getSelectionModel() != null) { value.getSelectionModel().getSelectedIndices().addListener(weakSelectedListener); } updateSelection(); }; private WeakChangeListener weakTableViewListener = new WeakChangeListener(tableViewListener); public SpanTableCell() { tableViewPr…
has comment: http://stackoverflow.com/comment/42067757
has comment: http://stackoverflow.com/comment/42061394

http://stackoverflow.com/q/26728229
has comment: http://stackoverflow.com/comment/42045455
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26728560
possible better answer: http://stackoverflow.com/a/26728500
has comment: http://stackoverflow.com/comment/42045014
tagged with: image
has answer: http://stackoverflow.com/a/26728500
has comment: http://stackoverflow.com/comment/42045064
has body: It's my first post here and my English isn't pretty well so i hope you guy's understand what problem i have and also i hope i do nothing wrong here. My Problem: I'm learning atm Swing and how it works, but i have always some problems with picture which doesnt show up. Maybe i dont understand some part of Swing so i hope you can explain me why the picture doesnt loading so i can learn it and do a better work : ) i tried much variatons but i really only failed and i dont know why. i tried it also with graphics. My Program: JFrame -> JPanel -> JLabel (which have the picture and should put it on JPanel or maybe there is a direct way on JPanel) test2.jpg is in my package folder and eclipse dont shout an error. also i would JPanel in an separate class like it is and dont would extend JFrame to Gui class. Here are my 3 classes: Start: package verwaltungssoftware; public class Start { //Start der Applikation public static void main(String[] args) { System.out.println("Willkommen bei der Verwaltungssoftware fuer die Jobsuche"); new Gui(); } } Gui: package verwaltungssoftware; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JFrame; public class Gui { //Importiert Auflösung des Bildschirms Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); //Setzt Variablen für die Auflösung public int aufloesungBreite = screenSize.width; public int aufloesungHoehe = screenSize.height; //Setzt die Berechnung des JFrame hauptfenster Location private int breite = aufloesungBreite/2 - 640; private int hoehe = aufloesungHoehe/2 - 400; public Gui() { JFrame hauptfenster = new JFrame("Verwaltungssoftware fuer die Jobsuche"); hauptfenster.setDefaultCloseOperation(hauptfenster.EXIT_ON_CLOSE); hauptfenster.setResizable(false); hauptfenster.setLocation(breite, hoehe); hauptfenster.setSize(1280,800); hauptfenster.setLayout(new BorderLayout(5,5)); //Addet hauptpanel zum JFrame Panel hauptpanel = new Panel(); hauptfenste…
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26728560
tagged with: embedded-resource
has title: Java Swing Image doesn't show
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26828861
type: AnsweredQuestion
tagged with: java
type: Question
has title: how to add excludeMethods parameter list for custom interceptor in struts2
tagged with: struts2
score: 0
answer count: 1
has body: How can I add excludeMethods parameter list for my custom interceptor in struts.xml file. workflow and validation interceptor have this parameter i.e excludeMethods through witch the workflow interceptor will not fire for excluded methods as described like this: doSomething Success.jsp This I know. What I want to know is how can I do the same for my custom interceptor. I tried but failed. Here is my code: index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/struts-tags" prefix="s" %> Insert title here <s:url action="go2" method="forGo2" var="v_go2"/> <a href="<s:property value='#v_go2'/>">HIT to check if excludeMethods parameter working or NOT. struts.xml <?xml version="1.0" encoding="UTF-8"?> forGo2 /welcome2.jsp custom-interceptor package pack; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.Interceptor; public class MyInterceptor2 implements Interceptor{ @Override public void destroy() { // TODO Auto-generated method stub } @Override public void init() { // TODO Auto-generated method stub } @Override public String intercept(ActionInvocation ai) throws Exception { // TODO Auto-generated method stub System.out.println("#####Inside Interceptor#####"); ai.invoke(); } } Action Class package pack; import com.opensymphony.xwork2.ActionSupport; public class GoAction extends ActionSupport{ public String forGo2(){ return "success"; } } Output generated without any errors. But in console output I am viewing "#####Inside Interceptor#####" that I did not expected because I excluded the interceptor for forGo2 method. How can I exclude this interceptor for any given method in this case like forGo2.
has answer: http://stackoverflow.com/a/26828912
accepted answer: http://stackoverflow.com/a/26828912

http://stackoverflow.com/a/26684989
has body: Try this: public static void main(String[] args) { recurse(1, true, 1); } public static void recurse(int n, boolean loop, int add) { String temp = ""; String out = ""; for (int i = 0; i &lt; n; i++) { temp += " "; } if (add &gt; 0) { out = temp + "This was written by call number "; } else { out = temp + "This ALSO written by call number "; } if (n == 1 &amp;&amp; !loop) { System.out.println(out + n + "."); return; } else if (n == 1) { recurse(n+add, false, add); } else if (n == 5) { add = add - 2 * add; recurse(n+add, false, add); } else { System.out.println(out + n + "."); recurse(n+add, false, add); } }
has comment: http://stackoverflow.com/comment/41968058
upvote count: 1
answers question: http://stackoverflow.com/q/26684809
has comment: http://stackoverflow.com/comment/41968117
score: 1
has comment: http://stackoverflow.com/comment/41968083
downvote count: 0
type: Answer

http://stackoverflow.com/a/26810162
accepted answer of: http://stackoverflow.com/q/26809532
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26809532
has body: You could create a separate class in your project that handles JDBC connections. So for example, you could have a class called "JDBC" which creates a connection in a "connect()" method. You could then call that connection from your other classes like so: Connection connect = JDBC.connect();
score: 0

http://stackoverflow.com/q/26687573
has title: i have problems in this code and i get yes in the all answer
tagged with: java
has comment: http://stackoverflow.com/comment/41972538
has comment: http://stackoverflow.com/comment/41972503
has body: Write a program that, when given a String s and a char c, prints out ‘yes’ if c exists in s. Otherwise prints out ‘no’. (You are expected to do it using loops. You can use only length() and charAt() functions of String type.) Examples: south u --&gt; yes north T --&gt; no Output should look exactly like this: &gt;Please enter a string: &gt;ahmet &gt;Please enter a char: &gt;m &gt;yes I tried to implement it, but I don't know what is the problem in my code. I always get "true". In my implementation I used an integer that can be 0 or 1. If it is 0 I print false. If it's 1 I print true. This is my code: package ass32; import java.util.Scanner; public class ass33 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("give me any string : "); String name = in.next(); System.out.println("&gt;Please enter a char: "); char c = in.next().charAt(0); int e = 0 ; int t = name.length(); char f ; char s ; for ( int i = 0 ; i &lt;t ; i++) { f = name.charAt(i); for ( int j = 0 ; j &lt;t ; j++) { s = name.charAt(j); if (s==f) e = 1 ; } } if (e==1 ) System.out.println("yes"); else if (e==0 ) System.out.println("no"); } }
has answer: http://stackoverflow.com/a/26687687
has answer: http://stackoverflow.com/a/26687601
type: Question
accepted answer: http://stackoverflow.com/a/26687601
tagged with: string
answer count: 3
score: -6
favorite count: 0
possible better answer: http://stackoverflow.com/a/26687625
upvote count: 1
has answer: http://stackoverflow.com/a/26687625
downvote count: 7
type: AnsweredQuestion

http://stackoverflow.com/q/26714155
tagged with: swing
has comment: http://stackoverflow.com/comment/42018707
type: Question
score: 3
has answer: http://stackoverflow.com/a/26743189
has comment: http://stackoverflow.com/comment/42019167
has title: JRootpane - setting glasspane to visible doesnt intercept mouse events
has body: I have a JFrame and a JPanel hierarchy inside it, i want to implement an inner panel that i can make it look "disabled"(while other panels dont change), that is, to cover it by a semi transparent gray layer and intercept all mouse and perhaps even keyboard events that are dispatched to this panel. ive been searching for a solution and didnt really find a good one yet. The closest i got to a solution was when i used JRootPane, whenever i want it disabled i make its glasspane visible. the glasspane had been set to be opaque and with semi transparent background. A simple example of my attempt : public class Test extends JFrame { private final JPanel jPanel; public Test() { jPanel = new JPanel(); final JButton jButton = new JButton("Hidden"); jButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("hidden is clicked!"); } }); final JRootPane jRootPane = new JRootPane(); jPanel.add(jRootPane); final JPanel glassPane = new JPanel(); final JButton jButton2 = new JButton(); jButton2.addActionListener(new ActionListener() { private boolean visible = true; @Override public void actionPerformed(ActionEvent e) { glassPane.setVisible(visible = !visible); } }); jPanel.add(jButton2); jRootPane.getContentPane().add(new JScrollPane(jButton)); glassPane.setBackground(new Color(0.5f, 0.5f, 0.5f, 0.2f)); glassPane.setOpaque(true); jRootPane.setGlassPane(glassPane); glassPane.setVisible(true); getContentPane().add(jPanel); } public static void main(String[] strings) { final Test test = new Test(); test.pack(); test.setVisible(true); } } But the problem is that even when the glass is visible on top of the content, it doesnt intercepts events from getting to the content as it should, as documented here.
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26743189
has comment: http://stackoverflow.com/comment/42018727
tagged with: glasspane
has comment: http://stackoverflow.com/comment/42019065
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42022950
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/9729692

http://stackoverflow.com/comment/42094413
score: 0
has text: For sure they are needed at runtime too.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26755460

http://stackoverflow.com/comment/42099983
type: AnswerComment
score: 0
type: Comment
has text: Ok, I just tried that and it works. Thank you very much!
comment on: http://stackoverflow.com/a/26759257

http://stackoverflow.com/comment/41959757
type: QuestionComment
has text: Did you set your database encoding (using pragma) before inserting data or creating tables?
score: 1
comment on: http://stackoverflow.com/q/26680356
type: Comment

http://stackoverflow.com/comment/42124252
comment on: http://stackoverflow.com/q/26769019
score: 0
type: Comment
type: QuestionComment
has text: You probably want to paint on the fill instead of stroke, and then mask the fill to get the ring.

http://stackoverflow.com/comment/42223605
type: QuestionComment
has text: Changing to `private Integer neoEbId;` did not helped. Lombok 0.12 is the newest i get from maven artefact search in intellij. Don't know why.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26827320

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/26708053
tags question: http://stackoverflow.com/q/26795007
tags question: http://stackoverflow.com/q/26791041
tags question: http://stackoverflow.com/q/26744249
type: Tag
tags question: http://stackoverflow.com/q/26743193

http://stackoverflow.com/comment/42297230
type: QuestionComment
has text: I think it is very unlikely that this can be done when the 3.x compatibility code is included. You might be able to place a view in the editor area using the e4 APIs but I would expect that to confuse the compatibility code.
comment on: http://stackoverflow.com/q/26776802
score: 0
type: Comment

http://stackoverflow.com/a/26800178
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26793880
score: 1
has body: 1) Overloading happens at compile time i.e which method definition to execute is decided at compile time. 2) You are assigning derived class object reference to base class object at run time. 3) So it is obviously not known at compile time which reference your base class object will have in future i.e at run time. 4) this is the reason why compiler looks at the type of reference in case of method overloading

http://stackoverflow.com/comment/41963296
type: Comment
type: QuestionComment
has text: Is there a reason your management doesn't want to use jconsole?
comment on: http://stackoverflow.com/q/26676947
score: 0

http://stackoverflow.com/comment/42116616
has text: i have tried it already and keep getting this result in to one of the field of the table "org.apache.derby.client.net.NetResultSet42@7b06a956"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26767367
type: Comment

http://stackoverflow.com/a/26805943
answers question: http://stackoverflow.com/q/26805757
score: 2
accepted answer of: http://stackoverflow.com/q/26805757
downvote count: 0
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: To grab a integer value from the user, you use .nextInt(). In this case, test_grade = user_input.nextInt(); test_grade gets the value entered from the user. However, test_grade is declared as a String variable. You'll need to change that to a int.

http://stackoverflow.com/q/26747828
has body: I have one activity that hosts one fragment at a time, and swaps between two fragments. Fragment A starts Fragment B using a button, and Fragment B starts fragment A either using a button or the back button. Everything works fine when going from Fragment A to B and from B to A using the custom buttons. The problem is when I use the back button to go from Fragment B to A (Fragment A adds the transaction to the back stack). When pressing the back button while on Fragment B, I get several "Could not find class android.transition.Transition" exceptions and "Unable to resolve check-cast 1217 warnings, like 11 of each, which don't crash the program: I have no idea what this means, or how this can be solved. This is how Fragment A starts Fragment B: mButtonNextFragment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentManager fm = getActivity().getSupportFragmentManager(); Fragment fragment = FragmentTwo.newInstance(mCount); fragment.setTargetFragment(FragmentOne.this, 0); fm.beginTransaction() .addToBackStack("transaction1") .replace(R.id.layout_fragmentContainer, fragment) .commit(); } }); This is how Fragment B starts Fragment A: mButtonPrevFragment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentManager fm = getActivity().getSupportFragmentManager(); fm.beginTransaction() .replace(R.id.layout_fragmentContainer, getTargetFragment()) .commit(); } }); And this is how the host activity starts Fragment A: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment_container); FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.layout_fragmentContainer); if (fragment == null) { fragment = new FragmentOne(); fm.beginTransaction() .add(R.id.layout_fragmentContainer, fragment) .commit(); } } Anyone knows the cause of this problem? Here is the complete error log: http://past…
has comment: http://stackoverflow.com/comment/42081387
type: Question
score: 8
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43114301
has title: "Could not find class android.transition.Transition" exception when pressing back button
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42217515
has comment: http://stackoverflow.com/comment/44219022
favorite count: 0
has comment: http://stackoverflow.com/comment/42081396
upvote count: 8
tagged with: exception
has answer: http://stackoverflow.com/a/29308182
tagged with: android
has comment: http://stackoverflow.com/comment/42102405
has comment: http://stackoverflow.com/comment/42082921
type: UnansweredQuestion
tagged with: java

parameter-passing
tags question: http://stackoverflow.com/q/26739357
tags question: http://stackoverflow.com/q/26797354
tags question: http://stackoverflow.com/q/26800546
tags question: http://stackoverflow.com/q/26816164
tag name: parameter-passing
type: Tag
tags question: http://stackoverflow.com/q/26802482
tags question: http://stackoverflow.com/q/26779113

http://stackoverflow.com/comment/42254036
has text: In short, I've to pronounce that you're brilliant. Being a novice, I tried my best but failed; your simple approach made it successful! I am truly grateful to you. It ran several times successfully and it shows hows impeccable your codes are. But after running several times flawlessly, the project started crashing, probably due to some error pertaining to the emulator. Console displayed: Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE. Added android:installLocation="preferExternal" to the Manifest but nothing changed at all. What should I do now?
comment on: http://stackoverflow.com/a/26743013
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26827368
has answer: http://stackoverflow.com/a/26827479
has comment: http://stackoverflow.com/comment/42222600
favorite count: 0
has body: I need to print an empty square and my code prints this instead, and I have no idea why. ****** * * * * * * * * ****** Can you explain why it's a rectangle and not a square and how can I fix it? This is my code: public static void main(String[] args) { // TODO Auto-generated method stub int m = 6; for (int i = 1; i &lt;= m; i++) { for (int j = 1; j &lt;= m; j++) { if (i == 1 || i == m) System.out.print("*"); else if (j == 1 || j == m) System.out.print("*"); else System.out.print(" "); } System.out.println(); } }
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26827479
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/60710447
tagged with: loops
possible better answer: http://stackoverflow.com/a/26827374
has answer: http://stackoverflow.com/a/26827537
type: Question
has answer: http://stackoverflow.com/a/26827374
downvote count: 0
score: 3
has title: printing an empty square using loops

http://stackoverflow.com/comment/42208232
score: 1
has text: Optimization is needed when you have a performance problem. Do you have one? If so, have you measured the time taken by every operation, to know what needs to be optimized? If you don't have any performance problem, then you don't need to optimize anything.
comment on: http://stackoverflow.com/q/26819015
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42050276
score: 0
type: Comment
type: QuestionComment
has text: I have a couple of projects (of my own) on synthesizing audio data (i.e. generating PCM data--one example is generating a simple sinusoidal wave). I think that might be helpful, but it requires _a lot_ of bitwise operations and two's complement to understand and handle the various `AudioFormat` types (and that's _just_ dealing with PCM data--I have nothing on handling more complicated formats like MP3 etc.). It would help if you would specify a _specific_ `AudioFormat`: give the sample rate, sample size (in bits), number of channels, signed or unsigned PCM, and little or big endian.
comment on: http://stackoverflow.com/q/26729926

http://stackoverflow.com/comment/42129639
score: 0
type: Comment
has text: I don't see anything, obviously wrong with your configuration. I suspect you are doing something in your code to not release connections. Can you add some code that uses the session or connection?
type: QuestionComment
comment on: http://stackoverflow.com/q/26749896

http://stackoverflow.com/q/26724944
tagged with: java
tagged with: compiler-warnings
score: 0
tagged with: casting
answer count: 1
type: UnansweredQuestion
tagged with: generics
has comment: http://stackoverflow.com/comment/42040025
has title: Fully qualified generics type casting error overlooked by Java compiler?
has body: Generics are knowingly meant for stronger type checking at compile time. However, while studying the official Java tutorial, I ran into this: However, in some cases the compiler knows that a type parameter is always valid and allows the cast. For example: List&lt;String&gt; l1 = ...; ArrayList&lt;String&gt; l2 = (ArrayList&lt;String&gt;)l1; // OK from http://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#cannotCast. I've tried and tested this (which fully reflects the documentation): List&lt;String&gt; l1 = new LinkedList&lt;String&gt;(); ArrayList&lt;String&gt; l2 = (ArrayList&lt;String&gt;)l1; // OK Although everything is pretty explicit (no assignment to an Object variable, no wilcarding, etc), the compiler fails to predict the runtime error that shows up afterwards: Exception in thread "main" java.lang.ClassCastException: java.util.LinkedList cannot be cast to java.util.ArrayList 100% puzzled.
has comment: http://stackoverflow.com/comment/42039286
type: Question
has comment: http://stackoverflow.com/comment/42039284
has answer: http://stackoverflow.com/a/26725002
linked to: http://stackoverflow.com/q/23414090

http://stackoverflow.com/q/26811325
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42220278
tagged with: button
tagged with: url
score: 0
has body: i have this simple code in my java class but it not run. where is the error? i want open in a webview different sites from a fragment with some buttons...Thanks in advance for help me public class SitoFragment extends Fragment { private WebView URL13, URL14; private Button button12,button13; button12 = (Button) view.findViewById(R.id.button12); button12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { URL13 = (WebView) URL13.findViewById(R.id.webviewsito); URL13.setWebViewClient(new WebViewClient()); URL13.setScrollbarFadingEnabled(true); URL13.setHorizontalScrollBarEnabled(false); URL13.getSettings().setJavaScriptEnabled(true); URL13.loadUrl("http://www.xxxxx.com"); } }); button13 = (Button) view.findViewById(R.id.button13); button13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { URL14 = (WebView) URL14.findViewById(R.id.webviewsito); URL14.setWebViewClient(new WebViewClient()); URL14.setScrollbarFadingEnabled(true); URL14.setHorizontalScrollBarEnabled(false); URL14.getSettings().setJavaScriptEnabled(true); URL14.loadUrl("http://www.xxxx.com"); } }); return view; } }
answer count: 0
type: UnansweredQuestion
has title: Open a webview with buttons in a fragment
has comment: http://stackoverflow.com/comment/42195140
tagged with: android-webview
tagged with: android-fragments

http://stackoverflow.com/comment/42002460
type: AnswerComment
comment on: http://stackoverflow.com/a/26696002
score: 0
type: Comment
has text: Alright, running 256 iterations of the code snippet: the `b = size` version takes 66.5ms per iteration, and the `break` version takes 45.9ms per iteration. This is for an array of about 7000 elements.

http://stackoverflow.com/comment/42016425
type: AnswerComment
type: Comment
has text: Oh sorry. now I have a different result.It returns /usr/java/default/bin/java
comment on: http://stackoverflow.com/a/26712549
score: 0

http://stackoverflow.com/q/26701354
type: Question
has title: Spring MVC : Controller Mapping works but return gives 404
has body: I'm trying to create a Spring MVC web application. Here is my configuration: web.xml bookstore-presentation 60 spring org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:config/bookstore-presentation-context.xml, classpath*:config/bookstore-presentation-security.xml 1 spring / org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath*:config/bookstore-domaine-context.xml, classpath*:config/bookstore-domaine-datasource.xml, classpath*:config/bookstore-service-context.xml, classpath*:config/bookstore-presentation-security.xml, WEB-INF/dispatcher-servlet.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* index.html dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:property-placeholder location="classpath*:bookstore.properties" /> WEB-INF/Views/ .html <mvc:resources mapping="/static/**" location="Assets"/> <mvc:default-servlet-handler/> </beans> HomeController.java @Controller public class HomeController { @RequestMapping(value = "/", method = RequestMethod.GET) public String index() { int a = 0; a += 1; return "index"; } @RequestMapping(value = "login", method = RequestMethod.GET) public String login() { return "login"; } } When I debug my code and try the "/" or "/login" mapping, I see that the correct method is called, but when I return the corresponding string, I get a 404 error. My folders ar organized…
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41996829
has comment: http://stackoverflow.com/comment/41996341
has comment: http://stackoverflow.com/comment/41996352
favorite count: 0
tagged with: mapping
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/a/26756436
answers question: http://stackoverflow.com/q/26755790
has comment: http://stackoverflow.com/comment/42095945
type: Answer
has comment: http://stackoverflow.com/comment/42110760
upvote count: 2
has body: Tetris blocks have discreet positions. Its game area is 20 rows high and 10 columns wide. There is probably no need for standard collision detection. You can for example use a 2D array with boolean or integer values that represent presence of a square on a location: int[][] squares = new int[20][10]; You can then use this information to determine if there is a collision: Rotation or movement should only be allowed if the resulting position from that action does not cause any of the squares to overlap with already present squares on game area and are inside the game area bounds (20 rows and 10 columns). If any square on a currently active block reaches bottom row or is in the same column and one row above a square already filled, then the block has reached its end destination. If when a block first appears on the screen some of its squares are already in occupied positions then it is game over. Etc. I made a Tetris clone using libgdx a few years ago, check it out if you think it might help you. You can see some images here and get the source from here. Clarification: When I say block I mean a tetromino, the entire object that falls from the top. Each Tetris block contains four squares in various arrangements.
has comment: http://stackoverflow.com/comment/42100717
has comment: http://stackoverflow.com/comment/42110955
score: 2
accepted answer of: http://stackoverflow.com/q/26755790
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26828777
type: Question
score: 0
tagged with: bindy
answer count: 1
has comment: http://stackoverflow.com/comment/42373479
has comment: http://stackoverflow.com/comment/42297622
has comment: http://stackoverflow.com/comment/42398148
has answer: http://stackoverflow.com/a/26926624
accepted answer: http://stackoverflow.com/a/26926624
has comment: http://stackoverflow.com/comment/42305610
has title: Camel Bindy converts BigDecimal inappropriately
has body: I've got the following example of using Camels Bindy, but eventually it raises assertion error because bindy transforms BigDecimal in wrong way (using comma instead of dot for number delimiter). What is wrong with this code ? public class PurchaseOrderBindyTest extends TestCase { @Test public void testBindy() throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(createRoute()); context.start(); MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class); mock.expectedBodiesReceived("Camel in Action,39.95,1\n"); PurchaseOrder order = new PurchaseOrder(); order.setAmount(1); order.setPrice(new BigDecimal("39.95")); order.setName("Camel in Action"); ProducerTemplate template = context.createProducerTemplate(); template.sendBody("direct:toCsv", order); mock.assertIsSatisfied(); } public RouteBuilder createRoute() { return new RouteBuilder() { public void configure() throws Exception { from("direct:toCsv") .marshal().bindy(BindyType.Csv, "camelinaction.bindy") .to("mock:result"); } }; } } Model @CsvRecord(separator = ",", crlf = "UNIX") public class PurchaseOrder { @DataField(pos = 1) private String name; @DataField(pos = 2, precision = 2) private BigDecimal price; @DataField(pos = 3) private int amount; public String getName() { return name; } public void setName(String name) { this.name = name; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } } Assertion Error java.lang.AssertionError: mock://result Body of message: 0. Expected: &lt;Camel in Action,39.95,1 &gt; but was: &lt;Camel in Action.39,95.1 &gt;
has comment: http://stackoverflow.com/comment/42360187
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel

http://stackoverflow.com/a/26683390
answers question: http://stackoverflow.com/q/26682973
type: Answer
accepted answer of: http://stackoverflow.com/q/26682973
score: 4
has body: Perhaps something like this? String InitialDir = "c:\\"; String DirFilter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; OpenFileDialog myDialog = new OpenFileDialog { InitialDirectory = InitialDir, Filter = DirFilter, FilterIndex = 2, RestoreDirectory = true, }; if(myDialog.ShowDialog() == DialogResult.OK) { try { FileInfo myFile = new FileInfo(myDialog.FileName); Directory.CreateDirectory(Path.Combine(myFile.DirectoryName, "subdir_name")); } catch { // exception handling here throw; } }
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26848616
answers question: http://stackoverflow.com/q/26819429
has body: Try to call it on the onViewCreated method
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42261326
type: Answer
upvote count: 2

http://stackoverflow.com/comment/41961022
score: 0
type: AnswerComment
has text: It would be simpler but the assignment wants to be images randomized and this way is the easiest to achieve that. I tried getContentPane().add(new ImageIcon(images[i]); getting no suitable constructor found for ImageIcon(icon)
comment on: http://stackoverflow.com/a/26680961
type: Comment

http://stackoverflow.com/comment/42160059
comment on: http://stackoverflow.com/q/26792175
has text: The question has been asked before [here](http://stackoverflow.com/questions/4302248/why-there-is-no-arraylistt-t-constructor), but may not have an answer you want.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26731091
score: 1
possible better answer: http://stackoverflow.com/a/26732732
has answer: http://stackoverflow.com/a/26731184
accepted answer: http://stackoverflow.com/a/26731184
tagged with: swing
has answer: http://stackoverflow.com/a/26732732
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/26662768
tagged with: custom-painting
linked to: http://stackoverflow.com/q/26684750
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/26723764
has body: I have some issues with my paint program in Java. I have a JComboBox where I can choose to draw either a rectangle or by freehand. The objects are added to an ArrayList. I want to be able to switch between drawing a rectangle and by free hand, and then back to drawing a rectangle, and then by free hand... and so on. If I do that as the code looks like now, it first draws rectangles fine and then when I switch to free hand it draws lines fine, but then when I switch back to rectangles it still draws lines (or sometimes lines together with weird looking rectangles). The more I switch the weirder it gets. Can anyone see what is wrong with the code, because I can't? public abstract class Draw { public int startX, startY, endX, endY, width, height, w, h; public String color = "Black"; public Draw(int startX, int startY, int width, int height) { this.startX = startX; this.startY = startY; this.width = width; this.height = height; } public abstract void draw(Graphics2D g); public int getX() { return startX; } public void setX(int startX) { this.startX = startX; } public int getY() { return startY; } public void setY(int startY) { this.startY = startY; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public void setColor(String color) { this.color = color; } } public class Rectangle extends Draw { public Rectangle(int x, int y, int width, int height) { super(x, y, width, height); } @Override public void draw(Graphics2D g2) { g2.drawRect(getX(), getY(), getWidth(), getHeight()); } } public class FreeHand extends Draw { public FreeHand(int x, int y, int width, int height) { super(x, y, width, height); } @Override public void draw(Graphics2D g2) { g2.drawLine(getX(), getY(), getWidth(), getHeight()); } } public class PaintProgram extends JFrame implements ActionListener { public ArrayList&lt;Draw&gt; shapeList = new ArrayList&lt…
favorite count: 0
has title: Switch between drawing a rectangle and by freehand
type: AnsweredQuestion
tagged with: java-2d
has comment: http://stackoverflow.com/comment/42051284
downvote count: 0

http://stackoverflow.com/a/26793564
score: 0
has body: Limit the maximum size of the request. You can limit the total headers for requests (&lt;Connector&gt;'s maxHttpHeaderSize attribute) that will be honored and you can limit the total length of a POST body that is accepted (&lt;Connector&gt;'s maxPostSize attribute). This attack is called slowloris. The "simulated blocking" that Tomcat's NIO actually frees-up threads to avoid a DOS from such an attack. There are timeouts that you can specify to help alleviate the problem of slowloris. I'll leave that as an exercise for you to read the Tomcat connector documentation since you obviously haven't yet read it. Why would you leave your /login "API" "unsecured"? Secure that bad boy!
type: Answer
answers question: http://stackoverflow.com/q/26788762

http://stackoverflow.com/comment/104434643
comment on: http://stackoverflow.com/a/26785177
score: 0
type: AnswerComment
has text: The fluent Mock resolution worked for me.Thank you @Manuel
type: Comment

http://stackoverflow.com/a/32192594
has body: You should consider taking a look at the openIMAJ and OpenCV. These are two state-of-the-art frame work that you can consider using for your multimedia(video) analysis.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26817386

http://stackoverflow.com/comment/41986777
type: Comment
has text: I tried to remove the repaints and if I remove the one thats not commented out the whole animation wouldn't work. And would you mind showing me how I could use the swing timer in my program.
type: AnswerComment
comment on: http://stackoverflow.com/a/26695928
score: 0

http://stackoverflow.com/comment/42228509
comment on: http://stackoverflow.com/q/26830410
score: 0
has text: you are catching it and then printing the stack trace...
type: Comment
type: QuestionComment

twitter
tags question: http://stackoverflow.com/q/26734165
tags question: http://stackoverflow.com/q/26769412
type: Tag
tags question: http://stackoverflow.com/q/26689133
tag name: twitter
tags question: http://stackoverflow.com/q/26823484

http://stackoverflow.com/comment/42183007
score: 3
has text: It sounds like you're looking for encryption or hashing, not random numbers.
type: QuestionComment
comment on: http://stackoverflow.com/q/26804940
type: Comment

http://stackoverflow.com/comment/42205397
has text: I guess my other choice (if it's possible) is to call UpdateVersionsMojo of the release plugin from within my plugin and somehow pass developmentVersion parameter to it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26816097
score: 0
type: Comment

http://stackoverflow.com/q/26677044
tagged with: spring
has answer: http://stackoverflow.com/a/27196821
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41953696
score: 3
upvote count: 3
tagged with: java
tagged with: concurrency
has title: Concurrency control in web application
type: Question
has comment: http://stackoverflow.com/comment/41954912
tagged with: jpa
has comment: http://stackoverflow.com/comment/41954001
linked to: http://stackoverflow.com/q/19454003
linked to: http://stackoverflow.com/q/129329
has comment: http://stackoverflow.com/comment/41956383
has comment: http://stackoverflow.com/comment/41953774
downvote count: 0
answer count: 1
has body: I have to solve this situation: in my Spring + JPA web application I have a jsp similar to an excel work sheet. So I have a certain number of cells and each cell is saved in a DB table with additional information: I have a row for each cell. id | value | column | row | ... I use this structure because number of columns in my jsp table is dynamic. At the moment, when I save cells I truncate the current set of rows in DB table and re-insert all the new rows. This is the fastest way I found to update a large set of rows. But now I have a concurrency problem: the jsp page can be used by different users at the same time and this can cause overwriting problems on other users savings. I need to implement some kind of lock in my web app. I found there are mainly two types of lock: optimistic vs pessimistic. Can you suggest me a common approach to solve this situation? Where do I need to implement the lock, at data access level or at service level? NOTE to be more clear: table values are shared among users, but can be updated by anyone among authorized users.
has comment: http://stackoverflow.com/comment/41955002
has comment: http://stackoverflow.com/comment/41954115
has comment: http://stackoverflow.com/comment/41954850
has comment: http://stackoverflow.com/comment/41953982
has comment: http://stackoverflow.com/comment/41954749
favorite count: 0
has comment: http://stackoverflow.com/comment/41954517
has comment: http://stackoverflow.com/comment/41955004
has comment: http://stackoverflow.com/comment/41953882
type: UnansweredQuestion

http://stackoverflow.com/a/26720135
upvote count: 3
has body: (Comment as answer for readability.) Singletons aren't intrinsically evil, they're just easy to mis-use. If you're not managing the singleton-ness of the object there's even less of an issue. I'll disagree with the others regarding singletons with state; while it can be done wrong, there are many singleton patterns with state that work just fine, e.g., a pool.
answers question: http://stackoverflow.com/q/26719981
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/26768899
has body: I was recently messing around with Sockets, and I realized that you can not only send Data through a DataOutputStream using Sockets and ServerSockets, but you can also type "localhost:[port]" into your browser which will also connect to the ServerSocket and display whatever the ServerSocket returns on the webpage. Seeing this it made me wonder if it is possible to check if someone on my network is going to a specific URL, say google.com and instead of connecting to Google, just display custom content on the screen. If this is possible, then please do tell me, I do understand that it is very possible that this does not work in Java, but instead somehow else, and if anyone knows any other way, then that would be very much appreciated as well :)
score: 0
answer count: 2
has title: How do I override a website/domain using Sockets?
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/26777055
has answer: http://stackoverflow.com/a/26772068
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/26700800
accepted answer: http://stackoverflow.com/a/26717281
has comment: http://stackoverflow.com/comment/41996438
type: Question
has answer: http://stackoverflow.com/a/28347377
has comment: http://stackoverflow.com/comment/41996100
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27097653
has answer: http://stackoverflow.com/a/27097653
answer count: 3
has comment: http://stackoverflow.com/comment/42052753
downvote count: 0
favorite count: 0
has title: Android Studio no installation wizard
has body: I have downloaded the latest Android Studio and when I run studio64.exe it opens Android Studio as a standalone application, however I would like to install it to my system. The website says there is an installation wizard however I get taken straight to the Android Studio start screen. Is there still a way to install it on a Windows machine?
tagged with: android
upvote count: 6
tagged with: android-studio
has answer: http://stackoverflow.com/a/26717281
has comment: http://stackoverflow.com/comment/42049228
score: 6

http://stackoverflow.com/a/26675841
has comment: http://stackoverflow.com/comment/41951134
answers question: http://stackoverflow.com/q/26675725
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41951357
downvote count: 1
has comment: http://stackoverflow.com/comment/41951053
has body: Try this: public static void main(String args[]) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); int count = 0; // counter for (long c = a; c &lt;= b; c++) { if (c % 2 == 0 || c % 3 == 0 || c % 5 == 0) {//this where the error is in your program count++; System.out.println(c);//you are printing c and you are not maintaining the counter } } System.out.println("Counter is " + count); }
score: 0

http://stackoverflow.com/q/26675486
has body: I have this code that is a chat client that works with my server that im working on. In the textEnter field i want it so if you press enter it does the same action as if you click the send button. If any of you can help me find a way to do this i will be very grateful. package TryOne; /* Things to do * 1.fix (java.lang.ArrayIndexOutOfBoundsException: 2) "remove spaces and new lines after text" * 2.fix user names not being cleared after disconnect * 3.fix server chat logs * 4. */ import java.net.*; import java.awt.event.KeyEvent; import java.io.*; import java.util.*; import javax.swing.JTextField; public class ChatClient extends javax.swing.JFrame { static String username; /* if user names don't copy to the field correctly remove static*/ String serverIP = "localhost"; int Port = 13; Socket sock; BufferedReader reader; PrintWriter writer; ArrayList &lt; String &gt; userList = new ArrayList(); Boolean isConnected = false; static Boolean isPressed = false; /** Creates new form Chat */ public ChatClient() { initComponents(); } public class IncomingReader implements Runnable { public void run() { String[] data; String stream, done = "Done", connect = "Connect", disconnect = "Disconnect", chat = "Chat"; /*if(isPressed){ sendButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sendButtonActionPerformed(evt); System.out.println(evt); }}); isPressed = false; }*/ try { while ((stream = reader.readLine()) != null) { data = stream.split(":"); if (data[2].equals(chat)) { chatTextArea.append(data[0] + ": " + data[1] + "\n"); chatTextArea.setCaretPosition(chatTextArea .getDocument().getLength()); } else if (data[2].equals(connect)) { chatTextArea.removeAll(); userAdd(data[0]); } else if (data[2].equals(disconnect)) { userRemove(data[0]); } else if (data[2].equals(done)) { usersList.setText(""); writeUsers(); userList.clear(); } } } catch (Exception ex) {} } } public void ListenThread() { Thread IncomingReader …
tagged with: button
has answer: http://stackoverflow.com/a/26675658
favorite count: 0
type: Question
upvote count: 2
tagged with: text
has comment: http://stackoverflow.com/comment/41952645
score: 0
tagged with: java
downvote count: 2
tagged with: swing
has title: I need to add a keylistener i think
answer count: 1
tagged with: server
type: UnansweredQuestion

http://stackoverflow.com/q/26739410
has comment: http://stackoverflow.com/comment/42179073
type: Question
has comment: http://stackoverflow.com/comment/42175820
tagged with: network-programming
has body: If my host is connected to several subnets (through different routes), how can I find the corresponding Interface for a given ip? In other words, when trying to access another host (or Network Destination if you use route print in Windows, cmd), how can I read the actual Interface for that Network Destination? Right now I am considering opening a cmd window, using route print, then parsing the output and writing my own method to determine if ip address xxx.xx.xx.xxx belongs to Network Destination xxx.xx.0.0, mask [...] and then reading the corresponding Interface value, but surely there has to be an easier way.
tagged with: routes
accepted answer: http://stackoverflow.com/a/33269981
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42065628
tagged with: interface
has title: How to determine which Interface belongs to each Network Destination - Java?
has comment: http://stackoverflow.com/comment/42174305
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/33269981
tagged with: java

http://stackoverflow.com/q/26736488
has answer: http://stackoverflow.com/a/26736649
upvote count: 1
possible better answer: http://stackoverflow.com/a/26736517
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26736517
has comment: http://stackoverflow.com/comment/42059146
tagged with: if-statement
tagged with: java
has title: How do I make this if statement?
has comment: http://stackoverflow.com/comment/42059147
accepted answer: http://stackoverflow.com/a/26736649
score: 0
favorite count: 0
tagged with: int
has body: Apologies for the silly question, I am currently struggling to learn java. I need this code to work so that it will repeat unless '0' is entered for the studentNumber, I'm unsure of how to get the "please enter student number" part to work when I have to declare the int for that before the if statement? I'm not sure if I've approached this completely wrong or what, but I need to be able to repeat the data entry unless "0" is entered as the studentNumber. Thanks for any help! class Main { public static void main( String args[] ) { int studentNumber = BIO.getInt(); if(studentNumber &gt; 0) { System.out.print("#Please enter the student number : "); System.out.print("#Please enter the coursework mark : "); int courseWork = BIO.getInt(); System.out.print("#Please enter the exam mark : "); int examMark = BIO.getInt(); double average = (double)(courseWork + examMark) / 2; System.out.printf("sn = " + studentNumber + " ex = " + examMark + " cw = " + courseWork + " mark = " + average); } else { System.out.print("#End of data"); } } } }
has answer: http://stackoverflow.com/a/26736640
has comment: http://stackoverflow.com/comment/42059250
answer count: 4
has answer: http://stackoverflow.com/a/26736794
type: AnsweredQuestion

http://stackoverflow.com/comment/42218469
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26821501
has text: where is your ListView: todays_task_list ...??
score: 0

http://stackoverflow.com/a/26684776
has comment: http://stackoverflow.com/comment/41972062
accepted answer of: http://stackoverflow.com/q/26684750
score: 1
answers question: http://stackoverflow.com/q/26684750
has comment: http://stackoverflow.com/comment/41968591
type: AcceptedAnswer
downvote count: 0
has body: The simplest solution would be to store the last listener and remove that before adding a new one: private MouseListener lastListener; // ... JComboBox cb = (JComboBox)e.getSource(); if (cb.getSelectedItem().equals("Rectangle")) { if (lastListener != null) contentPane.removeMouseListener(lastListener); lastListener = new MouseAdapter() { //First mouseListener // ... }; contentPane.addMouseListener(lastListener);
type: Answer
has comment: http://stackoverflow.com/comment/41967706
has comment: http://stackoverflow.com/comment/41967694
upvote count: 1

ms-access
tags question: http://stackoverflow.com/q/26739105
tags question: http://stackoverflow.com/q/26787747
tags question: http://stackoverflow.com/q/26701445
tag name: ms-access
tags question: http://stackoverflow.com/q/26731745
type: Tag

http://stackoverflow.com/comment/42151078
has text: Thanks, I've checked it right now, it's awsome! exactly what I needed!
comment on: http://stackoverflow.com/a/26787264
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41960475
type: Comment
type: QuestionComment
has text: O(1) is *constant* access time. You're iterating, no?
score: 1
comment on: http://stackoverflow.com/q/26680858

variables
tag name: variables
tags question: http://stackoverflow.com/q/26769207
tags question: http://stackoverflow.com/q/26799318
tags question: http://stackoverflow.com/q/26821786
tags question: http://stackoverflow.com/q/26813336
tags question: http://stackoverflow.com/q/26824236
tags question: http://stackoverflow.com/q/26820620
tags question: http://stackoverflow.com/q/26703620
tags question: http://stackoverflow.com/q/26799300
tags question: http://stackoverflow.com/q/26714126
type: Tag
tags question: http://stackoverflow.com/q/26821764
tags question: http://stackoverflow.com/q/26694612
tags question: http://stackoverflow.com/q/26680530
tags question: http://stackoverflow.com/q/26768195
tags question: http://stackoverflow.com/q/26783919
tags question: http://stackoverflow.com/q/26806450
tags question: http://stackoverflow.com/q/26726036
tags question: http://stackoverflow.com/q/26726304
tags question: http://stackoverflow.com/q/26793175
tags question: http://stackoverflow.com/q/26694107
tags question: http://stackoverflow.com/q/26704697
tags question: http://stackoverflow.com/q/26750985
tags question: http://stackoverflow.com/q/26771652

http://stackoverflow.com/comment/42069866
comment on: http://stackoverflow.com/q/26741520
score: 0
has text: Anyway, are you willing to throw away the return values if there are any?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26685397
answers question: http://stackoverflow.com/q/26685242
has comment: http://stackoverflow.com/comment/41968932
has comment: http://stackoverflow.com/comment/41979784
type: Answer
upvote count: 1
has body: One aspect of it is that object.method(params...) is just syntactic sugar for function(data, params...). With the latter, the developer would have to discipline themselves not to pass in a pointer to the wrong kind of data or modify the data in any other way -- things that the compiler enforces for you in an OO language.
score: 1
has comment: http://stackoverflow.com/comment/41979353
downvote count: 0

http://stackoverflow.com/comment/42151598
comment on: http://stackoverflow.com/q/26785159
has text: thanks the answer, but i need to learn token too..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42055920
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26734450
has text: Well I am unable to solve this, I attach the file: https://www.dropbox.com/s/43oywlsc8urev90/Hangman.java?dl=0

http://stackoverflow.com/comment/41973483
score: 0
type: AnswerComment
has text: I also have a combobox. When user chooses Left or Right and types HGap and VGap; after pressing enter button, the components should change.
type: Comment
comment on: http://stackoverflow.com/a/26688134

http://stackoverflow.com/comment/42189259
type: Comment
comment on: http://stackoverflow.com/q/26807986
has text: not only the first filled in the rest position is empty
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42096702
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26750840
has text: I will try the drain later today and see what happens thanks

http://stackoverflow.com/a/26750307
upvote count: 14
accepted answer of: http://stackoverflow.com/q/26750274
type: Answer
answers question: http://stackoverflow.com/q/26750274
score: 14
downvote count: 0
type: AcceptedAnswer
has body: You can use bitwise XOR : int x = 5; // 101 x = x ^ 1; // 100 Using your original example : int a = 11; System.out.println (a + " " + Integer.toBinaryString(a)); //11 1011 int b = a^1; System.out.println (b + " " + Integer.toBinaryString(b)); //10 1010

http://stackoverflow.com/q/26743809
type: Question
has comment: http://stackoverflow.com/comment/42075670
has comment: http://stackoverflow.com/comment/42075064
score: 0
has body: I'm trying to track a laser dot using OpenCV on an Android device. I want to use this laserdot to draw on a canvas which is placed upon my cameraview. I've converted my camerapreview to HSV color space and used threshold filtering(only on H and V channels) to seperate my laserdot. This works fairly robust. public Mat onCameraFrame(CvCameraViewFrame cvf) { // Grab the video frame cvf.rgba().copyTo(originalFrame); cvf.rgba().copyTo(frame); // Convert it to HSV Imgproc.cvtColor(frame, frame, Imgproc.COLOR_RGB2HSV); // Split the frame into individual components (separate images for H, S, // and V) mChannels.clear(); Core.split(frame, mChannels); // Split channels: 0-H, 1-S, 2-V frameH = mChannels.get(0); // frameS = mChannels.get(1); frameV = mChannels.get(2); // Apply a threshold to each component Imgproc.threshold(frameH, frameH, 155, 160, Imgproc.THRESH_BINARY); // Imgproc.threshold(frameS, frameS, 0, 100, Imgproc.THRESH_BINARY); Imgproc.threshold(frameV, frameV, 250, 256, Imgproc.THRESH_BINARY); // Perform an AND operation Core.bitwise_and(frameH, frameV, frame); // Display the result. frameH.release(); // frameS.release(); frameV.release(); frame.release(); return originalFrame; } Now I'm trying to get coordinates of the center of my laserdot. I tried using the findContours function on my frame but this results in multiple dots. I hope someone could point me in the right direction providing some tips for filters to use next. Below is a screenshot showing a processed frame.
answer count: 1
has answer: http://stackoverflow.com/a/28192566
linked to: http://stackoverflow.com/q/14733042
has comment: http://stackoverflow.com/comment/42160307
accepted answer: http://stackoverflow.com/a/28192566
tagged with: android
has comment: http://stackoverflow.com/comment/42075419
has comment: http://stackoverflow.com/comment/42095033
has title: OpenCV Android Track laser dot
tagged with: opencv
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/62186206
tagged with: image-processing

http://stackoverflow.com/q/26787382
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26787791
has body: In a JSP page, I want to display an image stored in a database. How do I do this? I tried the following JSP code but it displays nothing in the browser. What am I doing wrong? &lt;% HttpSession ses2=request.getSession(); String email2 = (String)ses2.getAttribute("ses_email"); Connection cn2; PreparedStatement ps2; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn2=DriverManager.getConnection("jdbc:odbc:sm","system","gecbsp"); ps2=cn2.prepareStatement("select * from smreg3 where email = "+ "'"+email2+"'"); ResultSet rs2=ps2.executeQuery(); //ServletOutputStream sos=response.getOutputStream(); if(rs2.next()) { byte[] bytearray = new byte[1024]; int size=0; InputStream image; image = rs2.getBinaryStream(1); response.reset(); response.setContentType("image/jpeg"); while((size=image.read(bytearray))!= -1 ) { response.getOutputStream().write(bytearray,0,size); } response.flushBuffer(); image.close(); rs2.close(); } } catch(Exception ee) { ee.printStackTrace(); } %&gt; Error: java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.reset(ResponseFacade.java:310) at org.apache.jsp.profile_jsp._jspService(profile_jsp.java:193) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostV…
downvote count: 1
type: Question
tagged with: java
score: -1
tagged with: image
tagged with: jdbc-odbc
upvote count: 0
answer count: 1
has title: How to retrieve image in jsp from oracle database?
has comment: http://stackoverflow.com/comment/42151305
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/42151635
linked to: http://stackoverflow.com/q/2340406
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/2340406
has comment: http://stackoverflow.com/comment/42151596

http://stackoverflow.com/comment/42038646
type: Comment
comment on: http://stackoverflow.com/a/26705036
score: 0
type: AnswerComment
has text: I just checked if index 0 and index 1 of my listofWalls are the same. And indeed, both have the value -609055629. Nevertheless there are still duplicates , even with the temporary solution above.I keep working on it

http://stackoverflow.com/a/26782082
upvote count: 2
has comment: http://stackoverflow.com/comment/42141393
type: Answer
has body: Almost all of these changes are related to what's called the Liskov Substitution Principle(one of the S.O.L.I.D principles). This principle basically states that when you are interacting with an instance of a type, your super-class/interface in this case, all of the child types/implementors must expose at least that interface, and ideally, must also behave in generally the same manner.
has comment: http://stackoverflow.com/comment/42143904
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26781825

http://stackoverflow.com/comment/97234047
score: 0
comment on: http://stackoverflow.com/a/45814178
has text: @cassiomolin here: https://stackoverflow.com/questions/55250719/best-practice-for-enabling-a-user-to-only-change-the-data-he-owns-on-jax-rs-and
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26724569
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26722107
has body: I found the solution for the answert.We just have to call the layout of the widget's parent.It does the trick. Composite.layout(true);

http://stackoverflow.com/a/26751023
score: 1
has body: You need to use a JTA transaction manager in this kind of environment. As you are using a full-blown application server, it already has a built in transaction manager that is integrated with the data sources that you have setup (at least when you set jta="true"). Also be sure to use: &lt;prop key="hibernate.transaction.jta.platform"&gt; org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform &lt;/prop&gt; &lt;prop key="hibernate.transaction.factory_class"&gt; org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory &lt;/prop&gt; Your hibernate session should close automagically when the transaction is committed and release associated database connections. And don't forget to configure the Spring JTA Tx Manager &lt;bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager" /&gt;
has comment: http://stackoverflow.com/comment/42086950
upvote count: 1
answers question: http://stackoverflow.com/q/26749896
downvote count: 0
type: Answer

http://stackoverflow.com/q/26798003
type: Question
possible better answer: http://stackoverflow.com/a/26798040
tagged with: java
has answer: http://stackoverflow.com/a/34356805
has title: Call Method after finish multiple AsyncTask
score: 0
has comment: http://stackoverflow.com/comment/42170486
tagged with: android
has body: Hi everyone i have problem,i am working on Multiple asyc task , i want to call Method when those task completed.please check. for (ClientsDetailDAO clientsDetailDAO : clients) { Log.d(TAG, "onConnected for"); Addresses addresses = clientsDetailDAO.getAddress(); StringBuilder sb = null; if (addresses != null) { Log.d(TAG, "onConnected address not null"); sb = new StringBuilder(addresses.getStreetAddress()) .append(", ").append(addresses.getCity()) .append(", ").append(addresses.getState()) .append(", ").append(addresses.getZip()); Log.d(TAG, "Address formatted: " + sb.toString()); mAddressAsyncTask = new GetAddressAsyncTask( clientsDetailDAO); mAddressAsyncTask.execute(sb.toString()); } } private class GetAddressAsyncTask extends AsyncTask { private ClientsDetailDAO clientsDetailDAO; public GetAddressAsyncTask(ClientsDetailDAO clientsDetailDAO) { this.clientsDetailDAO = clientsDetailDAO; } @Override protected LatLng doInBackground(String... params) { Geocoder geoCoder = new Geocoder(getActivity()); LatLng latLng = null; try { List&lt;Address&gt; addresses = geoCoder.getFromLocationName(parmas.toString, 1); Log.i(TAG, "param " + params[0] + " addresses size: " + addresses.size()); if (addresses.size() &gt; 0) { latLng = new LatLng(addresses.get(0).getLatitude(), addresses.get(0).getLongitude()); } } catch (Exception e) { e.printStackTrace(); } if (isCancelled()) return null; return latLng; } @Override protected void onPostExecute(LatLng result) { if (result != null) { Log.d(TAG, "onConnected latLng not null"); clientsDetailDAO.setLatitude(result.latitude); clientsDetailDAO.setLongitude(result.longitude); Toast.makeText(getActivity(), "in post" + result.latitude, Toast.LENGTH_LONG).show(); } else { Log.d(TAG, "onConnected latLng null"); } } } after finsih these task i want to call setUpMarker(); method.
tagged with: dictionary
has comment: http://stackoverflow.com/comment/42169974
answer count: 4
tagged with: android-asynctask
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26800181
accepted answer: http://stackoverflow.com/a/34356805
has answer: http://stackoverflow.com/a/26798040
has answer: http://stackoverflow.com/a/26798147

http://stackoverflow.com/comment/42013360
has text: Eclipse supports parallel programming via [PTP](http://www.eclipse.org/ptp/) (Parallel Tools Platform).
comment on: http://stackoverflow.com/q/26695673
score: 0
type: Comment
type: QuestionComment

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/26698962
tags question: http://stackoverflow.com/q/26757824
type: Tag
tags question: http://stackoverflow.com/q/26684654

http://stackoverflow.com/q/26715533
has comment: http://stackoverflow.com/comment/42021935
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/42067788
has comment: http://stackoverflow.com/comment/42022845
has comment: http://stackoverflow.com/comment/42021576
has comment: http://stackoverflow.com/comment/42023009
tagged with: sql
has comment: http://stackoverflow.com/comment/42022016
has body: I am getting faulty services in my apache tomcat web service after adding this method in the web service: public String getAllEvent() { JSONArray jsonArray = new JSONArray(); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/mydb", "root", "root"); PreparedStatement statement = con .prepareStatement("SELECT * FROM event"); ResultSet result = statement.executeQuery(); while (result.next()) { JSONObject eventInfo = new JSONObject(); eventInfo.put("eventID", result.getString("eventID")); eventInfo.put("eventName", result.getString("eventName")); eventInfo.put("eventDesc", result.getString("eventDesc")); eventInfo.put("eventDate", result.getString("eventDate")); eventInfo.put("eventTime", result.getString("eventTime")); eventInfo.put("eventX", result.getString("eventX")); eventInfo.put("eventY", result.getString("eventY")); eventInfo.put("eventBy", result.getString("eventBy")); jsonArray.put(eventInfo); } String jsonStr = jsonArray.toString(); return jsonStr; } catch (JSONException je) { return null; } catch (Exception exc) { System.out.println(exc.getMessage()); } return jsonArray.toString(); } For this method, I am passing the data retrieved from database into JSON. After I added it, when I run the web service on server, I am getting this error message: Faculty Services: C:\Users\Desktop\Eclipse EE\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\SplashWebService\WEB-INF\services\SplashWebService The web service runs perfectly again after I removed this method. Any ideas? Thanks in advance.
downvote count: 0
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42558235
has comment: http://stackoverflow.com/comment/42021535
score: 2
has title: Faulty Service in Apache Tomcat WebService
answer count: 0
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/41949105
comment on: http://stackoverflow.com/a/26674760
score: 0
type: AnswerComment
has text: Excellent , that's what I wanted to know . This clears it up for me. Thanks .
type: Comment

http://stackoverflow.com/a/26696230
score: 0
has body: I think your configuration should be like below in mvc-servlet.xml file. &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt; &lt;property name="maxUploadSize" value="500000" /&gt; &lt;/bean&gt; and change your post api like below. @RequestMapping(method = RequestMethod.POST,value = "/uploadFile") public String fileUploaded(Model model, @RequestParam("file") MultipartFile file, BindingResult result) { String result = "not uploaded"; if(!file.isEmpty()){ MultipartFile multipartFile = file.getFile(); //code for storing the file in server(in db or system) } else{ result = "can not be empty;" } return result; }
has comment: http://stackoverflow.com/comment/42041867
answers question: http://stackoverflow.com/q/26694935
type: Answer

http://stackoverflow.com/q/26741856
tagged with: groovy
answer count: 1
has comment: http://stackoverflow.com/comment/42071739
has body: I am writing simple calc in groovy with swing. I declare buttons in a loop and add AcionListeners to them at the same time. The think is that listeners work for each button except "=" button. I don't know what seems to be the problem here. Can You help me with that? import javax.swing.* import java.awt.* import java.awt.event.* frame = new JFrame(size: [600, 300], layout: new FlowLayout()) msgLabel = new JLabel("") frame.contentPane.add msgLabel def characters = "0123456789,/*-+=C" 0.upto(characters.length()-1) { def sign = characters.getAt(it) button = new JButton(sign) frame.contentPane.add button println this.getClass().getName() if(sign == "=") { button.addActionListener({ equals() } as ActionListener) } else if(sign == "C") { button.addActionListener({ clear() } as ActionListener) } else { button.addActionListener({ putText(sign) } as ActionListener) } } frame.show() public void equals() { println "equals" } public void clear() { println "clear" } public void putText(sign) { println sign } Thanks in Advance!!
tagged with: swing
has title: groovy ActionListener doesn't work under one condition
accepted answer: http://stackoverflow.com/a/26743023
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26743023
has comment: http://stackoverflow.com/comment/42072170
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/26678407
has answer: http://stackoverflow.com/a/26687579
has answer: http://stackoverflow.com/a/26681818
linked to: http://stackoverflow.com/q/5774104
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41956502
has comment: http://stackoverflow.com/comment/65506892
has comment: http://stackoverflow.com/comment/41986026
has title: Get ultrasound from android using frequency
has comment: http://stackoverflow.com/comment/41956627
tagged with: signal-processing
has body: I want to get ultrasound from any Android device from example an ultrasound with a frequency between 18KHz and 19KHz. I use the code below to calculate frequency but it doesn't seems to get me the correct frequency. The frequency i get stay between 11 KHz and 13KHz. private void calculateFrequency() { // 1 - Initialize audio int channel_config = AudioFormat.CHANNEL_CONFIGURATION_MONO; int format = AudioFormat.ENCODING_PCM_16BIT; int sampleRate = 8000; int bufferSize = 2048; if (bufferSize &lt; AudioRecord.getMinBufferSize(sampleRate, channel_config, format)) bufferSize = AudioRecord.getMinBufferSize(sampleRate, channel_config, format); AudioRecord audioInput = new AudioRecord(AudioSource.MIC, sampleRate, channel_config, format, bufferSize); // 2 - Get sound byte[] audioBuffer = new byte[bufferSize]; audioInput.startRecording(); int nbRead = audioInput.read(audioBuffer, 0, bufferSize); audioInput.stop(); audioInput.release(); // 3 - Transform to double array double[] micBufferData = new double[bufferSize]; final int bytesPerSample = 2; // As it is 16bit PCM final double amplification = 100.0; // choose a number as you like for (int index = 0, floatIndex = 0; index &lt; nbRead - bytesPerSample + 1; index += bytesPerSample, floatIndex++) { double sample = 0; for (int b = 0; b &lt; bytesPerSample; b++) { int v = audioBuffer[index + b]; if (b &lt; bytesPerSample - 1 || bytesPerSample == 1) { v &amp;= 0xFF; } sample += v &lt;&lt; (b * 8); } double sample32 = amplification * (sample / 32768.0); micBufferData[floatIndex] = sample32; } // 4 - Create complex array Complex[] fftTempArray = new Complex[bufferSize]; for (int i=0; i&lt;bufferSize; i++) { fftTempArray[i] = new Complex(micBufferData[i], 0); } // 5 - Calculate FFT Complex[] fftArray = FFT.fft(fftTempArray); // 6 - Calculate magnitude double[] magnitude = new double[bufferSize / 2]; for (int i = 0; i &lt; (bufferSize / 2); i++) { magnitude[i] = Math.sqrt(fftArray[i*2].re() * fftArray[i*2].re() + fftArray[i*2].im() * …
type: Question
has comment: http://stackoverflow.com/comment/41972427
tagged with: java
score: 4
tagged with: audiorecord
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/7674877
downvote count: 0
favorite count: 0
tagged with: fft

http://stackoverflow.com/q/26723820
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26724410
tagged with: java
has comment: http://stackoverflow.com/comment/42037349
has comment: http://stackoverflow.com/comment/42037574
upvote count: 1
tagged with: observer-pattern
downvote count: 1
type: Question
has title: Observer Pattern of Java API :subject if extended
accepted answer: http://stackoverflow.com/a/26724410
has comment: http://stackoverflow.com/comment/42037355
score: 0
answer count: 1
favorite count: 0
has body: In Java built-in API for Observer Pattern we have to extend Observable class to become\implement "subject". I wanted to know if i extend the class implementing "Observable" will also become a "Subject\Observable" and if so will it inherit all the observers from the parent? Ex: Class A extends Observable Class B extends A So B is also Observable/subject?
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/42037258

http://stackoverflow.com/comment/42077513
type: Comment
score: 1
has text: @androiddeveloper I guess you would need to override the setTextSize method and have it do a quick getTextBounds on some representative tall letters (TIHdi, and others) in the new size to get the maximum top bounds and then just use that to set the padding accordingly. And make sure you call this setTextSize method at least once (maybe in a new constructor).
comment on: http://stackoverflow.com/a/26745653
type: AnswerComment

http://stackoverflow.com/a/26772962
downvote count: 0
has body: You can use setJulianDay with toMillis to convert Julian date integer to time in msec. But remember converting from msec to julian day and then back msec won't give you the same result.
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26772836
type: Answer
accepted answer of: http://stackoverflow.com/q/26772836

http://stackoverflow.com/a/26705255
type: Answer
answers question: http://stackoverflow.com/q/26703526
accepted answer of: http://stackoverflow.com/q/26703526
score: 0
type: AcceptedAnswer
has body: As requested by the creator of the post, i'm adding the comment as an answer: You're calling setChecked to checked wich is a boolean variable. You shoud write: checkbox_years_of.setChecked(true) Instead of checkbox_years_of checked.setChecked(true)

http://stackoverflow.com/a/26871345
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42342932
answers question: http://stackoverflow.com/q/26811861
has body: If all you want to know is whether or not matches exist between two lists according to arbitrary criteria then all you need is the following: def hasMatches(List a, List b, Closure&lt;Boolean&gt; matchCriteria) { a &amp;&amp; b &amp;&amp; a.any{ aa -&gt; b.any { bb -&gt; matchCriteria(aa, bb) || matchCriteria(bb, aa) } } } Then the following assertions all return true: class SampleObj{ String attribute1 List attribute2 String attribute3 String name @Override String toString() { name } } List&lt;SampleObj&gt; listA = [ [name: "ObjA1", attribute1: "test", attribute2: ["a","b","c"]] as SampleObj, [name: "ObjA2", attribute1: "optionalArg test 2", attribute3: "optionalArg"] as SampleObj ] List&lt;SampleObj&gt; listB = [ [name: "ObjB1", attribute3: "test4", attribute2: [1,2,3]] as SampleObj, [name: "ObjB2", attribute3: "optionalArg"] as SampleObj, [name: "ObjB3", attribute1: "test", attribute2: ["a","b","c"]] as SampleObj ] // there exists at least one object in list A whose attribute 1 value matches that of at least one object in list B (or vice versa) assert hasMatches(listA, listB) { SampleObj aa, SampleObj bb -&gt; aa?.attribute1 == bb?.attribute1 } // there exists at least one object in list B whose attribute 3 value is a substring of the attribute 1 value of at least one object in list A (or vice versa) assert hasMatches(listA, listB) { SampleObj aa, SampleObj bb -&gt; bb?.attribute3 &amp;&amp; aa?.attribute1?.contains(bb.attribute3) } // there does not exist any object in list A whose attribute 1 value is contained in the attribute 2 list of any object in list B (or vice versa) assert !hasMatches(listA, listB) { SampleObj aa, SampleObj bb -&gt; aa?.attribute1 &amp;&amp; bb?.attribute2?.contains(aa.attribute1) } If, on the other hand, you actually want to see the matching pairs, then you need something a bit more extensive: def findEquivalentPairs(List a, List b, Closure&lt;Boolean&gt; matchCriteria) { a &amp;&amp; b \ ? a.sum { aa -&gt; def ab = b.findResults { bb …
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26811861
type: Answer

enums
tags question: http://stackoverflow.com/q/26777023
tags question: http://stackoverflow.com/q/26674013
tags question: http://stackoverflow.com/q/26810188
tags question: http://stackoverflow.com/q/26706321
tags question: http://stackoverflow.com/q/26757902
tags question: http://stackoverflow.com/q/26761229
tags question: http://stackoverflow.com/q/26708903
tags question: http://stackoverflow.com/q/26793740
tag name: enums
tags question: http://stackoverflow.com/q/26755690
type: Tag
tags question: http://stackoverflow.com/q/26755755
tags question: http://stackoverflow.com/q/26706400
tags question: http://stackoverflow.com/q/26774772
tags question: http://stackoverflow.com/q/26732016
tags question: http://stackoverflow.com/q/26735902

http://stackoverflow.com/comment/42186734
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26806907
has text: Well, read the file line by line and parse the strings. Or, if the records might span lines read multiple lines (or the entire file) and then parse.
type: Comment

http://stackoverflow.com/q/26708346
type: Question
tagged with: java
downvote count: 3
tagged with: split
answer count: 3
has body: I would like to split string based on the delimiters. The example string is: ["INESIS","13-ARTENGO-P1046","19"] It should be divided into three string after splitting. String data="[\"INESIS\",\"13-ARTENGO-P1046\",\"19\"]"; String[] values=data.split(","); I have tried in the above way, but it isn't working.
score: -2
has comment: http://stackoverflow.com/comment/42008914
favorite count: 0
has answer: http://stackoverflow.com/a/26708380
has answer: http://stackoverflow.com/a/26708379
has answer: http://stackoverflow.com/a/26708640
tagged with: delimiter
has comment: http://stackoverflow.com/comment/42008913
type: UnansweredQuestion
has title: How to split string based on delimiters in Java
upvote count: 1

http://stackoverflow.com/a/26767251
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42116702
has comment: http://stackoverflow.com/comment/42116381
has comment: http://stackoverflow.com/comment/42116187
upvote count: 1
type: AcceptedAnswer
has body: PeriodFormatter.print() returns a String (and "%02d requires a int). I think you wanted something like // tw.setText(String.format("%02d",formatter8.print(period8))); tw.setText(formatter8.print(period8)); Or, parse the String to an int like try { int val = Integer.parseInt(formatter8.print(period8)); tw.setText(String.format("%02d",val)); } catch (NumberFormatException nfe) { nfe.printStackTrace(); }
answers question: http://stackoverflow.com/q/26767004
has comment: http://stackoverflow.com/comment/42116127
accepted answer of: http://stackoverflow.com/q/26767004
has comment: http://stackoverflow.com/comment/42116463
type: Answer
has comment: http://stackoverflow.com/comment/42115468
has comment: http://stackoverflow.com/comment/42115362

http://stackoverflow.com/q/26720731
type: UnansweredQuestion
has body: I'm working on an textbook assignment and am having trouble understanding arrays. I'm looking at a practice question and am confused. Declare an array of integers containing the first five prime numbers. This would be int[]primes = {2,3,5,7,11} Assume the array 'primes' has been initialized. What does it contain after executing the following loop? for(int i = 0; i &lt; 2; i++) { primes[4 - i] = primes[i]; } The textbook gives the answer {2,3,5,3,2} for this...can anyone explain how this loop works?
has comment: http://stackoverflow.com/comment/42031526
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26720840
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26720824
has answer: http://stackoverflow.com/a/26721665
has answer: http://stackoverflow.com/a/26720842
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42031338
has answer: http://stackoverflow.com/a/26720814
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42031416
favorite count: 0
answer count: 5
has title: An array of integers in a for loop?
has comment: http://stackoverflow.com/comment/42031620

http://stackoverflow.com/a/26756743
answers question: http://stackoverflow.com/q/26755267
downvote count: 0
has comment: http://stackoverflow.com/comment/42099986
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42103041
upvote count: 1
has body: I suggest you to download Oracle Enterprise Pack for Eclipse. It provided Oracle's Middleware for developers who looking addition weblogic server.

http://stackoverflow.com/comment/41986698
type: Comment
comment on: http://stackoverflow.com/q/26695869
type: QuestionComment
has text: I am using `size()`; I just changed it to `size` for simplicity in asking this question. The array is also actually an arrayList.
score: 0

http://stackoverflow.com/a/26801680
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26801672
accepted answer of: http://stackoverflow.com/q/26801672
type: AcceptedAnswer
downvote count: 0
has body: Your program is all good and fine. Just one mistake. System.out.println(byteArray); prints hashCode of byte array object. (Note: Arrays are object in Java not primitive type) You should use System.out.println(Arrays.toString(byteArray)); instead and you will get same value for both steps 1 and 3. As per javadocs Arrays.toString(byte[] a) returns a string representation of the contents of the specified array. Your code after changes will be : public static void main(String[] args) { MessageDigest messageDigest = null; String ALGORITHM = "SHA"; try { messageDigest = MessageDigest.getInstance(ALGORITHM); byte[] arr = "admin1!".getBytes(); byte[] arr2 = messageDigest.digest(arr); System.out.println(Arrays.toString(arr2)); String encoded = Base64.encodeBase64String(arr2); System.out.println(encoded); byte[] decoded = Base64.decodeBase64(encoded); System.out.println(Arrays.toString(decoded)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } and output will be : [-9, 65, -52, 125, 26, -86, -91, -4, 17, 38, 7, -76, 106, 118, 90, -73, -33, 1, 77, -46] 90HMfRqqpfwRJge0anZat98BTdI= [-9, 65, -52, 125, 26, -86, -91, -4, 17, 38, 7, -76, 106, 118, 90, -73, -33, 1, 77, -46] Note value of byte array is same.

http://stackoverflow.com/comment/42244823
has text: Alex: It's a socket to a server that I wrote. The android app is the client. The server will have no problem cranking data out, but the Android app has to post the data (to a canvas) as quickly as possible (real time, ideally, ~20fps+). I did some metrics the multiple calls to readInt() did hurt it. My naive solution (read all bytes from buffer, update canvas pixel by pixel) took 1.998 sec, which is way too slow. readInt() loop you suggested takes 2.644, which is worse. Best perf was found with a double copy (InputStream to ByteBuffer, ByteBuffer to Bitmap, Bitmap to Canvas 0.475 sec.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26752917

http://stackoverflow.com/comment/41967711
type: Comment
comment on: http://stackoverflow.com/a/26684228
has text: I am facing one more difficulty now. `escapeHtml` is not available for `<s:select>`. Was trying this : `<s:select list="lsEmp.{name+' lives in '+address}" escapeHtml="false"/>`. How to do this. can you advice me.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26782733
has comment: http://stackoverflow.com/comment/42275420
type: Answer
answers question: http://stackoverflow.com/q/26767180
has body: There is an example of adding a custom sequence object to EclipseLink to solve this issue here: http://helpdesk.ibs-aachen.de/2009/08/27/eclipselink-ms-sql-server-identity/
score: 0
has comment: http://stackoverflow.com/comment/42182634
has comment: http://stackoverflow.com/comment/42158999

http://stackoverflow.com/comment/42186906
comment on: http://stackoverflow.com/a/26806611
has text: Thanks a lot for your answer! That is exactly the problem, the only thing is that I had no idea on how to solve it ;) managed now though!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/81826543
type: AnswerComment
type: Comment
score: 0
has text: In my case the error caused because of something different. Check my answer here : https://stackoverflow.com/a/47436165/700693
comment on: http://stackoverflow.com/a/26908738

http://stackoverflow.com/a/26823649
downvote count: 0
score: 1
has body: OpenShift is a PaaS provider. It gives you a Platform with a Java runtime and an application server (Tomcat, Wildfly,...) on which you can deploy your application. AWS has a lot of different services. EC2 is a IaaS. It gives you an Infrastructure. It starts a virtual machine with the operating system you've choosen, then you install Java and you can deploy your application. Some additional setup has to be done on the virtual network.
accepted answer of: http://stackoverflow.com/q/26823464
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26823464
type: Answer

http://stackoverflow.com/q/26818621
has title: Converting Roman Numeral to integer value?
linked to: http://stackoverflow.com/q/9073150
score: 1
tagged with: java
has body: I'm a new programming student and my assignment is to convert the input of a Roman Numeral to it's integer value. Here is what I have been given: Write a program that converts a Roman number such as MCMLXXVIII to its decimal number representation. This program must have 3 methods and a main method! Write a method that takes input from the user and passes it to a conversion method. Write a method that yields the numeric value of each of the letters (conversion method). Write a method that outputs the number the user entered and the converted number. Write a main method to test the 3 methods. HINT: Use a single dimensional array! Convert a string as follows: • Look at the first two characters. If the first has a larger value than the second, then simply convert the first. • Call the conversion method again for the substring starting with the second character. • Add both values. o If the first one has a smaller value than the second, compute the difference and add to it the conversion of the tail. Now I am struggling trying to figure out what to do for my conversion method. Here is what I have written so far: public static String romanInput(String number) { Scanner numberInput = new Scanner (System.in); System.out.print("Enter a roman numeral: "); String userInput = numberInput.next(); return userInput; } public static int numberConversion(int number) { int romanConv = 0; char[] romanChar = {1, 5, 10, 50, 100, 500, 1000}; for (int i = 0; i &lt; romanChar.length; i++) } You could see that I have already written the method that takes the input from a user. I think I did this correctly. However, I don't know what to do for this conversion method. It says to use a single dimensional array so that's what I did over here: char[] romanChar = {1, 5, 10, 50, 100, 500, 1000}; Those are supposed to be the values of I, V, X, L, C, D, and M. I'm really just confused as where to go from there and I would appreciate it if someone can help me out.
duplicate of: http://stackoverflow.com/q/9073150
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42208142
has comment: http://stackoverflow.com/comment/42207474
possible better answer: http://stackoverflow.com/a/26818832
favorite count: 0
has answer: http://stackoverflow.com/a/26818832
has answer: http://stackoverflow.com/a/26818777
accepted answer: http://stackoverflow.com/a/26818777
has comment: http://stackoverflow.com/comment/42207482
type: AnsweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42207276
type: Question

http://stackoverflow.com/a/26745136
answers question: http://stackoverflow.com/q/26741188
has body: Generally speaking in Swing you can't set the look and feel for any specific component but for the whole set of them. See How to Set the Look and Feel. On the other hand, WebLaF provides extensions for Swing components that have a custom "Look" on their own with no need to set the Look and Feel to WebLaF for the entire application. In this case, instead of using a JComboBox you can use WebComboBox which is an extension of the previous one. However this custom look is limited and some features such as font (size, weight and family), renderers, pop ups, etc. don't change and still the same of the configured look and feel. So I wouldn't suggest you to do this at all and keep consistency either by setting WebLaf as Look and Feel or by using standard Swing components. Consider the pictures below (note WebList is broken with Nimbus): MetalLookAndFeel NimbusLookAndFeel WindowsLookAndFeel WebLookAndFeel
type: Answer
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/a/26824507
answers question: http://stackoverflow.com/q/26824461
has body: Your storing format seems like json so you can use any json parser. For example: gson, jackson.
score: 0
type: Answer

http://stackoverflow.com/q/26710722
answer count: 3
has answer: http://stackoverflow.com/a/26710859
has answer: http://stackoverflow.com/a/26710855
type: UnansweredQuestion
has title: Java big class organization
tagged with: oop
tagged with: java
has body: I'm starting in java and I don't if a big organization, like I want, it can do. I have to many parameters to include in a class and I want to access something similar like that: For example I have the class Student who implements the class Person. But he class Student have many parameters and I want to classified it it like this: Student John = new Student(); John.physical.setHeight(178); John.physical.setWeight(70); John.academic.setQualification(7.5); John.academic.setSubject(Maths); John.administrative.setAccountNumber(XXXXX); John.administrative.setPassport(123456789); ... Can I do that?
has comment: http://stackoverflow.com/comment/42012945
type: Question
has comment: http://stackoverflow.com/comment/42012928
has answer: http://stackoverflow.com/a/26710847
has comment: http://stackoverflow.com/comment/42012890
tagged with: class
score: 0

http://stackoverflow.com/q/26769065
has comment: http://stackoverflow.com/comment/118471399
type: UnansweredQuestion
type: Question
has title: Slow startup of next activity after closing interstitial ad (AdMob)?
tagged with: java
has comment: http://stackoverflow.com/comment/42126756
score: 4
has body: When I upgraded from the old Google AdMob SDK to the new Google Pay Services SDK, I noticed a difference in how quickly the interstitial ad closes and starts the next activity (which also brings up a new layout). In the past, it was near instant. Now, with the new Play Services interstitial, I have noticed a 1-2 second delay after clicking "x" on the interstitial before the new activity starts. How can I get rid of this delay? interstitial = new InterstitialAd(this); interstitial.setAdUnitId(AD_UNIT_ID); AdRequest adRequest = new AdRequest.Builder().build(); final Intent nextActive = new Intent("activity"); interstitial.loadAd(adRequest); interstitial.setAdListener(new AdListener() { @Override public void onAdClosed() { super.onAdClosed(); //Intent nextActive = new Intent("activity"); startActivity(nextActive); } @Override public void onAdFailedToLoad(int errorCode) { super.onAdFailedToLoad(errorCode); //Intent nextActive = new Intent("activity"); startActivity(nextActive); } @Override public void onAdLeftApplication() { super.onAdLeftApplication(); } @Override public void onAdOpened() { super.onAdOpened(); } @Override public void onAdLoaded() { displayInterstitial(); super.onAdLoaded(); } });
tagged with: admob
upvote count: 4
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42158928
tagged with: android
has comment: http://stackoverflow.com/comment/42194709
answer count: 0

http://stackoverflow.com/comment/42114846
type: Comment
comment on: http://stackoverflow.com/a/26766250
score: 0
type: AnswerComment
has text: "/etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME"

http://stackoverflow.com/q/26742723
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42071152
upvote count: 0
has title: Listing the people who earned less than the average?
tagged with: java
has comment: http://stackoverflow.com/comment/42071276
has body: The question i'm having is that is there anyway I can compare the final average salary and then go through the loop again and compare the Final average salary to each salary and determine who is lower and print that person out and do that for everyone i'm having trouble trying to figure that out here is my code. Should i put the people in another array list and compare from there? import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; /** * Created by Kuroii on 11/3/2014. */ public class BelowAverage { public static void main(String[] args) { String inputFile = "c:\\Users\\Kuroii\\documents\\javafiles\\sampletwodata.txt"; String strline,FirstNames="",SurNames="",EMPnumbers=""; int totalSalary=0,averageSalary=0,salary=0; // ArrayList&lt;String&gt; inputLines = new ArrayList(); try { FileInputStream fstream = new FileInputStream(inputFile); BufferedReader inputBuffer = new BufferedReader(new InputStreamReader(fstream)); System.out.println("Starting..."); while ((strline = inputBuffer.readLine()) != null) { inputLines.add(strline); } System.out.print("Read in "); System.out.print(inputLines.size()); System.out.println(" lines"); } catch (Exception e) { System.err.println("MB Error reading input file"); } for (int i = 0; i &lt; inputLines.size(); i++) { String delim = "[ ]+"; String[] fields = inputLines.get(i).split(delim); String wage = fields[3]; String hours = fields[4]; FirstNames = fields[1]; EMPnumbers = fields[5]; SurNames = fields[2]; salary = Integer.parseInt(wage) * Integer.parseInt(hours); totalSalary =totalSalary + salary; averageSalary = totalSalary/inputLines.size(); } } }
downvote count: 1
tagged with: average
type: Question
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/26742809

http://stackoverflow.com/comment/49133438
type: Comment
comment on: http://stackoverflow.com/q/26737981
score: 0
type: QuestionComment
has text: Were you able to solve this? I am facing this same issue.

iterator
tags question: http://stackoverflow.com/q/26740782
tag name: iterator
tags question: http://stackoverflow.com/q/26744372
tags question: http://stackoverflow.com/q/26747041
tags question: http://stackoverflow.com/q/26682197
tags question: http://stackoverflow.com/q/26692423
type: Tag

google-cloud-sql
tags question: http://stackoverflow.com/q/26740615
tag name: google-cloud-sql
tags question: http://stackoverflow.com/q/26832235
type: Tag
tags question: http://stackoverflow.com/q/26733307

http://stackoverflow.com/a/26829142
type: AcceptedAnswer
has body: I'd approach this with a combination of JTidy and either JAXB or XStream. JTidy will help you to clean the HTML mark-up which is not necessary valid XHTML. JAXB or XStream could then be used to unmarshal XHTML into Java objects and marshal them back in XML Form. I am, so to speak, more familiar with JAXB so I'll sketch the JAXB way. With JAXB, you'd take the some XML Schema of XHTML, for instance XHTML 1.0 Strict Schema and compile it using JAXB's schema compiler, the XJC. Compilation most probably won't succed from the very start because of the some naming collision. For instance, xml:lang and lang attributes will map to the same lang property in the Java class. At this point you'll need to use a binding file to customize the XML Schema -> Java derivation. Here's how it could look like for the schema mentined above: &lt;jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc"&gt; &lt;jaxb:bindings schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" node="/xs:schema"&gt; &lt;jaxb:schemaBindings&gt; &lt;jaxb:package name="org.hisrc.w3c.xhtml.v_1_0_strict"/&gt; &lt;/jaxb:schemaBindings&gt; &lt;jaxb:bindings node="xs:attributeGroup[@name='i18n']/xs:attribute[@ref='xml:lang']"&gt; &lt;jaxb:property name="xmlLang"/&gt; &lt;/jaxb:bindings&gt; &lt;jaxb:bindings node="xs:element[@name='bdo']/xs:complexType/xs:complexContent/xs:extension/xs:attribute[@ref='xml:lang']"&gt; &lt;jaxb:property name="xmlLang"/&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; When you (hopefully) finally succeed, you'll get a package of some 90+ Java classes which are derived from the XHTML 1.0 Strict XML Schema. You'll get classes like Map and Area with properties for all the elements and attributes you have in your schema. Having these classes you could now unmarshal your XML (ideally pre-processed with JTidy). This…
answers question: http://stackoverflow.com/q/26789341
upvote count: 1
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26789341

http://stackoverflow.com/q/26795798
has comment: http://stackoverflow.com/comment/42165779
has comment: http://stackoverflow.com/comment/42166462
has comment: http://stackoverflow.com/comment/42166744
upvote count: 0
tagged with: data-structures
has body: I have a task that constantly add items into TreeMap, and it also remove just inserted items from TreeMap when some condition is met on this item. I know the TreeMap's complexity is O(log-n) in both insert/delete. Since the task had hold the deleted items all information, including: key, value and maybe position information. If JDK has a data structure that support delete element with position information, the time complexity can be constant and reduce half computing time of my task. Is there any one data structure support this feature, delete entry with position, and other operations' complexity in O(log-n) in JDK?
has title: Is there sorted data structure in JDK that supports remove at constant time?
has comment: http://stackoverflow.com/comment/42166276
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42172523
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42166069
has comment: http://stackoverflow.com/comment/42166232
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/26810613
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42165830

http://stackoverflow.com/comment/42051774
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26729385
has text: np, glad I could help.
type: AnswerComment

http://stackoverflow.com/comment/49905177
comment on: http://stackoverflow.com/q/26747076
has text: Yes, many of them actually.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42041150
comment on: http://stackoverflow.com/a/26726045
score: 0
type: AnswerComment
has text: just clear this code: <context:component-scan base-package="controller" /> <mvc:annotation-driven /> . Then the project run normally, i do not know why....
type: Comment

http://stackoverflow.com/comment/42195141
comment on: http://stackoverflow.com/a/26810929
type: AnswerComment
score: 0
type: Comment
has text: I did a bad job with my example, it emphasized the wrong part of my question. I don't want to always do `distinct`, sometimes I need other filters.

http://stackoverflow.com/comment/42030637
has text: this is kind of general, can you provide more detail ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26720153
type: Comment

http://stackoverflow.com/comment/42025530
comment on: http://stackoverflow.com/a/26716184
type: AnswerComment
type: Comment
score: 0
has text: Thanks! I will search the notesin9 videos

http://stackoverflow.com/q/26757594
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26757675
has answer: http://stackoverflow.com/a/26757757
type: UnansweredQuestion
has title: Thread's copy of local variable
has body: Threads have separate copy of local variables. I have a method in which a hashtable object is created. Will there be two different copies of hashtable objects for two different threads ?. the hashtable object is then passed to other method. example method: public void exampleMethod(String a,String b, String c) { final Hashtable&lt;String,String&gt; parameterMap=new Hashtable&lt;String,String&gt;(); parameterMap.put("key1",a); parameterMap.put("key2",b); parameterMap.put("key3",c); pqrsObject.takeRequest(parameterMap); }
score: 2
upvote count: 2
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42096996
type: Question
has comment: http://stackoverflow.com/comment/42097068
has comment: http://stackoverflow.com/comment/42097019
has answer: http://stackoverflow.com/a/26757685

http://stackoverflow.com/a/26774222
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26773892
has body: try using awt BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferedImage.createGraphics(); Color bg = new Color(242, 242, 242); g2d.setColor(bg); g2d.fillRect(0, 0, w, h); g2d.setColor(Color.red); g2d.drawLine(startx, starty, endx, endy); provide you own values of course
downvote count: 0
has comment: http://stackoverflow.com/comment/42147845

http://stackoverflow.com/q/26680679
tagged with: java
tagged with: hibernate
type: Question
downvote count: 0
has title: error explicitly setting hibernate dialect to sqlite
tagged with: sqlite
favorite count: 0
has body: I'm working on a web application using spring and hibernate with sqlite as the database backend and I keep running into an error. Here's the full stack trace: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:91) at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:74) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:116) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:82) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:199) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:251) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:253) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:216) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:82) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) at org…
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2

http://stackoverflow.com/comment/42038287
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26722589
has text: The "%" is one example of a character getting encoded again.

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/26684292

http://stackoverflow.com/comment/42040238
has text: okey, done it after 1 minute
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26725306

http://stackoverflow.com/comment/42180410
type: AnswerComment
type: Comment
score: 0
has text: @DarkDust op didn't specify negative numbers also.
comment on: http://stackoverflow.com/a/26800570

http://stackoverflow.com/a/26696111
type: Answer
accepted answer of: http://stackoverflow.com/q/26695964
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26695964
has body: The "indirect delegation" is more general / less restrictive than "direct delegation". Lets say you are writing class A which extends the ForwardingList. If you use the direct delegation, then you need to pass the instance of the list to the constructor of A. Now if the construction of the underlying list is very expensive operation and the call to A.size() is not always executed by the users of A you might want to initialize the underlying list lazily to improve performance. That is when the "indirect delegation" becomes useful.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42055028
score: 0
has text: why we can't use POST with HttpURLConnection.first we open the connection.then after we can write parameters to the connection. Is it possible thing?
type: AnswerComment
comment on: http://stackoverflow.com/a/26730402
type: Comment

http://stackoverflow.com/a/27840929
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26695664
accepted answer of: http://stackoverflow.com/q/26695664
score: 5
type: AcceptedAnswer
has body: Rename the Adapter ExpandableListAdapter's this will solve your problem.

http://stackoverflow.com/a/26919933
type: Answer
has body: As requested a sample of Shiro configuration with LDAP realm: src/main/resources/shiro.ini: ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm ldapRealm.userDnTemplate = uid={0},dc=example,dc=com ldapRealm.contextFactory.url = ldap://ldap.forumsys.com:389 securityManager.realms = $ldapRealm src/main/java/ShiroLdap.java: import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.config.IniSecurityManagerFactory; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.util.Factory; public class ShiroLdap { public static void main(String[] args) { Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini"); SecurityManager securityManager = factory.getInstance(); AuthenticationInfo authenticationInfo = securityManager.authenticate(new UsernamePasswordToken("riemann", "password")); System.out.println(authenticationInfo); } } pom.xml 4.0.0 sample shiro-ldap-realm 0.0.1-SNAPSHOT org.apache.shiro shiro-core 1.2.3 org.slf4j jcl-over-slf4j 1.7.7 ch.qos.logback logback-classic 1.1.2
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42424748
has comment: http://stackoverflow.com/comment/42410324
has comment: http://stackoverflow.com/comment/106477968
has comment: http://stackoverflow.com/comment/106436437
has comment: http://stackoverflow.com/comment/63172661
upvote count: 1
answers question: http://stackoverflow.com/q/26804398

http://stackoverflow.com/comment/42229100
comment on: http://stackoverflow.com/q/26830410
score: 0
type: QuestionComment
type: Comment
has text: Yes, I didn't realize it thanks. By the way, can you explain why it throws SocketTimeoutException when the documentation doesn't mention the possibility of that kind of exception thrown?

http://stackoverflow.com/comment/41981377
score: 0
type: AnswerComment
has text: Package's name should be "ceng.ceng351.cpl". Thats a must.
type: Comment
comment on: http://stackoverflow.com/a/26692626

http://stackoverflow.com/q/26829877
has comment: http://stackoverflow.com/comment/42331861
answer count: 0
has body: I am working on a website using struts2 framework. I tried to run the code but then I encountered an error as below SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener java.lang.NoClassDefFoundError: org/apache/tiles/context/TilesRequestContextFactory at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) at org.apache.tiles.jsp.context.JspTilesContextFactory.<init>(JspTilesContextFactory.java:51) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.tiles.context.ChainedTilesContextFactory.init(ChainedTilesContextFactory.java:84) at org.apache.struts2.tiles.StrutsTilesContainerFactory$StrutsTilesContextFactory.init(StrutsTilesContainerFactory.java:79) at org.apache.struts2.tiles.StrutsTilesContainerFactory.storeContainerDependencies(StrutsTilesContainerFactory.java:55) at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:231) at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:198) at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:163) at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java…
type: UnansweredQuestion
has title: Struts2 - tiles error
has comment: http://stackoverflow.com/comment/42332559
has comment: http://stackoverflow.com/comment/42333134
tagged with: java
type: Question
tagged with: tiles
tagged with: struts2
score: 0

http://stackoverflow.com/comment/42172345
type: Comment
comment on: http://stackoverflow.com/a/26785066
score: 0
type: AnswerComment
has text: Yes you must be careful with this as I said the code relies heavily on the implementation. You might want to look at possibly initializing a JColorChooser with your own implementation of an AbstractColorChooserPanel which uses an HSV Model, unfortunately the oracle implementations of these are hidden from the user and proprietary.

http://stackoverflow.com/comment/42198018
comment on: http://stackoverflow.com/q/26813002
score: 1
has text: What do you think your `while` statement does?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42160512
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26792113
has text: @LeleDumbo Reported for being useless and condescending when he could have actually tried or not posted obstructive garbage.

http://stackoverflow.com/comment/59344322
type: Comment
has text: No issues so far, I'm running the exact same updates from multiple web apps, though they all start in sequence with Tomcat. Therefore only the first one actually applies anything. I haven't tested that with many nodes starting at once, though running changes in transactions should keep you safe with all DBMS properly handling transactions.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27043703

http://stackoverflow.com/comment/42172332
type: AnswerComment
has text: Thank you I Kind of changed most of my code and it works now. (If I add the last if statement in all cases ;) )
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26798562

http://stackoverflow.com/comment/42084724
has text: There is no error! Just after proguarding object requests not send anymore.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26750272

http://stackoverflow.com/comment/42220157
has text: I just checked. It is not reading the entire data. So the statement to read from Dynamo DB his erroneous.
comment on: http://stackoverflow.com/q/26825792
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42095765
type: QuestionComment
type: Comment
has text: @Multisync You are correct. Semi column was the culprit :)
comment on: http://stackoverflow.com/q/26715287
score: 0

http://stackoverflow.com/comment/41964829
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26682588
score: 0
has text: I looked at the webapps folder it is empty too. I mean `target/tomcat/logs` folder is empty. And it turns out that `target/tomcat/webapps` is empty too

http://stackoverflow.com/q/26712062
has comment: http://stackoverflow.com/comment/42015244
has answer: http://stackoverflow.com/a/26712196
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42027553
type: Question
has title: Best practice when waiting for multiple threads - time, count or something else?
score: 1
tagged with: java
has body: My application will, during runtime, contain multiple threads (in this example 7) doing independent work. However, every once in a while, the threads will have to synchronize their data. This will be done by the threads calling the DataSynchronizer object which they all have a reference to. My idea for flow in this class looks like this: public class DataSynchronizer { public void synchronizeData(List&lt;Data&gt; threadData) { // Wait for all 7 threads to call this method // When all 7 are here, hold them here &amp; do work using one of the threads // or a new anonymous thread // Release the threads &amp; let them continue their independent work } } My question is, what is the best way for me to 'wait for all x threads' before doing the synch work? I know that all threads will call the synchronizeData method within 1, max 2 seconds of each other. So do I, 1) Wait for 2s after the first thread call the method and assume all threads have now also arrived? or 2) Keep a count to make sure all active threads have arrived? (App will wait for eternity if a thread crashes just before calling method) 3) Count + timeout? 4) ???
has answer: http://stackoverflow.com/a/26712135
accepted answer: http://stackoverflow.com/a/26712135
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26712151
has answer: http://stackoverflow.com/a/26712151
linked to: http://stackoverflow.com/q/4
favorite count: 0

http://stackoverflow.com/comment/42490016
comment on: http://stackoverflow.com/q/26752429
score: 0
has text: any specific reason you want to run it on Juno and not use one of the later versions ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41994720
comment on: http://stackoverflow.com/q/26700542
has text: I have edited the code where I get the problem and I don't understand why or what I'm making wrong
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26799115
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42172098
type: Question
possible better answer: http://stackoverflow.com/a/26799183
has answer: http://stackoverflow.com/a/26799183
score: 0
has comment: http://stackoverflow.com/comment/42172119
answer count: 3
has answer: http://stackoverflow.com/a/26799262
has comment: http://stackoverflow.com/comment/42172099
has answer: http://stackoverflow.com/a/26799280
has body: I have a 2D array and want to use contains method to check if myChar is part of myArray[i][0] public static final String[][] myArray = { {"NM1", "DESC1"}, {"NM2", "DESC2"}, {"NM3", "DESC3"}, {"NM4", "DESC4"}, {"NM5", "DESC5"} } Arrays.asList(myArray).contains(mychar); However this is failing for me. When i make it as 1D array like: public static final String[][] myArrayNm = { "NM1", "NM2", "NM3", "NM4", "NM5" } Arrays.asList(myArrayNm).contains(mychar); is working for me. Is there a way i can do the value check using 2D array (loop will be the last option)
tagged with: java
accepted answer: http://stackoverflow.com/a/26799262
has title: Look for an element in a 2d Array using contains
has comment: http://stackoverflow.com/comment/42172210

http://stackoverflow.com/q/26734389
has answer: http://stackoverflow.com/a/26734469
score: -3
has answer: http://stackoverflow.com/a/26734450
accepted answer: http://stackoverflow.com/a/26734450
has body: I have downloaded a java file needed for a coursework at college. However I find it impossible to run it. Eclipse won't give me the chance to even run it (only ant build), and if I use netbeans I get this exception : Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException: Uncompilable source code - class Hangman is public, should be declared in a file named Hangman.java at Hangman. &lt; clinit &gt; (hangman(Case Conflict).java: 20) Java Result: 1 If someone is kind enough to read through the code, I really do not know what to do next. I figure there has to be something wrong with the main class. Thanks! import java.util.HashSet; import java.util.Scanner; import java.util.Set; class Hangman { Scanner userInput; private Set &lt; Character &gt; wrongGuesses; private String[] answers = { "leverets", "hatchlings", "puppies", "kittens", "pullets", "goslings" }; private String answer; private String guessed; private int maxTurns; private int currentTurns; private boolean inProgress; private char nextGuess; private boolean gameWin; public Hangman() { userInput = new Scanner(System.in); wrongGuesses = new HashSet &lt; Character &gt; (); inProgress = false; gameWin = false; maxTurns = 14; currentTurns = 0; // set answer somehow answer = answers[0]; // set guessed to the correct number of dashes StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; answer.length(); i++) { sb.append('-'); } guessed = sb.toString(); } /* start a new game */ public void startGame() { inProgress = true; startGameLoop(); } /* the game loop. this method is the heart of the game */ private void startGameLoop() { printInstructions(); while (inProgress) { printStatus(); acceptGuess(); checkStatus(); } printWinOrLose(); } private void printInstructions() { System.out .println("Guess the word one letter at a time until you win or run out of turns. Good luck!"); } private void printWinOrLose() { if (gameWin) { System.out.println("You win! The answer…
has comment: http://stackoverflow.com/comment/42055408
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26737886
has title: Cannot Run *.java downloaded file
type: Question
possible better answer: http://stackoverflow.com/a/26734469
has comment: http://stackoverflow.com/comment/42055393
favorite count: 0
answer count: 3
downvote count: 3
upvote count: 0

http://stackoverflow.com/a/26791655
has comment: http://stackoverflow.com/comment/42159118
accepted answer of: http://stackoverflow.com/q/26791476
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26791476
has comment: http://stackoverflow.com/comment/42159050
type: Answer
has comment: http://stackoverflow.com/comment/42158995
has comment: http://stackoverflow.com/comment/42159106
upvote count: 3
has body: Woohoo! Found it! In the first example, the method created the substrings after each recursive call, regardless if the string was empty or not, generating an indexoutofbounds exception for each empty string. By creating the substrings after checking for an empty string, the program won't create the substrings if the string is empty. Old: String start = s.substring(0, 1); String end = s.substring(s.length() - 2, s.length() - 1); if (s.equals("") || s.length() == 1) { return true; } New: if (s.equals("") || s.length() == 1) { return true; } String start = s.substring(0, 1); String end = s.substring(s.length() - 1); Feels so good to figure your own stuff out.
score: 3

http://stackoverflow.com/a/26767999
has body: You can easily use some opensource JS chart library for this. Good options: http://www.chartjs.org/ or http://www.flotcharts.org/ or http://dygraphs.com/ You get the data from your server in i.e. JSON format with AJAX request (5 s period?) and feed it to the chart library. You could use websockets to have updates triggered from server but that is slightly more difficult.
upvote count: 1
has comment: http://stackoverflow.com/comment/42116845
has comment: http://stackoverflow.com/comment/42117288
has comment: http://stackoverflow.com/comment/42117027
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42117074
answers question: http://stackoverflow.com/q/26767683
score: 1

http://stackoverflow.com/comment/41968857
comment on: http://stackoverflow.com/q/26684990
score: 1
has text: can't you just use a `Map<String,Class<? extends DataSource>>`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42161319
type: QuestionComment
comment on: http://stackoverflow.com/q/26792582
score: 0
has text: @fastsnail how would I utilize the arraylist in this case. I checked out the API, but don't understand how to use it in this case.
type: Comment

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/26825792
tag name: csv
tags question: http://stackoverflow.com/q/26817940
tags question: http://stackoverflow.com/q/26729652
tags question: http://stackoverflow.com/q/26776417
tags question: http://stackoverflow.com/q/26817096
tags question: http://stackoverflow.com/q/26682538
tags question: http://stackoverflow.com/q/26821707
tags question: http://stackoverflow.com/q/26717576
tags question: http://stackoverflow.com/q/26808092

http://stackoverflow.com/comment/42079551
has text: The line should read `else if (imaginary < 0)` (ie, add `if` after `else`, and remove the semicolon). You cannot use a comparison on `else`. `else` means if nothing in the comparisons above was true.
comment on: http://stackoverflow.com/q/26747236
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/97791182
score: 0
type: Comment
has text: Unfortunately I don't work on the same project any more so I've fallen out of touch with the tech - hope someone else can help!
comment on: http://stackoverflow.com/a/28539448
type: AnswerComment

http://stackoverflow.com/comment/41951835
has text: Please **update your question** with relevant information. Don't just place it in the comments.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26676244
type: Comment

http://stackoverflow.com/a/26745559
upvote count: 2
has comment: http://stackoverflow.com/comment/42076596
has body: It can be done like this: /** this comment &amp;#42;/ ends here */ &amp;#42; is the HTML character code for *, when the comment is processed into documentation, only the * will be left. As an example:
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26745395

http://stackoverflow.com/q/26746588
type: Question
has comment: http://stackoverflow.com/comment/42117741
has comment: http://stackoverflow.com/comment/42130110
has answer: http://stackoverflow.com/a/26822530
answer count: 1
has title: How would one model somthing updateable, say like a “status” of a thing in Cassandra CQL3 and be able to query on this status?
linked to: http://stackoverflow.com/q/26439396
has comment: http://stackoverflow.com/comment/42111711
tagged with: cql
has comment: http://stackoverflow.com/comment/42100323
tagged with: cassandra
score: 0
accepted answer: http://stackoverflow.com/a/26822530
tagged with: cql3
has body: This is a bit of a contrived example to illustrate my question, but let's say I have a Car entity which contains Lightbulb entities. A car has several lightbulbs, each of which could be "on", "off" or "broken". Each type of lightbulb has a unique id. (left headlight = 100, right headlight = 101... that sort of thing) The status of a lightbulb needs to be constantly updated. What I'd like to do is query for a specific car for a set of lightbulbs with a specific status. something like: "give me all the lightbulbs with status "on" for car "chevy" model "nova" vin "xyz-123"". create table lightbulbstatus ( bulbid uuid, carmake text, carmodel text, carvin uuid, lastupdate timestamp, status int, /* row key * /* col keys */ PRIMARY KEY( (carmake, carmodel, carvin), ? ? ? ?) ); I believe the row key should have the car coordinate in it, but beyond that, I'm a bit lost. I assume each time there is a status change to a bulb, we add a column. But I'm not sure what the keys should be in the column to make the query work. I think in RDBMS-land, you could do a subselected or nested query to find bulbs with the status = on. select * from lightbulbstatus where status = 1 and lastupdate &gt; (select lastupdate from lightbulbstatus where status != 1); No idea how you would do this in CQL3. Obviously sub-selects are not allowed.
has comment: http://stackoverflow.com/comment/42109845
tagged with: nosql
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26810859
type: Question
linked to: http://stackoverflow.com/q/10834589
linked to: http://stackoverflow.com/q/515428
has answer: http://stackoverflow.com/a/26811534
has comment: http://stackoverflow.com/comment/42194725
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/42195038
has comment: http://stackoverflow.com/comment/42195200
accepted answer: http://stackoverflow.com/a/26811534
answer count: 3
has answer: http://stackoverflow.com/a/26811566
favorite count: 0
tagged with: netbeans
has body: I have a java gui project which I had just finished working on. I was using netbeans to develop this and now I want to pack the entire project into a jar file. Netbeans seems to do this on it's own, but it does not include all dependencies along with it. i.e. If I have some images I have added to the classpath of the project, these images are not loaded when I execute the jar. It shows a bunch of errors in the console when I run it due to it not being able to load the images/files associated with the project. Is there an option in netbeans to include EVERYTHING and have the program run as if it were running from the IDE?
possible better answer: http://stackoverflow.com/a/26811566
has answer: http://stackoverflow.com/a/26811630
upvote count: 1
has comment: http://stackoverflow.com/comment/42195555
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42194279
score: 1
tagged with: java
has title: How to make a complete java project to jar

http://stackoverflow.com/comment/42026898
comment on: http://stackoverflow.com/q/26718336
score: 0
has text: list_view_comments = new list_view_comments(getResources().getDrawable(R.drawable.ic_launcher), "Arianna Huffington", "Presidenta"); arraydir.add(list_view_comments); list_view_adapter adapter = new list_view_adapter(getActivity(), arraydir); lista.setAdapter(adapter);
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42239556
has text: If you select "Default" it will try to find what's installed in the operating system `path`. You said you installed Maven through Jenkins, so you have to pick that installed version from the list in configuration.
comment on: http://stackoverflow.com/q/26797937
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26786075
has comment: http://stackoverflow.com/comment/42231584
score: 5
answers question: http://stackoverflow.com/q/26785916
upvote count: 5
downvote count: 0
type: AcceptedAnswer
has body: Thread.sleep(time); Dont do it (you're blocking the EDT). Use a Swing Timer Timer timer = new Timer(time, new ActionListener(){ public void actionPerformed(ActionEvent e) { frame.setVisible(false); } }); timer.start(); See The Use of Multiple JFrames, Good/Bad Practice? Concurrency with Swing "When i run the constructor code inside the main method of outputDisplay class it shows the text massage " You are probably doing public static void main (String[] args) { new OutputDisplay(); } This is not run on the Event Dispatch Thread, (But wrong). If you ran it on the EDT, like you're supposed to (see Initial Threads, it will not work public static void main (String[] args) { SwingUtilities.invokeLater(new Runnable(){ new OutputDisplay(); &lt;==== Create on EDT }); WON'T WORK!! } "but when i call it inside other class by using new outputDisplay(String ip, int time) then only the frame appers but with no text inside it." JBUtton button = new JButton("Button"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { new OurputDisplay(); &lt;===== Created on EDT!! } }); Whether or not you start the application on the Event thread, all Component Events are dispatch on this thread, so when you press a button to try and open the new frame, this is create the frame on the EDT. Same problem as when running the OutputDisplay on its own with SwingUtilities.invokeLater
type: Answer
has comment: http://stackoverflow.com/comment/42238245
accepted answer of: http://stackoverflow.com/q/26785916

http://stackoverflow.com/comment/42087693
type: AnswerComment
score: 0
type: Comment
has text: @KyoAkashi lock [here](http://javahowto.blogspot.de/2006/06/set-classpath-in-eclipse-and-netbeans.html) maybe this helps.
comment on: http://stackoverflow.com/a/26752120

http://stackoverflow.com/q/26762905
has answer: http://stackoverflow.com/a/26764055
has comment: http://stackoverflow.com/comment/42107530
favorite count: 0
score: 3
has comment: http://stackoverflow.com/comment/42107840
tagged with: fxml
upvote count: 3
has comment: http://stackoverflow.com/comment/42107754
accepted answer: http://stackoverflow.com/a/26764055
linked to: http://stackoverflow.com/q/23105433
tagged with: java-8
has comment: http://stackoverflow.com/comment/42107625
has comment: http://stackoverflow.com/comment/42108266
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/23105433
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/42107820
has body: I am using JavaFX 8 and FXML in this project and trying to update my text area with the results from other classes within the program. The Text Area is defined in the FXML document as such: &lt;TextArea fx:id="feedBack" editable="false" focusTraversable="false" layoutX="203.0" layoutY="32.0" prefHeight="205.0" prefWidth="308.0" wrapText="true"/&gt; It is called in the controller here, note that originally it was a "private" item but to make it work with the classes I made it public: @FXML public static TextArea feedBack; EDIT: It is worth noting that when the TextArea is identified as "private" I have no issue getting the set/append text method to work but this does not allow me to use the text area in other classes, which is what I need to do. However now when I try to do either appendText() or setText(), such as follows: feedBack.setText("Connection Made"); I am given a null point exception. Why is this? I have made this work in JavaFX 7 with FXML by doing the same thing and it works fine. What am I missing to make this work? EDIT, test/proof of brokenness with complete tiny program. I did not make another class for this one as the textarea won't work in the control anyway. FXML: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import java.lang.*?&gt; &lt;?import java.util.*?&gt; &lt;?import javafx.scene.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="textareatester.FXMLDocumentController"&gt; &lt;children&gt; &lt;Label fx:id="label" layoutX="126" layoutY="120" minHeight="16" minWidth="69" /&gt; &lt;TextArea fx:id="feedback" layoutX="61.0" prefHeight="200.0" prefWidth="200.0" wrapText="true" /&gt; &lt;Button fx:id="dostuff" layoutX="261.0" layoutY="62.0" mnemonicParsing="false" onAction="#handleButtonAction" text="Button" /&gt; &lt;/children&gt; &lt;/AnchorPane&gt; Main Method: …
type: Question
downvote count: 0
answer count: 1
has title: Java TextArea setText() and appendText() returning Null Pointer Exception

http://stackoverflow.com/q/26790174
linked to: http://stackoverflow.com/q/182393
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26790601
has title: Spring 4 - java configuration of xml configuration
has comment: http://stackoverflow.com/comment/42156591
upvote count: 2
has comment: http://stackoverflow.com/comment/42156784
answer count: 2
has answer: http://stackoverflow.com/a/26791905
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I need some adivce. I am creating new application in spring 4 and wonder which configuration is better. For spring 4 brings conditional bean configuration for java config. Can you tell me which configuration you would chose and why? Is there something what i can't do in java config but can in xml and vice versa? I know that xml config allow me to change config without recompile is there something else?
type: UnansweredQuestion
tagged with: spring
score: 2
downvote count: 0

http://stackoverflow.com/q/26709754
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26711596
accepted answer: http://stackoverflow.com/a/26711596
type: Question
has comment: http://stackoverflow.com/comment/42012425
has body: I have this following problem: I have a customized Dual-Slider, it is very important to check every Value Change of this slider! If i change now the left or the right Slider there is a Event - Handling! If i make a click on the Line of the Slider there is also a Event, but its incorrect! When i click on the Line of the Slider, booth Sliders will jump together, the Values are actual, but there is only 1 Event-Handelt! How can i bind this Events together? m_slider.value1Property().addListener(new ChangeListener() { @Override public void changed(ObservableValue arg0, Object arg1, Object arg2) { try { handleSlider(); } catch (Exception e) { } } }); m_slider.value2Property().addListener(new ChangeListener() { @Override public void changed(ObservableValue arg0, Object arg1, Object arg2) { try { handleSlider(); } catch (Exception e) { } } }); Here you can see my Event-Binding! If the Value1 (Left Slider) or Value2 (Right Slider) change there values, there is a Event-Trigger. But if booth of them changes there Values (click on the line of the sliders) there is only 1 Event-Trigger and not booth! How can i fix this problem?
score: 0
answer count: 1
tagged with: events
has comment: http://stackoverflow.com/comment/42012466
has comment: http://stackoverflow.com/comment/42012746
tagged with: slider
has title: ValueProperty Change Listener
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42012718

while-loop
tags question: http://stackoverflow.com/q/26743618
tags question: http://stackoverflow.com/q/26788416
type: Tag
tags question: http://stackoverflow.com/q/26686089
tags question: http://stackoverflow.com/q/26764405
tags question: http://stackoverflow.com/q/26702380
tags question: http://stackoverflow.com/q/26693846
tags question: http://stackoverflow.com/q/26722639
tags question: http://stackoverflow.com/q/26781536
tags question: http://stackoverflow.com/q/26809028
tags question: http://stackoverflow.com/q/26727502
tags question: http://stackoverflow.com/q/26684729
tags question: http://stackoverflow.com/q/26789205
tags question: http://stackoverflow.com/q/26748908
tags question: http://stackoverflow.com/q/26812784
tags question: http://stackoverflow.com/q/26831087
tags question: http://stackoverflow.com/q/26748026
tags question: http://stackoverflow.com/q/26760349
tags question: http://stackoverflow.com/q/26741726
tags question: http://stackoverflow.com/q/26830153
tags question: http://stackoverflow.com/q/26683089
tags question: http://stackoverflow.com/q/26703236
tag name: while-loop

swfupload
tag name: swfupload
type: Tag
tags question: http://stackoverflow.com/q/26716022

http://stackoverflow.com/comment/41986327
score: 0
type: QuestionComment
has text: @Droidman I don't think the code will work in the state it currently is in because of the broken comments.
type: Comment
comment on: http://stackoverflow.com/q/26695600

http://stackoverflow.com/comment/42167465
has text: Thanks for this example, I will have a look at it - this afternoon or next week. After trying and playing around with this json-api I will come back! +1 of for the fast help for the moment :)
comment on: http://stackoverflow.com/a/26794813
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26801891
upvote count: 3
has comment: http://stackoverflow.com/comment/42177245
score: 3
has body: Change n[a] = scan.nextInt(); to n[i] = scan.nextInt(); a is not a valid index in an array that only has a elements. The valid indices are 0 to a-1.
has comment: http://stackoverflow.com/comment/42177312
accepted answer of: http://stackoverflow.com/q/26801877
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42879898
downvote count: 0
answers question: http://stackoverflow.com/q/26801877
type: Answer
has comment: http://stackoverflow.com/comment/42177212

http://stackoverflow.com/comment/42051011
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26729434
has text: i remove all ssm older than 3.5.0. my lib folder is: http://www.uploadimage.ro/img.php?image=2079_222_b35x.png
type: AnswerComment

http://stackoverflow.com/comment/42749722
type: Comment
has text: I don't think so, looking at https://i.sstatic.net/9K49t.png - line are wrapped, but the is no vertical scrolling?
comment on: http://stackoverflow.com/a/27089910
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42157037
score: 0
type: Comment
has text: @dognose I agree it seems unlikely they are actually using this feature but it's still one of the reasons this can be done.
type: AnswerComment
comment on: http://stackoverflow.com/a/26790425

http://stackoverflow.com/q/26742042
accepted answer: http://stackoverflow.com/a/26742096
has comment: http://stackoverflow.com/comment/42070344
has comment: http://stackoverflow.com/comment/42070288
possible better answer: http://stackoverflow.com/a/26742146
has answer: http://stackoverflow.com/a/26742146
has comment: http://stackoverflow.com/comment/42070065
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42069834
tagged with: java
has comment: http://stackoverflow.com/comment/42069865
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42070172
has comment: http://stackoverflow.com/comment/42070195
has comment: http://stackoverflow.com/comment/42069844
score: -2
has comment: http://stackoverflow.com/comment/42070249
has answer: http://stackoverflow.com/a/26742096
has comment: http://stackoverflow.com/comment/42070014
answer count: 2
has body: "==" or the equality operator in Java is a binary operator provided by Java programming language and used to compare primitives and objects. "==" compares two objects based on memory reference, so the "==" operator will return true only if the two object references it is comparing represent exactly same object, otherwise "==" will return false. My Question is how does the "==" operator works in java to compare objects? Here we are only concerned whether references are referencing to object or not. We are not talking about the equals() method.
tagged with: operator-keyword
has comment: http://stackoverflow.com/comment/42070431
has comment: http://stackoverflow.com/comment/42069889
has comment: http://stackoverflow.com/comment/42070078
has comment: http://stackoverflow.com/comment/42069952
has title: How "==" operator compare references? mean internal working of "==" operator
favorite count: 0
tagged with: equals

http://stackoverflow.com/comment/42267854
type: AnswerComment
type: Comment
has text: So does a for loop run infinite times until it gets to 4?
comment on: http://stackoverflow.com/a/26823613
score: 0

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/26819427
type: Tag

http://stackoverflow.com/a/26686759
upvote count: 20
downvote count: 0
answers question: http://stackoverflow.com/q/26679415
type: AcceptedAnswer
has body: The secret is to replace this: ui By this: ui other_schema You could also entirely remove all configuration, then the jOOQ code generator will generate classes for all the schemas it discovers (including pg_catalog and information_schema) More details can be found in the jOOQ manual.
accepted answer of: http://stackoverflow.com/q/26679415
type: Answer
score: 20
has comment: http://stackoverflow.com/comment/42001392

http://stackoverflow.com/a/29051117
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26771975
downvote count: 0
has body: I know it has been a while since you asked that question. I think Android overwrites common classes located in org.apache.http. You can not overwrite them by yourself. Try to relocate the downloaded packages to another location such as surrogate.org.apache.http to use them properly. From https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html: Google Android 1.0 was released with a pre-BETA snapshot of Apache HttpClient. To coincide with the first Android release Apache HttpClient 4.0 APIs had to be frozen prematurely, while many of interfaces and internal structures were still not fully worked out. As Apache HttpClient 4.0 was maturing the project was expecting Google to incorporate the latest code improvements into their code tree. Unfortunately it did not happen. Version of Apache HttpClient shipped with Android has effectively become a fork. Eventually Google decided to discontinue further development of their fork while refusing to upgrade to the stock version of Apache HttpClient citing compatibility concerns as a reason for such decision. As a result those Android developers who would like to continue using Apache HttpClient APIs on Android cannot take advantage of newer features, performance improvements and bug fixes. If you continue reading you will find the following: Some of the implementation classes had to be copied (or shaded) with different names in order to avoid conflicts with the older versions of the same classes included in the Android runtime. One can increase compatibility of with the stock version of HttpClient by avoiding 'org.apache.http.**.*HC4' classes. Use dependencies { compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' } to include the httpcomponents. You may have to use the shadowJar plugin to relocate your dependencies if you don't want to relocate them manually. Edit: I found this awesome tutorial which worked out for me. Even thought I would recommend to use AndroidAsync or Voll…
type: Answer

http://stackoverflow.com/comment/42155660
has text: These keys PUBLISH_API_KEY and DEFAULT_API_KEY in the string.xml
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26789434
type: Comment

http://stackoverflow.com/a/26701079
type: Answer
has comment: http://stackoverflow.com/comment/41995764
answers question: http://stackoverflow.com/q/26701056
accepted answer of: http://stackoverflow.com/q/26701056
has comment: http://stackoverflow.com/comment/41995825
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41995949
upvote count: 2
has body: The compiler cannot know whether the loop is actually run, therefore you must also have a return statement outside the outer loop. But then, if I look at your code, I am not sure whether returning is what you really want there. If it is your intention to print the entire matrix, you might want to use a StringBuilder and then use the append method inside the loops. After the outer loop, return a string representation of the builder using the toString method like so: StringBuilder sb = new StringBuilder(); // loop sb.append(someValue); sb.append('\n'); // after loop return sb.toString();
type: AcceptedAnswer

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/26827320
tags question: http://stackoverflow.com/q/26797524

http://stackoverflow.com/comment/42109607
comment on: http://stackoverflow.com/q/26762376
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [What happened between March 28th and March 29th, 1976 with the java.util.GregorianCalendar?](http://stackoverflow.com/questions/10698470/what-happened-between-march-28th-and-march-29th-1976-with-the-java-util-gregori)

http://stackoverflow.com/comment/42081462
comment on: http://stackoverflow.com/q/26748373
score: 0
type: Comment
type: QuestionComment
has text: I'm not sure what you mean by that MadProgrammer

http://stackoverflow.com/q/26808334
downvote count: 2
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42205583
tagged with: java
has body: I have the following code: return String.format( "%.2f", result); For some reason it is printing 37.00% I do NOT want the percentage sign at the end of this. Why is this occurring and how do I remove it?
has comment: http://stackoverflow.com/comment/42189441
type: Question
accepted answer: http://stackoverflow.com/a/26809031
has comment: http://stackoverflow.com/comment/42189691
has title: Java: Removing percent sign after printf formatting
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/42189534
has comment: http://stackoverflow.com/comment/42189560
favorite count: 0
has comment: http://stackoverflow.com/comment/42189494
has answer: http://stackoverflow.com/a/26809031

http://stackoverflow.com/comment/42074294
has text: Wasn't the idea that I didn't need a return statement at all? I changed the method to be "public static void" instead of just "public static" and this sorted everything out, if you have anything else to add I'd love to hear it though!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26743945
type: Comment

http://stackoverflow.com/comment/41954636
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26674354
has text: Need to see more code before recommending a solution. Locales are only applied during formatting or parsing. Date objects are inherently GMT. So where is this formatted date (that needs parsing) coming from? Sqllite query? date.toString()? UI? elsewhere?
type: Comment

http://stackoverflow.com/comment/42230417
score: 0
type: Comment
has text: @Thomas I have reworded the answer, and added a modified version of your code that aims to make its behaviour clearer.
comment on: http://stackoverflow.com/a/26830765
type: AnswerComment

http://stackoverflow.com/q/26828649
upvote count: 2
tagged with: encryption
has answer: http://stackoverflow.com/a/26831860
type: AnsweredQuestion
has body: Code uses DiffieHellman with DES encryption. DES is not safe, I would like to use DESede or AES. SecretKeyFactory skf = SecretKeyFactory.getInstance("DESede"); or SecretKeyFactory skf = SecretKeyFactory.getInstance("AES"); Both fails SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); Works however (But is too weak as pointed) Here is my code for the module(testclass below) Currently working with the implemented "DES" import java.security.AlgorithmParameterGenerator; import java.security.AlgorithmParameters; import java.security.InvalidAlgorithmParameterException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.spec.InvalidParameterSpecException; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import javax.crypto.spec.DHParameterSpec; /** * Diffie-Hellman module for demonstrating KeyAgreement Algorithm */ public class DiffieHellmanModule { private static KeyPairGenerator kpg; static { try { // Create the parameter generator for a 512-bit DH key pair AlgorithmParameterGenerator paramGen = AlgorithmParameterGenerator.getInstance("DH"); paramGen.init(512); // Generate the parameters Prime p and root g AlgorithmParameters params = paramGen.generateParameters(); // Use the params p and g to create a DiffieHellmanSpec DHParameterSpec dhSpec = (DHParameterSpec)params.getParameterSpec(DHParameterSpec.class); //Generates and inits a KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH"); kpg.initialize(dhSpec); } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { e.printStackTrace(); } catch (InvalidParameterSpecException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Create KeyAgreement and generate secret key * * @param prk_self * the private key from the user who wants to g…
score: 1
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26831860
has comment: http://stackoverflow.com/comment/42225173
has comment: http://stackoverflow.com/comment/42230360
answer count: 1
tagged with: cryptography
has title: DiffieHellman Key Exchange to AES or DESede in Java
tagged with: aes
favorite count: 0

http://stackoverflow.com/a/26680328
upvote count: 2
has comment: http://stackoverflow.com/comment/43382983
has comment: http://stackoverflow.com/comment/43363001
answers question: http://stackoverflow.com/q/26674248
downvote count: 0
type: Answer
has body: The problem was solved by adding the definition of correct timezone. TimeZone.setDefault(TimeZone.getTimeZone("Europe/Moscow"));
score: 2

http://stackoverflow.com/comment/42080409
comment on: http://stackoverflow.com/a/26747718
score: 0
type: Comment
has text: I think you want to set the label's maximum size as well, otherwise, the layout manager will probably give it as much room as it wants.
type: AnswerComment

persistence
tags question: http://stackoverflow.com/q/26827287
tags question: http://stackoverflow.com/q/26726544
tag name: persistence
type: Tag

http://stackoverflow.com/q/26829417
tagged with: gradle
accepted answer: http://stackoverflow.com/a/26829540
type: Question
has answer: http://stackoverflow.com/a/26829540
tagged with: google-play-services
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has title: Why i can't get a dependency on the Google Play Services library?
has body: I know that it has been asked hunderds of times, but I really can't find a solution for my issue. I have this build file: apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { applicationId "com.gelasoft.gatanki" minSdkVersion 14 targetSdkVersion 20 versionCode 2 versionName "1.1" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:20.0.0' compile 'com.android.support:support-v4:20.0.0' compile 'com.google.android.gms:play-services:0.0.+' } Às you can see I'm trying to compile com.google.android.gms:play-services:0.0.+ But I;m getting some scary errors that I really can not manage. I have updated everything and the issue is still there. Here the errors are: When I'm trying to sync the project with gradle it says: Error:Failed to find: com.google.android.gms:play-services:0.0.+ Install Repository and sync project Open File Open in Project Structure dialog and in my manifest where I'm trying this it can not be resolved as well: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> I know that I'm missing a really small part on it, but I really can not figure out what is wrong. Can you give me a push?
tagged with: android-studio
type: AnsweredQuestion
tagged with: java

loggly
tags question: http://stackoverflow.com/q/26710343
type: Tag
tag name: loggly

http://stackoverflow.com/comment/42081666
comment on: http://stackoverflow.com/q/26748189
has text: i have that idea in my mind that i would add a ID to all the cells and transfer the ID using bluetooth. I just dont know how am I able to do that and how can I tell the other phone that a game is being played. How would i create that one way chat?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/29289673
upvote count: 1
downvote count: 0
has body: I know the topic is a bit old, but the problem still persists and it's a known bug. Anyhow the bug seems to be close to get a patch: https://code.google.com/p/android/issues/detail?id=72117
answers question: http://stackoverflow.com/q/26830686
type: Answer
score: 1

http://stackoverflow.com/q/26739579
upvote count: 0
tagged with: list
tagged with: performance
has answer: http://stackoverflow.com/a/26739693
tagged with: java
has body: I was wondering if there were a more efficient way to add an element into a list inside a hashmap instead of making a copy of the list, adding the element to the copylist and then make a put inside the map with the specific key associated to the list to overwrite that map part location... Map &lt;Integer, List&lt;Object&gt;&gt; myMap = new HashMap &lt;Integer, List&lt;Object&gt;&gt;(); ....add function List &lt;Object&gt; tmp = new LinkedList(); if (myMap.containsKey(myListKey.hashCode())) { //keycheck tmp = myMap.get(myListKey.hashCode()); //copy tmp.add(myObjectToAdd); //add myMap.put(myListKey.hashCode(), tmp); //overwrite } I tried several ways to get direct access to the inner list but the compiler seems on her/its period today...
type: Question
answer count: 2
has title: Java: Add element into a list inside a HashMap
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/26739816
favorite count: 0
has comment: http://stackoverflow.com/comment/42065109
type: UnansweredQuestion
tagged with: dictionary

http://stackoverflow.com/comment/42148987
has text: Still, 170 JARs in your app/lib... it smells like a build issue (for ex, adding Mule deps at compile scope instead of provided scope).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26769514

http://stackoverflow.com/comment/42096963
comment on: http://stackoverflow.com/q/26757512
type: Comment
type: QuestionComment
score: 1
has text: FYI you can just `return a.length() - b.length();`

http://stackoverflow.com/comment/42000801
type: QuestionComment
has text: Thanks @BorisIvanov, I've had a quick read. I'm not sure I understand what is meant by 'use an initialiser'? Would this mean - declare it as (for example) int FELLOFFSCREEN and then set it somewhere - so, FELLOFFSCREEN = 0? If this is the case, I'm guessing I can't use the final keyword? - thanks
score: 0
comment on: http://stackoverflow.com/q/26703620
type: Comment

http://stackoverflow.com/comment/42101642
has text: @StackFlowed First of all, you should never catch a `NullPointerException`. Second of all, performance is most certainly not a concern here (if anything `try`/`catch` would have worse performance).
score: 1
comment on: http://stackoverflow.com/a/26760037
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42060896
type: QuestionComment
has text: Your MaxPermSize setting is too high, what's the physical ram avaible when you launch your java program ? (free).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26737357

http://stackoverflow.com/a/26767459
answers question: http://stackoverflow.com/q/26767097
type: Answer
upvote count: 1
has body: Execute the code in an ExecutorService: ExecutorService es = Executors.newSingleThreadExecutor(); Future&lt;?&gt; f = es.submit(new Runnable(){ @Override public void run() { sendNotice(caseKey, communicationId); } }); You obtain a Future&lt;?&gt; representing the pending completion of the task.
score: 1
downvote count: 0

http://stackoverflow.com/q/26752609
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42088546
tagged with: linked-list
possible better answer: http://stackoverflow.com/a/26752682
tagged with: java
has answer: http://stackoverflow.com/a/26752682
duplicate of: http://stackoverflow.com/q/513832
type: Question
has title: Need help searching a linked list
has answer: http://stackoverflow.com/a/26752738
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/26752738
has body: Hello everyone i have trouble searching a linked list. Basically I'm reading from a csv file and storing it in the linked list. I was able to add the list at the end. But when i search the list it keep saying it wasn't found. The method function is called contains. A method "contains" that takes a Country object as parameter and checks if the name of the country can be found in the list . to check whether object foo of type Country equals objects bar of type Country, you must override the "equals method" in class Country. When I'm running the code it returns not found and i found out the method contains from class countryNode returns null thats why its returns not found. I will appreciate the help thanks. Everything works except from the contains method. Below is my code: public Country contains(Country obj) { if(this.isEmpty()) { System.out.println("Sorry this is an Empty list"); return null; } else{ CountryNode current = first; while(current!=null) { if(current.getCountry().equals(obj)) { return current.getCountry(); // break; } current = current.getNext(); } return null; } } The class Country and the overrides method equals: public class Country { private String countryNames; private SubscriptionYear[] subscriptions; private int size; private int location; public Country(String country) { this.countryNames = country; } public Country(String country, int arraylength) { this.countryNames = country; this.size = arraylength; subscriptions = new SubscriptionYear[size]; location = 0; } public void addSubscriptionYear(int year, double subscription) { subscriptions[location]= new SubscriptionYear(year, subscription); ++location; } public String toString() { System.out.print(countryNames+"\t"); for(SubscriptionYear s: subscriptions) { //System.out.print(countryNames+"\t"); System.out.print(s.getSubscription()+"\t"); } System.out.println(); return ""; } public String getName() { return this.countryNames; } public boolean equals(Country obj) { return (this.countryNames==obj…
has comment: http://stackoverflow.com/comment/42088554

http://stackoverflow.com/q/26767992
has answer: http://stackoverflow.com/a/26768397
type: Question
has answer: http://stackoverflow.com/a/72920615
has answer: http://stackoverflow.com/a/26952142
has body: The type erasure page says that Replace all type parameters in generic types with their bounds or Object if the type parameters are unbounded. The produced bytecode, therefore, contains only ordinary classes, interfaces, and methods. However, for the following class: public class Foo&lt;E extends CharSequence&gt; { public E something; } javap -c Foo prints: public class Foo&lt;E extends java.lang.CharSequence&gt; { public E something; } Why is the type parameter not replaced with the bound (CharSequence), but is preserved as E?
downvote count: 1
tagged with: generics
score: 8
favorite count: 0
upvote count: 9
has title: Why is this type parameter preserved in the bytecode?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26768399
answer count: 4
tagged with: java

http://stackoverflow.com/comment/42070584
type: Comment
type: QuestionComment
has text: But if you are not counting (and omitting) white space characters, trimming before counting will be a performance improvement, since you are removing characters **you know you will not count**
comment on: http://stackoverflow.com/q/26742323
score: 0

http://stackoverflow.com/comment/42104446
type: AnswerComment
type: Comment
has text: I do understand that other stuff happens besides my code, and that also uses memory - but that do not explain why it allocates the full 512 MB. I just ran it with -Xms300M and it still used a 512 MB heap.
comment on: http://stackoverflow.com/a/26760894
score: 0

http://stackoverflow.com/a/26701929
has body: Caused by: org.json.JSONException: No value for videoId According to the API: If the id.type property's value is youtube#video, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a video that matches the search query. videoId is an optional value. You need to use JSONObject.has() to check if it exists before calling JSONObject.getString().
has comment: http://stackoverflow.com/comment/41997468
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41997388
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26701469
accepted answer of: http://stackoverflow.com/q/26701469

http://stackoverflow.com/q/26731151
tagged with: compilation
has comment: http://stackoverflow.com/comment/42051055
tagged with: protocols
score: 0
has comment: http://stackoverflow.com/comment/42050989
has comment: http://stackoverflow.com/comment/42053229
tagged with: buffer
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/42122087
has comment: http://stackoverflow.com/comment/42049987
answer count: 0
has title: Error when compile .proto file using wire protocol buffer compiler
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42081379
type: Question
has body: I am new to use wire protocol buffer. I have PersonProto.proto file: message Person { required int32 id = 1; required string name = 2; optional string email = 3; } and wire-compiler-1.6.0-jar-with-dependencies.jar in the same folder: Desktop\Newfolder. I use this command to build: $java -jar wire-compiler-1.6.0-jar-with-dependencies.jar \ --proto_path=../Newfolder \ --java_out=../Newfolder PersonProto.proto And I got an exception: Exception in thread "main" java.io.FileNotFoundException: ..\Newfolder (Access is denied) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at com.squareup.wire.IO$FileIO.parse(IO.java:43) at com.squareup.wire.WireCompiler.compile(WireCompiler.java:251) at com.squareup.wire.WireCompiler.main(WireCompiler.java:188) I had try with other folder, but I cann't compile successful. Please give me some ideas, Thanks in advance!

http://stackoverflow.com/a/26795618
score: 0
has body: Running the command ProcessBuilder provides a full API for starting commands. ProcessBuilder processBuilder = new ProcessBuilder("mysql", "-u", "root", "-p"); processBuilder.directory(new File("myDir")); pb.redirectErrorStream(true); Process proc = pb.start(); Pipe into the command You can write strings into a BufferedWriter that wraps the confusingly named "output" stream from the Process object returned by processBuilder.start() OutputStream stdin = proc.getOutputStream(); OutputStreamWriter osr = new OutputStreamWriter(stdin); BuffererWriter bw = new BuffererWriter(osr); bw.write("Hello\n"); A word of warning You need to be very careful when using Process to consume the standard output/error streams otherwise the process can lock. A robust implementation should create 2 threads to read stdout and stderr asynchronously and perhaps a 3rd to feed the process. The parent process uses these streams (#getInputStream(), getErrorStream()) to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock. This guide When Runtime.exec() won't has all the information you need.
type: Answer
answers question: http://stackoverflow.com/q/26794304

http://stackoverflow.com/q/26731327
has body: Hi In this Application I have created a form with the following code. After clicking save Button, the data got saved into database. Now if I search some mobile_no means I am accessing all the data by using one class. By using that I am accessing that field for which I have written the following code. Now in my Logcat, it is showing unfortunately error. Can any one please help me with where I did mistake? PatientRegistration.java public class PatientRegistration extends Activity implements OnClickListener { EditText regno1,fname1,mname1,lname1,dob1,age1,f_hname1,adress1,tel_o1,pin_zip1,tel_r,email1,mobile1,id_prof1,b_group1,name_kin1,relation1; String data=""; TextView tv1; Button back,home,choosefile; Spinner initial,pmaincat,pcatory,religion,caste; RadioGroup sex,payment; RadioButton rb; private static final int SELECT_PICTURE = 1; String[] initial_name,initial_id,patient_main_type_name,patient_type_name,religion_name,caste_name,reg_no,patient_main_type_id,patient_type_id,religion_id,caste_id; private EditText fromDateEtxt; private DatePickerDialog fromDatePickerDialog; private SimpleDateFormat dateFormatter; private String selectedImagePath; private Map&lt;String, String&gt; patmainMap = new HashMap&lt;String, String&gt;(); private Map&lt;String, String&gt; patcatMap = new HashMap&lt;String, String&gt;(); private Map&lt;String, String&gt; regMap = new HashMap&lt;String, String&gt;(); private Map&lt;String, String&gt; casteMap = new HashMap&lt;String, String&gt;(); private Map&lt;String, String&gt; initialMap = new HashMap&lt;String, String&gt;(); /** Called when the activity is first created. */ @SuppressLint("NewApi") @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.pat_registration); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder(…
has comment: http://stackoverflow.com/comment/42050454
has title: Accessing data from one class to another in android
score: -5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26732890
downvote count: 5
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42050146
has comment: http://stackoverflow.com/comment/42050692
tagged with: android
has comment: http://stackoverflow.com/comment/42050405

http://stackoverflow.com/q/26791454
has comment: http://stackoverflow.com/comment/42159063
answer count: 1
downvote count: 0
tagged with: tomcat8
has title: FAIL - Application at context path /Handbyhand could not be started
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26793426
score: 1
tagged with: java
upvote count: 1
type: Question
has body: Hi I a newbie for spring and Tomcat, I try to deploy my prject (spring - java) war file to Tomcat 8.0 server however when I deploy that war evenif it can be seen on web application manager I could not start the application. It says that: "FAIL - Application at context path /HandInHand could not be started" Log file for localhost_date.log like below; 07-Nov-2014 00:07:19.664 INFO [http-nio-8088-exec-135] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath 07-Nov-2014 00:07:19.726 INFO [http-nio-8088-exec-135] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext 07-Nov-2014 00:07:20.685 SEVERE [http-nio-8088-exec-135] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.sprin…
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26793426

http://stackoverflow.com/comment/42138457
type: QuestionComment
comment on: http://stackoverflow.com/q/26756496
has text: Hey , I think yes . At least it enters the method now .
score: 0
type: Comment

http://stackoverflow.com/a/26764166
answers question: http://stackoverflow.com/q/26763708
type: Answer
has body: I suspect that it's the last condition check that's a nested else statement that then uses the dialog variable to call getInfo on that's causing your possible null pointer. Of course your program will never actually be null at that point, but the nesting structure apparently is throwing Netbeans for a loop. I like @greyfairer's answer to this, but this small change would probably fix your problem too: public void printSomething (Doggy console, Catty dialog) { if (console == null &amp;&amp; dialog == null) { throw new RuntimeException ("Both console and dialog were null."); } else if (console != null &amp;&amp; dialog != null) { throw new RuntimeException ("Both console and dialog were created."); } else { if (console != null) { console.getInfo ("some String"); } else if (dialog != null) { dialog.getInfo ("Some String"); } } }
score: 0

http://stackoverflow.com/comment/42195494
type: Comment
comment on: http://stackoverflow.com/q/26811382
score: 0
has text: @aioobe If they were `synchronized` on different objects, would the behavior be the same?
type: QuestionComment

http://stackoverflow.com/q/26779432
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26781484
accepted answer: http://stackoverflow.com/a/26781484
answer count: 3
has answer: http://stackoverflow.com/a/30878210
downvote count: 0
has title: Java Spring conflict dependecy versions with Spring Security
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/52212402
possible better answer: http://stackoverflow.com/a/30878210
has body: HTTP Status 500 - Servlet.init() for servlet dispatcher threw exception type Exception report message Servlet.init() for servlet dispatcher threw exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) root cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.VerifyError: Bad type on operand stack Exception Details: Location: org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.compareMatchingMediaTypes(Lorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;ILorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;I)I @89: invokevirtual Reason: Type 'org/springframework/http/MediaType' (current frame, stack[1]) is not assignable to 'org/springframework/util/MimeType' Current Frame: bci: @89 flags: { } locals: { 'org/springframework/we…
tagged with: spring
has comment: http://stackoverflow.com/comment/42140200
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42139071
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/57345546
type: AnswerComment
has text: Worked, but with a tweak. Instead of using `colorControlNormal` as rockgecko suggested I threw it inside ` ` which is then applied per activity.
type: Comment
comment on: http://stackoverflow.com/a/27517878
score: 1

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/26701934
type: Tag
tags question: http://stackoverflow.com/q/26734751
tags question: http://stackoverflow.com/q/26823464

http://stackoverflow.com/q/26705580
score: 0
has comment: http://stackoverflow.com/comment/42004259
has body: I am almost done with this project. I need help figuring out why it does not pause after asking for the last name before it asks for the first name. I also keep getting an error when I try to add a new Comparator to sort by score. package student.scores; import java.util.Scanner; import java.util.Arrays; import java.util.Comparator; import java.util.ArrayList; import java.util.*; public class StudentScores{ public static void main(String[] args) { System.out.println("Welcome to the Student Scores Application."); Scanner input = new Scanner (System.in); System.out.println("Enter number of students: "); int numStudents = input.nextInt(); List&lt;Student&gt; students = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; numStudents; i++) { System.out.println("Enter Student Last Name: "); String lastName = input.nextLine(); System.out.println("Enter Student First Name: "); String firstName = input.nextLine(); System.out.println("Enter Student Score: "); int score = input.nextInt(); students.add(new Student(lastName, firstName, score)); } Collections.sort(students); System.out.println("Students in alphabetical order"); for (Student s : students) { System.out.println(s); } Collections.sort(students, new Comparator() {}); System.out.println("Students by score"); for (Student s : students) { System.out.println(s); } static class Student implements Comparable&lt;Student&gt; { private String lastName; private String firstName; private int scores; public Student (String lastName, String firstName, int score) { this.lastName = lastName; this.firstName = firstName; this.scores = score; } public int getScores() { return scores; } public String getLastName() { return lastName; } public String getFirstName() { return firstName; } @Override public int compareTo(Student s) { if (s.lastName.equals(lastName)) { return firstName.compareToIgnoreCase(s.firstName); } return lastName.compareToIgnoreCase(s.lastName); } static class StudentScoreComparator implements Comparator&lt;Student&gt; { @O…
type: AnsweredQuestion
tagged with: java
has title: ArrayList and sorting method for names
type: Question
has answer: http://stackoverflow.com/a/26750587
tagged with: arrays
tagged with: sorting
possible better answer: http://stackoverflow.com/a/26705637
has answer: http://stackoverflow.com/a/26705637
accepted answer: http://stackoverflow.com/a/26750587
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/26705903

http://stackoverflow.com/q/26724653
type: Question
tagged with: split
possible better answer: http://stackoverflow.com/a/26725968
has answer: http://stackoverflow.com/a/26725968
has title: How to split a String of numbers and chars, only by chars
has body: i need to split a String into parts of number sequences and chars between them. Something like this: input: "123+34/123(23*12)/100" output[]:["123","+","34","/","123","(","23","*","12",")","/","100"] Is this somehow possible, or is it possible to split a String by multiple chars? Otherwise, is it possible to loop through a String in Java?
answer count: 2
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26724704
tagged with: regex
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26724704

http://stackoverflow.com/a/26733860
has comment: http://stackoverflow.com/comment/42246034
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26733246
has body: The first thing that came into my mind is that you could make a class for Playlist: public class Playlist { private final List&lt;Track&gt; playlist = new ArrayList&lt;Track&gt;(); private int playlistDuration = 0; public void addTrack(Track track) { playlist.add(track); playlistDuration += track.getLength(); } public int getDuration() { return playlistDuration; } public List&lt;Track&gt; getPlaylist() { return playlist; } public void shufflePlaylist() { Collections.shuffle(playlist); } } You could spare a lot of lines in your code, your for-loop would look like this: public ArrayList&lt;Track&gt; createPlaylist(int minRating, int minDuration) { minDuration = minDuration * 60; playlist.shufflePlaylist(); while (playlist.getDuration() &lt; minDuration) { for (Track track : trackList) { if (track.getRating() &gt;= minRating) { playlist.addTrack(track); } if (playlist.getDuration() &gt; minDuration) { return; } } } return playlist; }
has comment: http://stackoverflow.com/comment/42069151
downvote count: 0
type: Answer

http://stackoverflow.com/q/26809450
tagged with: jtable
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42191823
tagged with: java
has title: My JTable is not Updating
type: Question
has answer: http://stackoverflow.com/a/26810213
has comment: http://stackoverflow.com/comment/42193243
has body: What I'm doing: orderPage panel contains: a button,a JTable(summary) myChild panel contains: textFields for accepting input from the user. On a press of a button, a myChild panel opens up (without closing orderPage) and asks the user for some input. What i want to do is, based on the data provided by user, my Jtable(summary) gets updated with the new data, Which is not happening. My code: public class orderPage extends javax.swing.JPanel { public static JTable summary = new JTable(); public static DefaultTableModel model = (DefaultTableModel) summary.getModel(); /** Creates new form orderPage1 */ public orderPage() { initComponents(); tableContainer.setViewportView(summary); } public static void addItem(int itemId,String itemName,int price,int qty,int amt) { model.addRow(new Object[]{itemId,itemName,price,qty,amt}); } By calling addRow method (of orderPage) from child panel, my JTable is not updating. Am i doing something wrong? Any help appreciated. Thanks.

http://stackoverflow.com/comment/41972510
has text: You've posted an enormous, badly-formatted block of code, with no obvious attempt to reduce the scope of this to *only* showing the problem, and no clear description *of* the problem. Please read http://tinyurl.com/stack-hints
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26687552
type: QuestionComment

http://stackoverflow.com/q/26831097
has comment: http://stackoverflow.com/comment/42233270
has comment: http://stackoverflow.com/comment/42229013
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42229095
score: 1
tagged with: java
tagged with: loops
type: Question
answer count: 2
tagged with: arrays
has body: So I'm in my first semester and need complete a restaurant order project. Everything is going well but I'm hung up on this one project stipulation: iii. Once the current diner’s selections have been made display a list of all the items they selected. Don’t display the item if they chose the first option on each menu: No selection. no selection is index 0 of the array. how can I exclude just index 0? this is one of the 4 do while loops where the user enters their selection and the data is validated, if it helps, I'm totally stuck. Thanks! System.out.println("Please select one item from the beverages menu."); do { for(int j = 0; j &lt; beveragesArray.length; j++) { System.out.println((j + 1) + ". " + beveragesArray[j] + " $" + beveragesPriceArray[j]); } System.out.println("Please enter your selection #: "); beverageSelection = input.nextInt(); if(beverageSelection &lt; 1 || beverageSelection &gt; beveragesArray.length) { System.out.println("We don't serve that, what else would you like?"); badDataFlag = true; } else { badDataFlag = false; accumulator += beveragesPriceArray[beverageSelection - 1]; break; } } while (badDataFlag = true); Here's what the output is supposed to look like for the project. Please select one item from the Appetizer menu. 1. **No selection** $0.00 2. Deep Fried Calamari $7.50 3. Soup du Jour $4.99 4. Garden Salad $3.99 5. Garlic Bread $4.50 Please enter your selection #: 6 INVALID SELECTION. Please enter your selection #: 1 Please select one item from the Entrée menu. 1. **No selection** $0.00 2. Rib-Steak $15.95 3. Fettuccini Alfredo $11.25 4. Pan-Fried Sole $17.95 5. Mediterranean Platter $13.50 6. Vegetarian Lasagna $9.00 Please enter your selection #: 4 Please select one item from the Dessert menu. 1. **No selection** $0.00 2. Ice Cream Sundae $2.95 3. Cheesecake $5.00 4. Chocolate Truffle Cake $6.00 5. Raspberry Mousse $4.50 Please enter your selection #: 5 Please select one item from the Beverage menu. 1. **No selection** $0.00 2. Water $…
downvote count: 0
has comment: http://stackoverflow.com/comment/42229057
has title: Exclude index 0 of an array as an option for output?
has answer: http://stackoverflow.com/a/26832475
favorite count: 0
has comment: http://stackoverflow.com/comment/42232011
has answer: http://stackoverflow.com/a/26831402

http://stackoverflow.com/q/26810697
score: -1
has comment: http://stackoverflow.com/comment/42193927
accepted answer: http://stackoverflow.com/a/26810784
has comment: http://stackoverflow.com/comment/42193952
has comment: http://stackoverflow.com/comment/42194008
has comment: http://stackoverflow.com/comment/42194041
upvote count: 0
has answer: http://stackoverflow.com/a/26810788
has comment: http://stackoverflow.com/comment/42194025
has answer: http://stackoverflow.com/a/26810772
favorite count: 0
has body: I am trying to get user input and determine if the word is a palindrome or not. The main method should be where all of the print statements are placed. package help; import java.util.Scanner; public class Help { public static Scanner user_input; public static void main(String[] args, Iterable&lt;String&gt; lines) { System.out.print("Enter a word: "); user_input=new Scanner(System.in); } public static boolean istPalindrom(char[] word) { int i1 = 0; int i2 = word.length - 1; while (i2 &gt; i1) { if (word[i1] != word[i2]) { return false; } ++i1; --i2; } return true; } } I want it to say if true then System.out.println(The word is a palindrome.) else System.out.println(The word is not a palindrome.) I am not sure how to go about this.
has comment: http://stackoverflow.com/comment/42193961
has answer: http://stackoverflow.com/a/26810800
possible better answer: http://stackoverflow.com/a/26810800
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26810784
has comment: http://stackoverflow.com/comment/42194083
has title: palindrome - how to make main method call the boolean method?
has comment: http://stackoverflow.com/comment/42193942
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42193997
has comment: http://stackoverflow.com/comment/42194040
has comment: http://stackoverflow.com/comment/42193984
has comment: http://stackoverflow.com/comment/42194247

http://stackoverflow.com/q/26690360
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/90719306
upvote count: 1
has title: How to verify HMAC java
has comment: http://stackoverflow.com/comment/70207079
tagged with: java
tagged with: hmacsha1
has comment: http://stackoverflow.com/comment/41977564
type: Question
has comment: http://stackoverflow.com/comment/41977736
has answer: http://stackoverflow.com/a/49018105
downvote count: 0
has comment: http://stackoverflow.com/comment/41977626
answer count: 1
score: 1
favorite count: 0
has body: I've got the following code to compute Hmacs with a password: public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException { String password = "password123"; SecretKeySpec keySpec = new SecretKeySpec(password.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(keySpec); byte[] result = mac.doFinal("This is a test string".getBytes()); System.out.println(new Base64().encodeAsString(result)); } But I can't figure out how to verify it with a password, I'm reading the Java documentation here but i can't seem to find a verify function or anything, the section on HMACs is quite short. How do i verify the HMAC with the password?

http://stackoverflow.com/a/26829637
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26829514
answers question: http://stackoverflow.com/q/26829514
upvote count: 1
has body: Use this code and organize your imports correctly in eclipse use control+shift+o.and chose correctly. import android.app.Fragment; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.app.Activity; public class InputActivity extends Activity { Fragment fragment; Button btn1, btn2, btn3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.to_do_list); btn1=(Button)findViewById(R.id.btn1); btn2=(Button)findViewById(R.id.btn2); android.app.FragmentManager fm = getFragmentManager(); android.app.FragmentTransaction ft = fm.beginTransaction(); StartFragment myFragment = new StartFragment(); ft.add(myFragment,R.id.myFragment); ft.commit(); btn1.setOnClickListener(btnOnClickListener); btn2.setOnClickListener(btnOnClickListener); } Button.OnClickListener btnOnClickListener = new Button.OnClickListener() { @Override public void onClick(View v) { Fragment newFragment; if (v == btn1) newFragment = new Fragment1(); else if (v == btn2) newFragment = new Fragment2(); else newFragment = new StartFragment(); android.app.FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.myFragment, newFragment); transaction.addToBackStack(null); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); transaction.commit(); } }; }
has comment: http://stackoverflow.com/comment/42226461
type: AcceptedAnswer

http://stackoverflow.com/q/26813826
tagged with: java
has comment: http://stackoverflow.com/comment/42199524
tagged with: bukkit
has comment: http://stackoverflow.com/comment/42199401
accepted answer: http://stackoverflow.com/a/26813862
type: Question
linked to: http://stackoverflow.com/q/218384
answer count: 2
has comment: http://stackoverflow.com/comment/42199358
has body: I'm getting a NullPointerException when i'm checking if the length of the array is equal to 0 or not, and I can't find why it isn't working. Anyone could tell me what i'm doing wrong ? Here's my entire function code: public static ArrayList&lt;String&gt; searchZone(Player p){ openConnection(); ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;(); WorldEditPlugin worldEdit = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); Selection selection = worldEdit.getSelection(p); String query = "SELECT * FROM " + db + ".blocks"; ArrayList&lt;String&gt; res = executeQueryWe(query); String[] items = res.toArray(new String[res.size()]); int i = 0; int iters = items.length; while(i &lt; iters){ try{ if(selection != null){ String[] locs = items[i].split(","); World world = Bukkit.getServer().getWorld(locs[0]); int x = Integer.valueOf(locs[1]); int y = Integer.valueOf(locs[2]); int z = Integer.valueOf(locs[3]); Location loc = new Location(world, x, y ,z); if(selection.contains(loc)){ String query2 = "SELECT * FROM `blocks` WHERE `world`='" + world.getName() + "' AND `x`='" + x + "' AND `y`='" + y + "' AND `z`='" + z + "';"; data = executeQuery(query2); } } } catch(Exception e){ closeConnection(); p.sendMessage(prefix + ChatColor.RED + "An error occured while reading database"); break; } p.sendMessage(prefix + ChatColor.RED + "Please make a selection first"); break; } if(data.size() != 0){ //&lt;---------------------------- ERROR COMES FROM HERE closeConnection(); return data; } else { data.add("No entries has been found."); closeConnection(); return data; } }
tagged with: arrays
has comment: http://stackoverflow.com/comment/42199546
has answer: http://stackoverflow.com/a/26814494
duplicate of: http://stackoverflow.com/q/218384
score: 0
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/26814494
has answer: http://stackoverflow.com/a/26813862
has title: NullPointerException while checking if array is empty
type: AnsweredQuestion

http://stackoverflow.com/q/26778017
has answer: http://stackoverflow.com/a/26778098
tagged with: java
has comment: http://stackoverflow.com/comment/42134543
accepted answer: http://stackoverflow.com/a/26778111
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42134483
has comment: http://stackoverflow.com/comment/42134065
tagged with: factory-pattern
score: 0
has comment: http://stackoverflow.com/comment/42134753
has body: I'm using the factory pattern to create instances, and want to initialise these instances with different objects. At the moment I'm simply casting the object, but this doesn't feel right. public interface IGenerator { public IGeneratedObject generate(); } public class FirstGenerator implements IGenerator { private List&lt;FirstObject&gt; list; public FirstGenerator(List&lt;FirstObject&gt; list) { this.list = list; } public IGeneratedObject generate() { return doSomeStuff(list); } } public class SecondGenerator implements IGenerator { private UnrelatedObject obj; public SecondGenerator(UnrelatedObject obj) { this.obj = obj; } public IGeneratedObject generate() { return doOtherThingsStuff(obj); } } public class GeneratorFactory { public static IGenerator createGenerator(GeneratorType type, Object object) { switch (type) { case FIRST: return new FirstGenerator((List&lt;FirstObject&gt;) object); case SECOND: return new SecondGenerator((UnrelatedObject) object); } return null; } } Usage would then be as follows: IGenerator gen1 = GeneratorFactory.createGenerator(GeneratorType.FIRST, listOfFirstObjects); IGenerator gen2 = GeneratorFactory.createGenerator(GeneratorType.SECOND, unrelatedObj); FirstObject and UnrelatedObject aren't related at the moment - no common base class or interfaces. In the factory method, the compiler of course shows an 'Unchecked cast from...' warning. Is there a better way? It seems like a situation where generics could be used, but is this unfeasible due to the objects not being related?
tagged with: generics
has answer: http://stackoverflow.com/a/26778111
has title: Java factory pattern with different initialisation object types
has comment: http://stackoverflow.com/comment/42134036
possible better answer: http://stackoverflow.com/a/26778098
type: AnsweredQuestion

http://stackoverflow.com/a/26746870
has body: this.requestFocusInWindow(); is a bad idea within the paintComponent method. Painting should paint the current state and never change the state of the component getGraphics is not how painting is done in Swing. Custom painting should be done from within the context of the paintComponent method. See Painting in AWT and Swing and Performing Custom Painting for more details Consider using key bindings over KeyListener, as you can control the focus level required to trigger the key events. See How to Use Key Bindings for more details Remember, you don't control the paint process in Swing, a paint cycle can be triggered by any number of events, most of which you don't actually control. Try working within the process instead of out of it. Start by creating a List of java.awt.Point. Add each point to the List when a key event occurs. Use the paintComponent to iterate over the List and paint the lines between the Points...
has comment: http://stackoverflow.com/comment/42097055
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26746812
has comment: http://stackoverflow.com/comment/42113147
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42152922
type: Comment
type: QuestionComment
has text: Looks like your problem is in the configuration of C3P0. I would recommend posting your C3P0 configuration or to migrate to another database connection pool provider like BoneCP (deprecated in favour of HikariCP).
score: 0
comment on: http://stackoverflow.com/q/26783755

http://stackoverflow.com/q/26799451
has body: I have a HashMap which I want to convert to XML: @XmlJavaTypeAdapter(OrdersAdapter.class) private Map<Long, Order> orders = new LinkedHashMap<Long, Order>(); By default map is converted to <entry> <entry>, but I wanted to get XML, where key is attribute and there is no value tag. Something like this: <?xml version="1.0" encoding="UTF-16" standalone="yes"?> 123 1 15 10 Using my program from github: https://github.com/pfryn/simpleTestProject/tree/master/src/pl/shop , now I am able to generate xml like this: <?xml version="1.0" encoding="UTF-16" standalone="yes"?> 123 1 15 10 Do you know how to avoid "value" tag?
has title: How to marshal map to xml without tag value
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: jaxb
type: Question
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/26800371
accepted answer: http://stackoverflow.com/a/26800371
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/41983093
has text: thank you for your answer, we decided to look for another way to do it, we used PMD to inspect the code.
comment on: http://stackoverflow.com/a/26691194
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/26783988
tagged with: java
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/42144831
favorite count: 0
has comment: http://stackoverflow.com/comment/42145389
has comment: http://stackoverflow.com/comment/42145078
answer count: 1
has comment: http://stackoverflow.com/comment/42145537
has body: I would like to compile and execute a program in Java with Command Prompt but only compile the program: javac MyApp.java Then I want to execute with that command: java MyApp but it throws an error: Error: Could not find or load main class MyApp I think that is possible to be a problem with JRE or JDK configuration but I check the path, java -version and 'Build path' in eclipse project but nothing. Any idea?
linked to: http://stackoverflow.com/q/18093928
tagged with: compiler-errors
accepted answer: http://stackoverflow.com/a/26784477
has title: Error: Could not find or load main class MyApp (running java on Command Prompt)
has comment: http://stackoverflow.com/comment/42145192
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26784477
score: 1

http://stackoverflow.com/q/26689149
downvote count: 1
tagged with: wpf
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/26690067
has body: I have 2 programs, one of them is android application (Client) and the other is c# wpf application (Server). My propose is to load the server, and then load the client, the client connect automatically to the server and the server identifier that it got a new client. When the server identifier a new client the server send automatically a message that contains the CliendID to the client . The client got a message from the server and then he can send to the server a message that contains the ClientID(that he got) and he's location. All of this must be in thread because I want the server and client to do other things too.The connection doesn't made, it goes to the catch with exeption "sorce not found" in both of the applications. Client code java : //Define variables String host ="192.168.43.145"; int port = 13000; Socket socket; Writer writer; BufferedReader reader; // OnCreate function socket= new Socket(host, port); writer= new OutputStreamWriter(socket.getOutputStream(), "latin1"); reader= new BufferedReader(new InputStreamReader(socket.getInputStream(), "latin1")); // Get reply: String IdObserverstring = reader.readLine(); writer.write(IdObserverstring); writer.write(LatitudeForSend); writer.write(LongtitudeForSend); writer.flush(); C# code : // Define variables : TcpListener listenerForAndroid; IPAddress ip; bool IsListener; int port, IDObser; string ipString; public BinaryReader rd; public MemoryStream memory; public BinaryWriter wr; Socket sender; // Constructor of application // Ip local host ipString = "192.168.43.145"; port = 13000(); // Converting the ip string to ipAddress ip = IPAddress.Parse(ipString); /* Initializes the Listener */ listenerForAndroid = new TcpListener(ip, port); byte[] byteRecived = new byte[1024]; try { // Start Listeneting at the specified port listenerForAndroid.Start(); // Now the server is running and waiting for a client connection. sender = listenerForAndroid.AcceptSocket(); // Client Accepted IDObser++; ASCIIEncoding asen = new …
has title: Android and C# tcp Connection failed
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41975228
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41975325
tagged with: tcp

http://stackoverflow.com/q/26809271
tagged with: maven
has title: Upgrading Java 7 to Java 8 - Is Java 8 String switch deprecated?
tagged with: java-8
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42191689
tagged with: java
has comment: http://stackoverflow.com/comment/42191255
accepted answer: http://stackoverflow.com/a/26809542
type: Question
has comment: http://stackoverflow.com/comment/42191274
has comment: http://stackoverflow.com/comment/42191489
tagged with: intellij-idea
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42191257
favorite count: 0
has comment: http://stackoverflow.com/comment/42191587
has body: I have been having issues looking this up on the internet but I just upgraded my java from 1.7 to 1.8 and now I am seeing that the diamond operator is not supported anymore. I am ok with this, but String switch statements also seem to be removed. This confuses me because the oracle documentation says this is still supported. Am I possibly using the wrong java version in Intellije? here is my POM maven compiler config: org.apache.maven.plugins maven-compiler-plugin 3.0 UTF-8 1.8 1.8 And my Java Compiler settings is set to 1.8 as well (module uses JDK default). Was this in fact deprecated? Or am I just doing something wrong? which java command returns java 8. maven version also returns java 8. this isn't working anymore (in case its not clear): switch("some string"){ case "some string": //some code break; default: //some code }
has comment: http://stackoverflow.com/comment/42191200
has comment: http://stackoverflow.com/comment/42191311
tagged with: upgrade
has comment: http://stackoverflow.com/comment/42191454
has answer: http://stackoverflow.com/a/26809542
has comment: http://stackoverflow.com/comment/42191357
upvote count: 2

http://stackoverflow.com/a/26739851
has comment: http://stackoverflow.com/comment/76514111
has comment: http://stackoverflow.com/comment/42065789
has comment: http://stackoverflow.com/comment/42066748
answers question: http://stackoverflow.com/q/26739730
has body: You just need to pass the entity to update and the DAO will automatically determine the changed fields and update them in the DB. public update(MyEntity myEntity); And then the DAO gets the id of myEntity and update the entity in the database.
type: Answer
has comment: http://stackoverflow.com/comment/42066650
has comment: http://stackoverflow.com/comment/76596260
has comment: http://stackoverflow.com/comment/42065947
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42066424
has comment: http://stackoverflow.com/comment/42066092
upvote count: 2
has comment: http://stackoverflow.com/comment/76596101
has comment: http://stackoverflow.com/comment/76597019
has comment: http://stackoverflow.com/comment/42065728

http://stackoverflow.com/comment/42109989
type: Comment
comment on: http://stackoverflow.com/q/26764405
has text: @CyberneticTwerkGuruOrc: Sorry, didn't mean to insult anyone. It's not about how the code looks. It's about the fact that one cannot point out the problem, as the entire logic is wrong (let alone the use of `=`).
score: 0
type: QuestionComment

http://stackoverflow.com/a/26698614
has comment: http://stackoverflow.com/comment/41991351
has body: How can i calculate this algorithm's complexity without knowing the complexity of System.out.println method ? Strictly speaking, you can't. On the other hand, it is not normal practice to include the detailed complexity of I/O in algorithmic analysis. Normally we assume that I/O behaves in the way that it is generally understood to behave ... because a real complexity analysis would be intractable. In practice it is assumed that simple I/O (like this) has complexity of O(N) where N is the number of bytes / characters that are read or written. Am i supposed to go to the java doc and search for System.out.println source code and then calculate its complexity ? No. See above. Ok understood , but what if i call the sort predefined java method ? The javadoc for Collections.sort(List&lt;?&gt;) says: This implementation defers to the List.sort(Comparator) method using the specified list and a null comparator. which in turn says: Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays. In general, to determine the complexity of classes in the standard class libraries, read the javadoc, and if the javadoc doesn't say then either locate and analyse the source code ... or make reasonable assumptions based on your knowledge of data structures actually used. The circumstances should determine whether or not your complexity analysis needs to be rigorous. If rigour is not required you can take short-cuts in your analysis ... provided you get the right answer :-) In either case, be aware that algorithms are nearly always "an impl…
upvote count: 2
answers question: http://stackoverflow.com/q/26698494
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26698494
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41991331

http://stackoverflow.com/comment/102680185
has text: Not only does this need to be fixed for custom YAML files, but as it turns out that in the OpenAPI YAML specification when you want to specify return values for RESTful requests, the returnvalues are not quoted. For example, in an OpenAPI 3 spec on SwaggerHub, the return codes sre 200: or 404:. They are *not* '200': or '400': Anyone creating YAML for OpenAPI will need a solution to this problem -- unless you want to get the folks doing OpenAPI to change the specification...
comment on: http://stackoverflow.com/q/26687844
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26741214
type: Question
has title: How to make filerdear to read input file path from filechooser
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42068408
has comment: http://stackoverflow.com/comment/42068212
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42068453
has body: i'm having this filereader that normaly read's a file from path in source. i made a filchooser but i don't know how to add this filereader to get the filepath from file chooser. Code for FileReader below StringBuilder resultKamera = new StringBuilder(); { try { brKamera = new BufferedReader(new FileReader("C:\path.xxx")); while ((lineKamera = brKamera.readLine()) != null) { Matcher categoryMatcherKamera = CategorieKamera.matcher(lineKamera); Matcher itemMatcherKamera = CategorieSiCantitateKamera.matcher(lineKamera); Code For FileChooser bleow: JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("choosertitle"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { System.out.println("getSelectedFile() : " + chooser.getSelectedFile()); } else { System.out.println("No Selection "); } } });

http://stackoverflow.com/comment/41969224
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26684990
has text: One more question, are these `identifier`strings actual *identifiers* in the Computer Science sense? That is, would the `identifier` strings all be valid as variable names?

http://stackoverflow.com/comment/42117993
type: Comment
comment on: http://stackoverflow.com/a/26768696
has text: If bash only, `jvm_arguments=$(< jvm-args)` will cause the shell to read the file rather than needing another cat process.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26690031
has comment: http://stackoverflow.com/comment/41977179
downvote count: 0
has comment: http://stackoverflow.com/comment/41977324
has body: Beside the error of initializing result to 0, there are some other issues : Your calculation for negative n is wrong. Remember that a^n == 1/(a^(-n)). If n is not integer, the calculation is much more complicated and you don't support it. I won't be surprised if you are not required to support it. In order to achieve O(log n) performance, you should use a divide and conquer strategy. i.e. a^n == a^(n/2)*a^(n/2).
type: Answer
answers question: http://stackoverflow.com/q/26689929
score: 1
upvote count: 1

http://stackoverflow.com/q/26768710
tagged with: breakpoints
type: AnsweredQuestion
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26768711
type: Question
tagged with: debugging
tagged with: eclipse
has body: Yet another eclipse breakpoints question, I would argue this is different and undiscussed as of now. If that's not the case, point me to the right question. I'm running eclipse kepler in the debug perspective. I can set breakpoints and eclipse does stop at them. However, absolutely no functionality of the debug perspective is made available. The code has simply stopped. I know this is the case as when I remove the breakpoint, the code resumes its processing. More details - no green stripe on the breakpointed line, no step in/step over/step out, no pause/resume/ or even stop buttons are available. Only the red box on the Console tab are available. Eclipse simply pauses execution and does not inform you, nor allows you to resume either.
answer count: 1
accepted answer: http://stackoverflow.com/a/26768711
favorite count: 0
has title: eclipse stops at breakpoint, but no debug features available

http://stackoverflow.com/q/26744885
has answer: http://stackoverflow.com/a/26746069
has answer: http://stackoverflow.com/a/28901202
upvote count: 28
has comment: http://stackoverflow.com/comment/134698280
has answer: http://stackoverflow.com/a/44795646
linked to: http://stackoverflow.com/q/7854030
has body: When I serialize/deserialize any object, all field names are converted to lower case. Is there any configuration to set that makes Jackson keep the field names exactly as they are? Both for serializing and deserializing? (I know about @JsonProperty, but this does not seems to be right, since what I need is just for Jackson to respect what already exists) My test code: import java.io.Serializable; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; public class Test { static class Example implements Serializable { private String Test; private String ABC; private String XyZ; public String getTest() { return Test; } public void setTest(String test) { Test = test; } public String getABC() { return ABC; } public void setABC(String abc) { ABC = abc; } public String getXyZ() { return XyZ; } public void setXyZ(String xyz) { XyZ = xyz; } } static class MyPropertyNamingStrategy extends PropertyNamingStrategy { @Override public String nameForField(MapperConfig&lt;?&gt; config, AnnotatedField field, String defaultName) { return convert(defaultName); } @Override public String nameForGetterMethod(MapperConfig&lt;?&gt; config, AnnotatedMethod method, String defaultName) { return convert(defaultName); } @Override public String nameForSetterMethod(MapperConfig&lt;?&gt; config, AnnotatedMethod method, String defaultName) { return convert(defaultName); } private String convert(String input) { return input; } } public static void main(String[] args) throws Exception { ObjectMapper objectMapper = new ObjectMapper() .setPropertyNamingStrategy(new MyPropertyNamingStrategy()) .enable(SerializationFeature.INDENT_OUTPUT) .confi…
has answer: http://stackoverflow.com/a/55799683
downvote count: 0
has answer: http://stackoverflow.com/a/69082484
has answer: http://stackoverflow.com/a/69685906
score: 28
favorite count: 0
possible better answer: http://stackoverflow.com/a/55799683
accepted answer: http://stackoverflow.com/a/26746069
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42076169
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42093039
has comment: http://stackoverflow.com/comment/42076609
type: Question
has title: Jackson ObjectMapper upper/lower case issues
answer count: 6
tagged with: jackson

http://stackoverflow.com/q/26702085
answer count: 1
linked to: http://stackoverflow.com/q/2648984
tagged with: url
has answer: http://stackoverflow.com/a/26702140
accepted answer: http://stackoverflow.com/a/26702140
tagged with: request
tagged with: php
has body: I want to determine the website from which the request to the particular website has been called. For Example..I have a website www.ex.com. Now this website link has been there on three websites www.a.com, www.b.com, and www.c.com. Suppose one user has clicked the link from www.a.com to go to www.ex.com. Now I want to determine that the request has come from the www.a.com and then the page in www.ex.com will be displayed accordingly. Similarly if the user has clicked the www.ex.com link from www.b.com then the page will be displayed accordingly. So how can I determine this request source, means from which website www.ex.com has been called? It is good if you will explain this using code in PHP and JAVA.
type: AnsweredQuestion
has title: Get Request source URL in PHP and Java
tagged with: java
duplicate of: http://stackoverflow.com/q/2648984
type: Question
score: 0

http://stackoverflow.com/comment/42203435
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26816364
has text: What do you mean by "fails completely"? I expect there would be some inaccuracies you should account for. For example, if y=100 and x=50, a would be 25, but there are actually 26 numbers divisible by 2 in this range. You should figure out how to change the values of a,b,c,d,e,f,g (probably at most adding or subtracting one from the result) depending on whether the numbers at the edges (y and x) are divisible by the relevant number.
type: QuestionComment

http://stackoverflow.com/a/26767367
has comment: http://stackoverflow.com/comment/42116214
has comment: http://stackoverflow.com/comment/42115745
answers question: http://stackoverflow.com/q/26767236
type: Answer
has comment: http://stackoverflow.com/comment/42129365
has comment: http://stackoverflow.com/comment/42117698
has comment: http://stackoverflow.com/comment/42116616
has body: Just add a row to your JTable Model every time you have your result... refer to this SO question DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.addRow(new Object[]{"Column 1", "Column 2", "Column 3"}); or in your case DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.addRow(new Object[]{searchResultData});
score: -1
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/42209430
type: Comment
score: 0
type: AnswerComment
has text: Then look at the crash log to see the backtrace, hopefully showing where the exception was thrown from or at least logging the failure reason with more detail. It should be in ~/Library/Logs/DiagnosticReports
comment on: http://stackoverflow.com/a/26815103

http://stackoverflow.com/comment/42032293
comment on: http://stackoverflow.com/a/26721085
type: AnswerComment
type: Comment
score: 0
has text: @tnw The Internet is hateful enough without me coming down on those who maybe haven't done enough to deserve our help. Just my opinion on life/the Internet

http://stackoverflow.com/a/67078510
answers question: http://stackoverflow.com/q/26705531
score: 0
has body: It's not exactly what was asked but as I had to get a Map of <Constant, Value> I've modified a bit the Jeanne answer and it may help someone: public class AnyNamesConstants { public static final String CONST_1 = "Constant 1"; public static final String CONST_2 = "Constant 2"; public static Map<String, Object> getMapConstValue() throws IllegalAccessException { Map<String, Object> map = new HashMap<>(); for (Field field : AnyNamesConstants.class.getDeclaredFields()) { int modifiers = field.getModifiers(); if( Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers) ) { list.put(field.getName(), field.get(field.getType())); } } return map; } } You'd get: { "CONST_1": "Constant 1", "CONST_2": "Constant 2" }
type: Answer

http://stackoverflow.com/comment/41951729
score: 0
has text: Hey thank you! I will read about the modular arithmetics. Thanks !!! :) ... I have done the if conditionals now, but I am still struggeling for counting the number of numbers. I have used a separate variable but it only gives me the list of those numbers. I have posted the updated code on my question post if you could please take a look.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26676230

http://stackoverflow.com/comment/42106511
score: 1
comment on: http://stackoverflow.com/a/26762123
type: Comment
has text: Note that C also passes arguments only by value.
type: AnswerComment

http://stackoverflow.com/q/26799318
tagged with: java
has answer: http://stackoverflow.com/a/26799406
has comment: http://stackoverflow.com/comment/42172412
type: Question
tagged with: variables
has body: So, I've got a class called IntRectangle that holds int x1, int x2, int y1, int y2. This is my assumption: If I make the attributes above public I will get a performance boost, since I don't have to push and pop things when accessing them. I'll give it a shot. public class CrapMain { public void start () { IntRectangle rec = new IntRectangle (5, 10, 6, 12); int value = 0; double time = System.nanoTime(); for (int i = 0; i &lt; 1000000000; i++){ value = rec.X1; } time = System.nanoTime() - time; System.out.println(time); } public static void main(String[] args) { new CrapMain().start(); } } It prints 2559391.0 If I make the attributes private, create getters for them and change "value = rec.X1;" to "value = rec.getX1();" it prints 3551075.0 So there's obviously a performance boost given. However, It makes the code venerable, since it's easy to change the attributes by mistake. My question is, is it worth it? And is it common practice among programmers writing high-performance code?
upvote count: 2
score: 0
answer count: 2
downvote count: 2
has title: Performance gain using public attributes in java?
possible better answer: http://stackoverflow.com/a/26799406
has comment: http://stackoverflow.com/comment/42172506
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has answer: http://stackoverflow.com/a/26799422
accepted answer: http://stackoverflow.com/a/26799422
type: AnsweredQuestion

http://stackoverflow.com/comment/42174411
comment on: http://stackoverflow.com/q/26800380
type: QuestionComment
has text: can you try using spinner
type: Comment
score: 0

http://stackoverflow.com/comment/41958004
comment on: http://stackoverflow.com/a/26679390
score: 0
has text: You can see the `log n` performance with a simple test. Write the index out for each iteration: `for(int bound = 1; bound <= n; bound *= 2) { System.out.println(bound); }`. Now try `n=10`, then `n=100`, and so on (increasing by a factor of 10). You'll see the number of items output increases linearly while `n` increases by an order of magnitude.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26753390
accepted answer: http://stackoverflow.com/a/26753437
answer count: 2
tagged with: weblogic
has title: Project not deploying due to "Project facet Java 1.7 is not supported by this server."
tagged with: facet
score: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26756396
has answer: http://stackoverflow.com/a/26753437
possible better answer: http://stackoverflow.com/a/26756396
type: AnsweredQuestion
tagged with: java
upvote count: 1
has body: I am having trouble trying to deploy a WAR project on Oracle Weblogic Server 11gR1 (10.3.5), tried both to deploy it in an EAR project, or by itself as a war. The error I get is this: "Project facet Java 1.7 is not supported by this server." The problem is that there is no Project Facet Java 1.7 in this project. The facets selected are this: Dynamic Web Module 2.5 Java 1.6 JavaScript 1.0 I only have JRE6 installed in eclipse and I'm using it as default. Other projects are deploying succesfully. I found a workaround, deploying the EAR empty, and then adding the WAR project to the EAR. But in that case I get other problems at runtime which shouldn't be happening, I guess caused by the tricky solution. Any ideas? Thank you.
tagged with: eclipse
downvote count: 1
type: Question

http://stackoverflow.com/comment/42126885
comment on: http://stackoverflow.com/a/26773799
type: Comment
has text: giving me the same error Cannot find component with expression ":data" referenced from "j_idt12:datatable:0:j_idt33".
type: AnswerComment
score: 0

http://stackoverflow.com/a/26692191
type: Answer
has comment: http://stackoverflow.com/comment/42011460
has comment: http://stackoverflow.com/comment/42063611
upvote count: 2
has body: You could use File.toURI() to generate a properly escaped URI string: new java.io.File("abc def.mp3").toURI().toString(); ;; =&gt; "file:/.../abc%20def.mp3" See the Media(String) documentation: The supplied URI must conform to RFC-2396 as required by java.net.URI. Spaces, e.g., have to be escaped as %20.
has comment: http://stackoverflow.com/comment/42012282
has comment: http://stackoverflow.com/comment/41980874
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26692061

http://stackoverflow.com/comment/42228985
score: 0
type: AnswerComment
has text: Thanks for the response. I am able to put messages in the queue after performing the below changes. Set `MCA User Id` as empty and in my program `queueConn = connectionFactory.createQueueConnection(" ","password");`. I will try your suggestions.
comment on: http://stackoverflow.com/a/26830818
type: Comment

http://stackoverflow.com/a/26767687
type: Answer
has body: random.nextDouble() only returns 0.0 to 1.0 you need to multiply it by 4 first x = (random.nextDouble() * 4 - 2); y = (random.nextDouble() * 4 - 2);
score: 0
answers question: http://stackoverflow.com/q/26767637

http://stackoverflow.com/comment/42214054
comment on: http://stackoverflow.com/a/26822256
score: 0
type: AnswerComment
type: Comment
has text: @that other guy: I just tested the source with 3 different "Objects" containing the method `t1,t2,t3` (Obj1, Obj2, Obj3) - outcome was the same. Why is a synchronized method on `Obj1` preventing different threads to access `Obj2.t2` respectively `Obj3.t3` ?

http://stackoverflow.com/comment/42079146
comment on: http://stackoverflow.com/a/26744671
type: Comment
has text: :: It is a program for Love index so I will get only 2 names ... any way I will have new question for some random inputs ...
score: 0
type: AnswerComment

http://stackoverflow.com/a/26695021
score: 0
answers question: http://stackoverflow.com/q/26693851
type: Answer
has body: You might use a switch block switch(array[i]){ case 1: printf("One\n"); break; case 2: printf("Two\n"); break; etc...

http://stackoverflow.com/q/26831125
score: 6
has body: I am following this example from Spark documentation for calculating the TF-IDF for a bunch of documents. Spark uses the hashing trick for this calculations so at the end you get a Vector containing the hashed words and the corresponding weight but... How can I get back the words from the hash? Do I really have to hash all the words and save them in a map for later iterate through it looking for the keywords? There is no more efficient way built-in Spark? Thanks in advance
tagged with: java
has title: Spark TF-IDF getting the words back from hash
type: Question
has answer: http://stackoverflow.com/a/42439789
has answer: http://stackoverflow.com/a/30402961
downvote count: 0
favorite count: 0
tagged with: apache-spark
answer count: 3
upvote count: 6
has answer: http://stackoverflow.com/a/30399432
tagged with: tf-idf
tagged with: hash
type: UnansweredQuestion

http://stackoverflow.com/comment/42062131
type: Comment
type: AnswerComment
has text: Added it to my answer above.
score: 0
comment on: http://stackoverflow.com/a/26737093

http://stackoverflow.com/comment/41951487
type: QuestionComment
comment on: http://stackoverflow.com/q/26676169
type: Comment
score: 0
has text: Why don't you try it?

http://stackoverflow.com/a/26861228
has body: Use view.loadUrl("file:///android_asset/index.html"); instead of using myWebView();
has comment: http://stackoverflow.com/comment/42428667
has comment: http://stackoverflow.com/comment/42507666
has comment: http://stackoverflow.com/comment/42496984
type: Answer
answers question: http://stackoverflow.com/q/26819262
has comment: http://stackoverflow.com/comment/42588759
has comment: http://stackoverflow.com/comment/42422945
score: 0

http://stackoverflow.com/comment/42086969
type: Comment
has text: so i cannot use mysql without using its server in my standalone app!!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26751662

http://stackoverflow.com/comment/41995042
comment on: http://stackoverflow.com/a/26700623
type: Comment
has text: Here's a useful link on how to post a [minimal complete example](http://stackoverflow.com/help/mcve). In the meantime consider accepting this answer - click the 'tick'
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42105237
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26761714
has text: I believe you will find the error if you make your code more readable

http://stackoverflow.com/comment/42057415
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26729310
type: QuestionComment
has text: Actually @CreatedBy annotation is not compulsory, also joda-time is on classpath already so should be no problem.

http://stackoverflow.com/comment/42161085
comment on: http://stackoverflow.com/q/26792879
has text: Are you allowed use java's built-in [Date class](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html)? Read its javadocs and see how much of that work is already done for you. Just [delegate](http://en.wikipedia.org/wiki/Delegation_pattern) all the work to Date. (links in this comment; hard to see but they're there!)
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/q/26762739
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/12236519
tagged with: queue
type: Question
has comment: http://stackoverflow.com/comment/44762071
has comment: http://stackoverflow.com/comment/43056460
downvote count: 0
has comment: http://stackoverflow.com/comment/42106862
favorite count: 0
tagged with: ibm-mq
has title: How to get a message from MQ using selectors Java
type: UnansweredQuestion
has body: I am very NEW in JMS and I am having a hard time to read message from a remote MQ. I can send message to it easily, but I want to receive the message with a selector. Anyone has snips of code that could share? Thanks Edit: I need to use Selectors and Listeners Edit2:Specifically I am using IBM MQ. I am now sending messages through correlation ID, but I want to do it through message selectors. Is there a quick way to do it? Or I should write from scratch the JMS? Also I don't know where to modify the host name or port or queue name to connect to using JMS as standalone application.
score: 3
has comment: http://stackoverflow.com/comment/42117044
answer count: 0

http://stackoverflow.com/a/26718489
has comment: http://stackoverflow.com/comment/42028964
score: 0
has body: Directly specifying web url on android view is not possible. You have to download the image from url, store it in some location and then use it in the Imageview File image = new File(storedPath); if(image.exists()){ Bitmap myBitmap = BitmapFactory.decodeFile(image.getAbsolutePath()); ImageView myImage = (ImageView) findViewById(R.id.imageview_xyz); myImage.setImageBitmap(myBitmap); } downloading should be done asynchronously when using listview for list view scroll to be smooth. Final output you need to target is like, user keep scrolling the list, images slowly appear as and when downloading is completed. Lot of other optimization technics guide-lined by android should be used to get the best performance(convertViews, viewHolder etc)
type: Answer
answers question: http://stackoverflow.com/q/26718336
has comment: http://stackoverflow.com/comment/42027686

http://stackoverflow.com/comment/42082518
comment on: http://stackoverflow.com/q/26748783
has text: @ElliottFrisch basically, any use case where keys and/or values were not bona fide Java `String`s. As to EBCDIC, this is a character coding anyway, so this basically counts as text ultimately ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42122559
score: 2
comment on: http://stackoverflow.com/q/26769081
type: Comment
type: QuestionComment
has text: Take a look at the shunting-yard algorithm.

http://stackoverflow.com/comment/41978675
type: Comment
has text: Perhaps you want something like, `TwoDimensionalShape twoDShape = new Circle(someRadius);`, and then call `twoDShape.getArea()`, but I'm not yet really sure.
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/26691076

http://stackoverflow.com/comment/41979959
type: QuestionComment
has text: I can't know specifically. Some times I am dumb enough to not notice my phones aren't plugged in. You shouldn't really need drivers on a Mac. When you plug your phone(s) in, can you browse them in Finder?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/26691682

http://stackoverflow.com/a/26767155
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26766950
answers question: http://stackoverflow.com/q/26766950
type: Answer
score: 0
has body: So I see two glaring errors, the first of which is what the compiler is telling you, namely that real and imaginary have not been declared anywhere. In Java, you cannot use a variable unless you have previously declared it. You probably want to have a real and imaginary component of your ComplexNumber, so you need to declare member variables for it appropriately. e.g. public class ComplexNumber { float real; float imaginary; ... The second error is that you are trying to assign the values of real and imaginary to your parameter variables, instead of the other way around. When you do this, you are throwing away the data that is being passed in to your method instead of storing it: public ComplexNumber(float a, float b){ a = real; // this overwrites the value of a instead of using it b = imaginary; // this overwrites the value of b instead of using it } Generally, the convention in Java is to try to give your member variables informative names, and then in your constructors, getters and setters, use the same names with a this. prefix for the member variables to distinguish them from the parameters. Most modern IDEs will automatically generate your code for you in this format. e.g. public class ComplexNumber { float real; float imaginary; public ComplexNumber(float real, float imaginary) { this.real = real; this.imaginary = imaginary; } }

http://stackoverflow.com/comment/42139400
type: QuestionComment
comment on: http://stackoverflow.com/q/26780304
score: 0
has text: The `JpaItemWriter` already flushes, it doesn't clear but alas, just make sure your batch size isn't too large. Dirty checking is always done, the more objects you have in your first level cache the longer it takes. Also you aren't using an `EntityManger` for the read but a `Session` as you are mixing plain Hibernate and JPA.
type: Comment

http://stackoverflow.com/a/26689440
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26688636
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It make a lot of sense in quite a few cases to not use a full blown ORM but rely on lower level of abstraction, like Spring JDBCTemplate and RowMapper. iBatis comes to mind as well. And that make sense even in large enterprise solutions. If you leave the full blown ORM world, you will have to do additional work yourself. For example, you can write an SQL query with a join, returning all customer fields and all products of that customer, and iterate through it to map all that to Java object. In quite a few cases, the code can be as clean as what you would have with an ORM. Writing all that data is more messy, especially if you need to optimize for stuff that has not been dirtied. Best use case I can think of is batch processing, where control over data access becomes more important and higher level of abstraction do not necessarily make you more productive.
answers question: http://stackoverflow.com/q/26688636
score: 4

http://stackoverflow.com/comment/42100983
has text: Did you change the underlying [jsp version](http://stackoverflow.com/questions/2013879/the-ultimate-java-version-table-j2ee-java-ee-servlet-jsp-jstl), maybe indirectly by upgrading to a newer server verison?
type: AnswerComment
comment on: http://stackoverflow.com/a/26739574
score: 0
type: Comment

android-listview
tags question: http://stackoverflow.com/q/26763883
tags question: http://stackoverflow.com/q/26752930
tags question: http://stackoverflow.com/q/26692271
tags question: http://stackoverflow.com/q/26783965
tags question: http://stackoverflow.com/q/26692418
tags question: http://stackoverflow.com/q/26820325
tags question: http://stackoverflow.com/q/26830505
tags question: http://stackoverflow.com/q/26831043
tags question: http://stackoverflow.com/q/26703135
tags question: http://stackoverflow.com/q/26719913
tags question: http://stackoverflow.com/q/26703395
tags question: http://stackoverflow.com/q/26722391
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/26813452
tags question: http://stackoverflow.com/q/26797882
tags question: http://stackoverflow.com/q/26820213
tags question: http://stackoverflow.com/q/26743644
tags question: http://stackoverflow.com/q/26718336
tags question: http://stackoverflow.com/q/26802491
tags question: http://stackoverflow.com/q/26724782

http://stackoverflow.com/comment/42223060
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26823484
has text: @David Wallace: It was a writing mistake, the original code without the space.

http://stackoverflow.com/comment/42057712
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26735276
score: 1
has text: @Gene - Wouldn't a regex with `replaceAll()` or `Pattern / Matcher` be less efficient?

http://stackoverflow.com/comment/42167155
type: Comment
type: QuestionComment
has text: Your problem is not the flush() method. It just makes your programm print the content of the buffer into the file, in which your writer should be writing. (also see http://stackoverflow.com/questions/1742361/flush-in-java-io-filewriter)
comment on: http://stackoverflow.com/q/26796450
score: 0

http://stackoverflow.com/comment/42034289
has text: While that is very helpful, what would the code exactly look like after taking your suggestion. I'm sorry to be asking this, but I'm concerned about where it should go so when compiling, errors that occur can be minimal and easily contained.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26721835

http://stackoverflow.com/q/26808927
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42190566
has answer: http://stackoverflow.com/a/26812145
has comment: http://stackoverflow.com/comment/42190965
type: UnansweredQuestion
has title: Program giving strange output
has comment: http://stackoverflow.com/comment/42192914
has body: This program is meant to output a series of integers which can be read by another program (provided by my instructor; I am certain that her code is not the issue) to draw a pattern of lines. The intended pattern is four curves which start at each corner and rotate counter-clockwise towards the center; then stops when the length of each movement is greater than the distance between one point and the next. Looks like this: Unfortunately, the program either stops when this distance is reached by the first point, and doesn't allow the other three to complete, or it stops when the fourth and final point has reached this point, but in the meantime has output a bunch of other random lines that don't make any sense. Looks like this: Any insight would be appreciated at this point. Code is below. import java.util.Scanner; import java.io.*; import java.awt.Point; public class Slugs { public static void main(String[] args) { Scanner input = null; try { input = new Scanner(new File("slug_details.txt")); } catch (java.io.FileNotFoundException e) { System.out.println("Sorry, file not found."); System.exit(-1); } String filename = input.next(); int boxSize = input.nextInt(); int d = input.nextInt(); Point[]slugs = new Point[4]; slugs[0] = new Point(0, 0); slugs[1] = new Point(0, boxSize); slugs[2] = new Point(boxSize, boxSize); slugs[3] = new Point(boxSize, 0); PrintStream output = null; try { output = new PrintStream(new File(filename)); } catch (java.io.FileNotFoundException e) { System.out.println("Sorry, file could not be created."); System.exit(-1); } output.println(boxSize + " " + boxSize); moveSomeSlugs(slugs, d, output); } public static void moveSomeSlugs(Point[]slugs, double d, PrintStream output){ /* move slugs distance d until d &gt; */ double distance = 0.0; double ratio = 0.0; for (int i = 0; i&lt;(slugs.length); i++){ distance = Math.sqrt((Math.pow((slugs[(i+1)%4].x-slugs[i].x), 2))+(Math.pow((slugs[(i+1)%4].y-slugs[i].y), 2))); ratio = d/distance; } while (d &lt;= di…
tagged with: java
type: Question

http://stackoverflow.com/a/26808179
downvote count: 0
answers question: http://stackoverflow.com/q/26808126
has body: In removeAccess, your eq variable is a copy of the eq from main. Changing removeAccess's eq does not change eq in main. If you want the value eq from removeAccess, then you must return it. There is no need to pass it as a parameter; remove the boolean parameter. private boolean removeAccess(List&lt;Integer&gt; copy, Integer letterNum) { boolean eq = false; // rest of code from your method remains the same return eq; } Then in main: eq = removeAccess(copy,d);
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/41976918
type: AnswerComment
type: Comment
has text: Weird ! Thank you. I wasted a day for this.
comment on: http://stackoverflow.com/a/26689930
score: 0

http://stackoverflow.com/comment/42198196
has text: try to give full path.may be file not exist
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26812962
type: QuestionComment

http://stackoverflow.com/a/29572585
upvote count: 4
downvote count: 0
has body: I started writing a script to migrate simple use cases from log4j.properties to log4j2.xml. It is currently in a very early stage but can convert some simple configurations. It could be extended for similar log4j.xml configurations. https://github.com/mulesoft-labs/log4j2-migrator
has comment: http://stackoverflow.com/comment/125425923
type: Answer
answers question: http://stackoverflow.com/q/26718495
score: 4

http://stackoverflow.com/comment/42028357
score: 0
comment on: http://stackoverflow.com/a/26705591
type: Comment
has text: I trust that it probably would be pretty easy using such code, but is there a possibility to do the same by splitting lines and then using if statements? as thats kind of what I have to do but I really have no idea how, thank you for your reply :)
type: AnswerComment

http://stackoverflow.com/comment/42016820
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26712836
has text: @Dmytro I have edited an included error
score: 0

http://stackoverflow.com/comment/42078572
comment on: http://stackoverflow.com/q/26746658
score: 0
type: Comment
type: QuestionComment
has text: true, if it contains | and : regardless of position

http://stackoverflow.com/q/26690258
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26690331
score: 0
answer count: 1
has body: In my spring project 'Calorie counter', I have the following file structure: Calorie counter code/ CalorieCounterWar/ src/ target/ pom.xml ... CalorieCounter/ src/ target/ pom.xml/ ... Everytime I have to do mvn clean install both in CaloriecCounter and CalorieCounterWar to build the project. Without writing a script to do it together, is there a way to modifiy/add pom.xml to do both buids by single mvn clean install?
has title: Maven clean install both jar and war
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/26690331

http://stackoverflow.com/comment/46610639
has text: Did you try consuming an object which has a LocalDateTime (or some other java 8 date time object) as a field? I have a grizzly/jersey setup which gives null for all LoalDateTime fields in objects I POST. The input I give has the exact same format as what is produced by a method which returns the same object, e.g. `{"time":"2015-03-22T19:55:26.075Z","value":"foobar"}`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26825079

date-formatting
tags question: http://stackoverflow.com/q/26808053
tag name: date-formatting
type: Tag
tags question: http://stackoverflow.com/q/26674721

http://stackoverflow.com/q/26717297
type: Question
answer count: 1
tagged with: cassandra
score: 0
has comment: http://stackoverflow.com/comment/42025066
has body: Is the following possible in Cassandra? I'd like to get a list of all UUIDs from a table, but I keep getting errors. Here is the code in question: @Query("SELECT id FROM table") public Result&lt;UUID&gt; getIds(); And here are the errors: Caused by: java.lang.RuntimeException: Error preparing queries for accessor DeviceAccessor at com.datastax.driver.mapping.AccessorMapper.prepare(AccessorMapper.java:48) at com.datastax.driver.mapping.MappingManager.getAccessor(MappingManager.java:156) at com.datastax.driver.mapping.MappingManager.createAccessor(MappingManager.java:109) at com.tmp.whatever.persistence.DevicePersistenceHandler.init(DevicePersistenceHandler.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) ... 41 more Caused by: java.lang.RuntimeException: Cannot map return to class class com.datastax.driver.mapping.Result at com.datastax.driver.mapping.MethodMapper.mapType(MethodMapper.java:118) at com.datastax.driver.mapping.MethodMapper.prepare(MethodMapper.java:93) at com.datastax.driver.mapping.AccessorMapper.prepare(AccessorMapper.java:46) ... 51 more Caused by: java.lang.IllegalArgumentException: @Table annotation was not found on type java.util.UUID at com.datastax.driver.mapping.AnnotationParser.getTypeAnnotation(AnnotationParser.java:292) at com.datastax.driver.mapping…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26725551
tagged with: java
has title: Cassandra UUID Query Problems

http://stackoverflow.com/comment/49624489
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26748648
has text: For the load testing we simply restarted the server which resolved the issue temporarily. We did not encounter this error on production.
score: 0

http://stackoverflow.com/comment/42048483
comment on: http://stackoverflow.com/a/26729338
has text: Please see update. I did "Synchronize" and it still isn't helping.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41977871
type: AnswerComment
comment on: http://stackoverflow.com/a/26690639
type: Comment
has text: http://www.mkyong.com/spring-mvc/spring-3-mvc-and-jsr303-valid-example/ i looked at this example and he didn't create any validators
score: 0

http://stackoverflow.com/q/26690481
favorite count: 0
has comment: http://stackoverflow.com/comment/41979561
upvote count: 2
has answer: http://stackoverflow.com/a/26710992
has body: This week I started using Vaadin and has made a big impression on me ever since. However, I came accross a problem which I am not able to resolve. Basically I made a web application where I display Contacts (stored in my database) and display them in a Table. Since I am using Hibernate, I start off with the following lines of code: JPAContainer&lt;Contact&gt;contactContainer = new JPAContainer&lt;Contact&gt;(Contact.class); CachingMutableLocalEntityProvider&lt;Contact&gt; entityProvider = new CachingMutableLocalEntityProvider&lt;Contact&gt;(Contact.class, em); contactContainer.setEntityProvider(entityProvider); contactsList = new ContactsList(contactContainer); As you can see, I pass my container to a class called ContactsList where the table etc. is built: table = new Table(); table.setWidth(100, Unit.PERCENTAGE); table.addStyleName(ValoTheme.TABLE_BORDERLESS); table.addStyleName(ValoTheme.TABLE_COMPACT); table.setSelectable(true); table.setColumnCollapsingAllowed(true); if(container != null) { table.setContainerDataSource(this.container); table.setSortAscending(true); table.setVisibleColumns("firstName", "lastName", "telephoneNr", "gsmNr", "creationDate"); table.setColumnHeaders(SpringUtil.getMessage("label.contacts_firstname", null), SpringUtil.getMessage("label.contacts_lastname", null), SpringUtil.getMessage("label.contacts_telephone_nr", null), SpringUtil.getMessage("label.contacts_gsm_nr", null), SpringUtil.getMessage("label.contacts_creationdate", null)); } table.setMultiSelect(true); table.setImmediate(true); When I comment out all this code, my application runs perfectly without crashing (ofcourse not showing the contacts table) but when I try and compile this code, while debugging everything works well even after the table has been built but then a NPE is thrown in the class ServerRpcHandler on the lines: if (invocation instanceof ServerRpcMethodInvocation) { try { ServerRpcManager.applyInvocation(connector, (ServerRpcMethodInvocation) invocation); } catc…
has comment: http://stackoverflow.com/comment/42011836
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
type: Question
accepted answer: http://stackoverflow.com/a/26710992
downvote count: 0
has comment: http://stackoverflow.com/comment/42013296
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42012653
answer count: 1
has title: Vaadin NPE in ServerRpcHandler

http://stackoverflow.com/q/26790769
has answer: http://stackoverflow.com/a/27307595
has title: Log4j 2: How to Use XMLLayout?
type: UnansweredQuestion
tagged with: tomcat7
tagged with: log4j2
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has body: The Log4j 2 manual states: An Appender uses a Layout to format a LogEvent into a form that meets the needs of whatever will be consuming the log event. Among several of the appenders in my log4j2.xjm, I have this: %d{yyyy-MM-dd HH:mm:ss.SSS} %m%n <SizeBasedTriggeringPolicy size="10 MB" /> <DefaultRolloverStrategy min="1" max="4" /> <XMLLayout complete="true" charset="UTF-8" compact="false"/> When Tomcat starts, I get this error: 2014-11-06 12:45:40,631 ERROR appender RollingFile has no parameter that matches element XMLLayout 2014-11-06 12:45:40,696 ERROR appender RollingFile has no parameter that matches element XMLLayout Logging into a standard log file works great when I omit the XMLLayout element. I can't seem to locate any examples of how to correclty use XMLLayout. Anyone know what I'm doing wrong?

http://stackoverflow.com/a/26775157
has comment: http://stackoverflow.com/comment/42143982
has body: You should have a look at a sparse matrix, which allows you to process huge matrices containing only relatively few values. Examples of a sparse matrix format: CSR (Compressed sparse row) -- stores non-zero elements in contiguous array with another two arrays containing column indices and pointers to row beginnings COO (Coordinate list) -- stores array of tuples (row, column, value)
answers question: http://stackoverflow.com/q/26774698
type: AcceptedAnswer
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26774698
type: Answer
score: 2

http://stackoverflow.com/q/26827523
type: AnsweredQuestion
tagged with: performance
downvote count: 0
tagged with: opengl
score: 1
tagged with: java
tagged with: slick2d
has body: I am writing a 2D lunar lander-style game in Java and using the Slick2D library to handle the graphics. I am having a problem handling the background images. Here is my problem: I have 3 layers of details to paint on the background behind the spaceship (stars, mountains and land including landing sites). These are repainted each loop as the ship (centre of the screen) moves around. The images for these layers are 4500 pixels wide by 1440 high. This is mainly to create some sense of variety (stars) and to be sufficiently wide to hold the generated mountains and land (the land includes the landing sites). Mountains and land are generated per turn and are polygons drawn into holding images. Slick2d (or opengl) is complaining that it cannot handle images of this size - it says it can only handle textures that are 512 x 512 on my development PC. So... if I have been exploring different methods to work around this including: a. doing polygon clipping in each loop to reduce my polygons (mountains and land) to the displayable screen size (640 x 480), but this seems mathematically challenging, or b. splitting my layer images into 512x512 tiles and then updating the screen with the tiles, which is an extension of what I already do (wrapping the layers to create an 'infinite' world) so seems more do-able given my abilities. My first question (or sense-check, really) is am I missing something? My images, although large, are minimal in terms of content, e.g. black background with a few lines on. Is there a way to compress these in Slick2D/opengl or have I missed something to do with settings that means I can make my card handle bigger images? (I'm assuming not, based on what I have read, but hope springs eternal.) So, assuming I have not missed anything obvious, on to part 2... As a quick "I might get away with this" workaround, I have reverted to using BufferedImages to hold the layers and then extracting portions of these into Slick2D images and painting these on the screen in…
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26833715
upvote count: 1
has title: Slick2D Graphics Performance Issues Using Large Images
has answer: http://stackoverflow.com/a/26833715
favorite count: 0

http://stackoverflow.com/comment/42068929
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26741448
has text: I think you accomplished that. It's tricky, and you solved it. You also found that the solution is unreadable and slow. So there's your better understanding. Mission Accomplished.
score: 0

http://stackoverflow.com/a/26678693
has comment: http://stackoverflow.com/comment/41956864
score: 0
answers question: http://stackoverflow.com/q/26678482
type: Answer
has body: You could iterate over your tiles and make a new one for each... Tile[] map = new Tile[] {bt, bt, bt, bt, gt, gt, gt, gt, bt, bt, ft, ft}; ArrayList&lt;Tile&gt; tiles = new ArrayList&lt;Tile&gt;(); for (Tile tile : map) { tiles.add(new Tile(tile.text)); } map = tiles.toArray(map);

http://stackoverflow.com/q/26711084
has comment: http://stackoverflow.com/comment/42013617
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26711466
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26711120
has title: instanceOf not working in application server
favorite count: 0
downvote count: 1
has body: Below code work from my test case but if I run this in application server, instanceOf is not working and getting into else loop and throwing exception. abstract class A { } class B extends A { } class C extends A { } class MyClass { public void setObject(Object obj){ if(obj instanceOf A){ //typecast }else throw new Exception("Object not supported"); } } Client Code- B b = new B(); b.set.. MyClass client = new MyClass(); client.setObject(b);
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42014040

http://stackoverflow.com/comment/42136621
score: 0
type: Comment
type: QuestionComment
has text: @NaveenTamrakar this doesn't works since I'm not calling the asyntask from Addactivity. Also why the vote down ?
comment on: http://stackoverflow.com/q/26779273

http://stackoverflow.com/comment/42212658
score: 0
comment on: http://stackoverflow.com/q/26821595
type: Comment
type: QuestionComment
has text: You're trying to parse a decimal and assign it to an int.

http://stackoverflow.com/comment/42038663
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26724576
has text: How do you want your strings converted to numbers? Give us some examples of how you expect this to work
type: Comment

http://stackoverflow.com/a/26713251
downvote count: 0
score: 1
has body: Define custom levels like this: public static final Level DIAG = Level.forName("DIAG", 350) So all you need is to read those levels in from the configurations file (on startup) and assigned them to some static variables.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26713145

http://stackoverflow.com/comment/42270059
score: 0
type: AnswerComment
has text: I put the jar of "abc-lt-core 5.1.4" as suggested by you. But still i am getting the same error. The issue here is that maven should replace the placeholder ${masterVersionNumber} in parent pom to the number 5.1.4 as specified in the parent pom. But it is not doing so.
comment on: http://stackoverflow.com/a/26811115
type: Comment

http://stackoverflow.com/comment/42588759
has text: I use the "onRecievedError" but the problem has been fixed. It was something on the server side so the guy who has responsability for that fixed it. Going to ask what he did so I can post it
comment on: http://stackoverflow.com/a/26861228
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41991228
has text: @Eran you are right my intent is to modify the source list as it would take less space to do so, and if i wont return any list, then how may i be able to show the split lists,..? once again i am newbie to programming, so avoid if any silly thing goes by me.
comment on: http://stackoverflow.com/a/26697970
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42219275
type: QuestionComment
comment on: http://stackoverflow.com/q/26825139
score: 0
type: Comment
has text: I have a private ArrayList in there called list. I just added the ContactList class.

http://stackoverflow.com/q/26784445
has comment: http://stackoverflow.com/comment/42146188
accepted answer: http://stackoverflow.com/a/26784664
has title: Java Spring: Attribute 'time-unit' is not allowed to appear in element 'int:poller'
score: 0
tagged with: spring
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
has body: I am using Java Spring Integration version 2.0.0 and Java Spring Framework 3.0.5 I am getting the error "Attribute 'time-unit' is not allowed to appear in element 'int:poller'." in my configuration xml files, and this is causing big problems for my program. I am thinking this may be a version issue, but I am not sure. Any help would be much appreciated. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-file="http://www.springframework.org/schema/integration/file" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd"&gt; &lt;int-file:inbound-channel-adapter directory="file:${dir.cu}" channel="cuProvinceFilesIn" prevent-duplicates="true" filename-regex=".+\.csv"&gt; &lt;int:poller fixed-delay="60" time-unit="SECONDS" max-messages-per-poll="10" receive-timeout="10000"&gt; &lt;/int:poller&gt; &lt;/int-file:inbound-channel-adapter&gt;
has answer: http://stackoverflow.com/a/26784664
tagged with: eclipse
type: Question
answer count: 1

http://stackoverflow.com/comment/41993968
comment on: http://stackoverflow.com/a/26699944
has text: Thanks that fixed it! But i if i wanted to change the name of the table would i just change it in the above line? And then the DATABASE_CREATE would make a new table with the new name?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42125196
type: Comment
type: QuestionComment
has text: @dimo414 You are wrong. What he means is: can he do `class MyClass<T1<T2>>` and in method return `T1<Integer>`? How do you specify at compile time that `T1` is a polymorphic type.
comment on: http://stackoverflow.com/q/26772693
score: 0

http://stackoverflow.com/a/26780399
answers question: http://stackoverflow.com/q/26766592
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26766592
type: Answer
has body: believe it. its not supported to use that protocol. use cloud sql or build an https-based service on your vm.
score: 0

http://stackoverflow.com/comment/41953060
type: QuestionComment
comment on: http://stackoverflow.com/q/26676816
type: Comment
has text: You should be careful when you alter code "just here" because people might see: That code doesn't even compile and just skip this question...
score: 0

http://stackoverflow.com/comment/94348722
score: 0
type: Comment
has text: Philipp, does your example illustrate the main reason to use `flatMap`? I suspect that it may be incidental and doesn't illustrate the key use case or reason why `flatMap` exists. (Continued below...)
comment on: http://stackoverflow.com/a/26684611
type: AnswerComment

http://stackoverflow.com/a/26691135
type: AcceptedAnswer
downvote count: 0
has body: Because despite you have generics, you can send them on raw methods and still get runtime errors. Here's an example: public void addUnrelatedInfo(List list) { list.add(5); } //... List&lt;String&gt; stringList = new ArrayList&lt;&gt;(); stringList.add("hello"); addUnrelatedInfo(stringList); stringList.add("world"); System.out.println(stringList); And you get this output: [ hello, 5, world ] As you can see, it just happens to use a method that receives a raw interface/collection and your code can be doomed. The problem is not thinking on you creating such odd methods, but there are some libraries that are Java 1.4 compatibles and their interfaces take as parameter raw types.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/26691048
upvote count: 4
answers question: http://stackoverflow.com/q/26691048

http://stackoverflow.com/q/26712836
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26713113
tagged with: exception
has answer: http://stackoverflow.com/a/26713186
possible better answer: http://stackoverflow.com/a/26712915
has answer: http://stackoverflow.com/a/26712915
tagged with: error-handling
has comment: http://stackoverflow.com/comment/42016997
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42016820
type: Question
has comment: http://stackoverflow.com/comment/42016754
accepted answer: http://stackoverflow.com/a/26713113
has body: I have got the following piece of code and it keeps giving me errors. This particular error is "such element exception". I put a hasNext() check to ensure this doesn't happen but i still get the error. The error also refers to the line containing String kind = sc.next(); public static Meter load(Scanner sc) { MeterNumber meterNumber = MeterNumber.fromString(sc.nextLine()); while (sc.hasNext()) { int n = sc.nextInt(); sc.nextLine(); Tariff[] tariffs = new Tariff[n]; for (int i = 0; i &lt; n; i++) { String kind = sc.next(); sc.nextLine(); if (kind.equals("P")) { tariffs[i] = PeakTariff.PEAK_TARIFF; } else if (kind.equals("O")) { tariffs[i] = OffPeakTariff.OFF_PEAK_TARIFF; } } return new Meter(meterNumber, tariffs); } return null; } I have a main method through which i am trying to call the above method. public class Testt { public static void main(String[] args) { try { Scanner sc1 = new Scanner(new java.io.File("Readings.txt")); Meter.load(sc1); } catch (FileNotFoundException e) { e.printStackTrace(); } } } This is the kind of input i have : 937 216 316 3 O 1041.1 531 481 889 2 P 788.5 Error. Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1371) at Meter.load(Meter.java:29) at Testt.main(Testt.java:19) Thanks in advance
has comment: http://stackoverflow.com/comment/42017014
has title: such element exception for no obvious reason

http://stackoverflow.com/a/26702049
answers question: http://stackoverflow.com/q/26701922
type: Answer
has comment: http://stackoverflow.com/comment/42001361
downvote count: 0
has body: I see several problems with your code, but the biggest immediate problem is that your PlayerTest component has no preferred size set and so it is sized [1, 1] and thus won't be seen at all. Give its container, PanelTest, a BorderLayout so that the PlayerTest component fills its container. Other problems: Don't set the sizes of components. Rather override getPreferredSize() if you must, and have it return the best Dimension for your GUI. This will work better with your layout managers. Be sure to use layout managers such as BorderLayout noted above, so that your GUI's expand when need be and are placed where they need to go. Rather than a thread and an empty run() method, consider using a Swing Timer since it is easier to use this and guarantee that your code is Swing-thread-safe. Avoid KeyListeners but instead use Key Bindings as they are much easier to use with regards to component focus issues. For example: How to make an image move while listening to a keypress in Java. Put a border around your JPanel and you'll find that it's size is = to the width of the GUI but only 30 points high, since you're constraining its preferredSize to 30 by 30, but trying to draw something in it well outside of this range, and so the drawing component is not big enough to show your drawing. I would structure things differently by making the Player class not extend from a Swing component but rather make it a logical class, one that knows how to draw itself. I'd make the main JPanel the drawing JPanel and give it a Player object to move and to display. For example, this code displays and moves a square, but only to the right on right arrow press: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import javax.swing.*; public class MyAnimationTest extends JPanel { private static final int PREF_W = 800; private static final…
score: 1
has comment: http://stackoverflow.com/comment/42001418
has comment: http://stackoverflow.com/comment/42001917
has comment: http://stackoverflow.com/comment/42001808
has comment: http://stackoverflow.com/comment/42001845
accepted answer of: http://stackoverflow.com/q/26701922
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42024953
type: Comment
comment on: http://stackoverflow.com/a/26714113
type: AnswerComment
has text: @JonK - `String#valueOf(Object)` will throw `NumberFormatException` instead of `NPE`. Why is your suggestion better?
score: 0

http://stackoverflow.com/a/26688315
type: AcceptedAnswer
has body: You can add a SWT.Resize listener to be told about all shell size changes: shell.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(final Event event) { } }); Note: If you are using the JFace TableViewer then TableColumnLayout will do the column resize automatically.
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26687513
accepted answer of: http://stackoverflow.com/q/26687513

http://stackoverflow.com/a/26789294
has body: I'm assuming this is homework, since the obvious way is just to use compareTo(), so I'll give you a hint on how to write your own method to do the comparison. You want something with signature int compareStrings(String s, String t); that returns -1 or 0 or 1 depending on whether s is alphabetically before, equal to or after t in the alphabet. Go through the two Strings character by character, and at each stage, if the character from s is less than that of t (here you can use &lt;) then return -1; if it's greater, then return 1; if they're equal, keep going. If you run out of characters in s but still have some in t, then return -1, and if it's the other way round then return 1. If you run out of both at the same time, return 0.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42154976
accepted answer of: http://stackoverflow.com/q/26789205
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42154889
answers question: http://stackoverflow.com/q/26789205

http://stackoverflow.com/comment/102388619
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26756662
has text: Even thought i added wait_timeout and interactive_timeout, i had the same problem. Is there any other solution.
score: 0

http://stackoverflow.com/comment/42168644
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/26778359
has text: I fixed the code snippet and removed the newline from the separator

http://stackoverflow.com/a/26771386
upvote count: 8
type: Answer
score: 8
has body: I have a feeling that all you need is just context.write(tweetId, new Text(tweetReverse)); That is, you just create a new Text object (which implements Writable) and pass a String in the constructor.
answers question: http://stackoverflow.com/q/26769412
downvote count: 0

currency
tag name: currency
tags question: http://stackoverflow.com/q/26717079
type: Tag

http://stackoverflow.com/comment/42010305
comment on: http://stackoverflow.com/a/26708310
type: AnswerComment
score: 0
type: Comment
has text: @EF i can't change my SP.

http://stackoverflow.com/comment/42056728
has text: Well I managed to do it, it was indeed a problem in the packages, it was trying to read from the incorrect folder. Problem Solved. Many thanks!
comment on: http://stackoverflow.com/a/26734450
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26711468
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42014328
has comment: http://stackoverflow.com/comment/42014282
upvote count: 1
has body: It can't be done. So you need to solve the problem by introducing a sharding mechanism. The simplest way would be to just have arrays of arrays with a fixed length.
has comment: http://stackoverflow.com/comment/42014369
score: 1
answers question: http://stackoverflow.com/q/26711407

bullet
tags question: http://stackoverflow.com/q/26822134
tag name: bullet
type: Tag

http://stackoverflow.com/comment/41974355
comment on: http://stackoverflow.com/a/26688333
score: 0
type: AnswerComment
has text: Thanks for your valuable answer.
type: Comment

http://stackoverflow.com/q/26732846
tagged with: decrement
has answer: http://stackoverflow.com/a/26732939
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42052729
has answer: http://stackoverflow.com/a/26732910
has title: How to count from 10 to 1 in java
type: Question
has comment: http://stackoverflow.com/comment/42052698
has comment: http://stackoverflow.com/comment/42059911
favorite count: 0
answer count: 2
has body: For a simple Java program where I want to make the program count from 10 to 1 by incrementing of 2 or 3 or 4 how would I change this code? public class ExampleFor { public static void main(String[] args) { // for(int i = 10; i &gt; 0; i--){ System.out.println("i = " + i); } } }
tagged with: java
downvote count: 3
upvote count: 4
tagged with: for-loop

http://stackoverflow.com/q/26744578
has comment: http://stackoverflow.com/comment/42141723
score: 1
tagged with: java
tagged with: coldfusion-10
tagged with: cfhttp
upvote count: 1
has answer: http://stackoverflow.com/a/27043671
type: Question
has body: We have 9 ColdFusion 10 servers running version 10,0,13,287689. We've added the correct certificates to the cacerts file for java version being using by ColdFusion. Our CFHTTP SSL calls will work correctly for a while, then suddenly they will start returning peer not authenticated. The will not work agian until the ColdFusion instance is recycled at which point they work until the fail again. There is no information in the coldfusion-out, coldfusion-error, http, or exception ColdFusion logs regarding the failure. In addition, just because the CFHTTP HTTPS calls begin failing on one ColdFusion instance, doesn’t mean they will fail on the other. Our ColdFusion servers have multiple ColdFusion instances bound to different websites. As such, for example, one instance may give peer not authenticated, and another will work correctly, despite both using the same Java version and cacerts file. Again, recycling the ColdFusion instance that isn't working will resolve the issue and the CFHTTP call will no longer fail with peer not authenticated. This issue may be related to this: ColdFusion CFHTTP I/O Exception: peer not authenticated - even after adding certs to Keystore However, I've also tried the steps here to no avail, both the one from Raymond and the one by Peter in the comments: http://www.raymondcamden.com/2011/1/12/Diagnosing-a-CFHTTP-issue--peer-not-authenticated We've contacted Adobe and they are investigating the issue, but thought I'd see if anyone else has experienced these random CFHTTP SSL failures
tagged with: ssl
answer count: 2
has title: ColdFusion 10 - CFHTTP - Random peer not authenticated on SSL calls (cacerts file updated)
downvote count: 0
accepted answer: http://stackoverflow.com/a/27043671
has comment: http://stackoverflow.com/comment/42119806
favorite count: 0
linked to: http://stackoverflow.com/q/1613038
possible better answer: http://stackoverflow.com/a/27709307
has answer: http://stackoverflow.com/a/27709307
tagged with: coldfusion
type: AnsweredQuestion

http://stackoverflow.com/comment/41999677
type: QuestionComment
has text: Hovering over the red-line, I get Cannot resolve symbol. And it is not only for Scanner class. System.out.println cannot be found too. The strage part is that it is compiling and running fine
comment on: http://stackoverflow.com/q/26703091
score: 1
type: Comment

http://stackoverflow.com/q/26721104
has title: Put complex command into variable and pass as parameter to another script to run later
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42032546
has comment: http://stackoverflow.com/comment/42032687
has comment: http://stackoverflow.com/comment/42033255
has comment: http://stackoverflow.com/comment/42032183
has comment: http://stackoverflow.com/comment/42033290
has answer: http://stackoverflow.com/a/26725712
tagged with: shell
linked to: http://stackoverflow.com/q/26067249
tagged with: linux
has answer: http://stackoverflow.com/a/26722653
duplicate of: http://stackoverflow.com/q/26067249
linked to: http://stackoverflow.com/q/26684777
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42032675
has body: I have script which runs java binary and want to pass complex command which will be executed when OutOfMemoryException happens. Problem is more general and is not related to OOME. How can I put commands in variable and pass it to other script which will execute it later? This is the code I'm trying to execute. I tried different options of escaping, but without any result. During execution shell tries to split JAVA_OPTS on spaces, no matter how I escape it. #!/bin/sh JAVA_OPTS="-Xmx10m" JAVA_OPTS="$JAVA_OPTS \"-XX:OnOutOfMemoryError=echo 'Ups'\"" set -x java $JAVA_OPTS TestMemory I found this:BashFAQ 050, but none of covered cases applies on me. I can't put this code in a function as JVM process will have no access to it. When I put the whole command as one line, it works well but my use case is a little bit different and I can't modify the last line. JAVA_OPTS should be constructed somewhere else and then used as shown in the sample code.
has comment: http://stackoverflow.com/comment/42032647
tagged with: escaping
score: 0
tagged with: java

http://stackoverflow.com/comment/41988584
has text: It will be overkill if you do full oAuth workflow with each request. Usually you will setup just once and send all requests with access token. And refresh token if required. Read [this RFC](http://tools.ietf.org/html/rfc6749#section-1.4).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26687775

http://stackoverflow.com/comment/42050641
type: Comment
type: QuestionComment
has text: @ShreerajKarki Your header and footer are working fine only prob is with the JS and CSS, try giving `../` before passing the string in `href`
score: 0
comment on: http://stackoverflow.com/q/26730663

http://stackoverflow.com/q/26751627
tagged with: java
has body: I have to use JNI for a Java and C++ project, I got a quick overview of the subject, but one question arise : what if the C++ function I'm trying to call from within the Java code references a Global Variable (in the .cpp file) ? JNI can't call it directly, the global variables have to be loaded, and be in the same address as the function. So how is this done ?
type: Question
score: 5
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/26751713
answer count: 1
has title: How are global variables handled in JNI?
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: c++
downvote count: 0

http://stackoverflow.com/comment/42048858
type: Comment
comment on: http://stackoverflow.com/a/26730397
type: AnswerComment
score: 0
has text: You should also add that changing the parameters can change the result, as the node might change its appearance based on the parameters passed to the method ;)

http://stackoverflow.com/comment/42186806
has text: yes, pls see below my updated post.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26806776

http://stackoverflow.com/q/26701310
has answer: http://stackoverflow.com/a/26701588
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26701409
tagged with: recursion
has answer: http://stackoverflow.com/a/26701406
tagged with: java
has answer: http://stackoverflow.com/a/26701585
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/26702545
score: 0
has body: The input is {4,7,3,6,7} and The output is: [81] [40, 41] [21, 19, 22] [11, 10, 9, 13] [4, 7, 3, 6, 7] The recursive program I have for this is below, where I have added some print statements to understand the recursion: import java.util.Arrays; public class triangle_array { public static void print(int a[]) { if(a.length==0) return; int n=a.length; int newa[]=new int[n-1]; for(int i=0;i&lt;n-1;i++) { newa[i]=a[i]+a[i+1]; } System.out.println("here1") ; print(newa); System.out.println("here2") ; if(newa.length!=0) System.out.println(Arrays.toString(newa)); } public static void main(String args[]) { int a[]={4,7,3,6,7}; print(a); System.out.println(Arrays.toString(a)); } } I got the output as: here1 here1 here1 here1 here1 here2 here2 [81] here2 [40, 41] here2 [21, 19, 22] here2 [11, 10, 9, 13] [4, 7, 3, 6, 7] I am not able to completely understand this recursion, From the above here statements, I understand that the print methos is being called recursively first, and when the condition fails, it returns to outside of print and goes to the line and prints "here2" 2 times and it verifies for the length of newa which is zero, until this point I understood, but in the next iterations how does the length of newa increase and how does the below condition become true, for the println statement ?
has title: Not able to understand this recursion
has answer: http://stackoverflow.com/a/26701635

http://stackoverflow.com/comment/41997303
comment on: http://stackoverflow.com/q/26701928
type: QuestionComment
type: Comment
has text: Why do you want to blindly load all classes in a particular package? You can't use them unless you know the fully-qualified class name anyway.
score: 1

http://stackoverflow.com/q/26719015
has comment: http://stackoverflow.com/comment/42030990
type: Question
answer count: 2
downvote count: 2
has body: Brand new to Groovy and Java. I have a large, tab delimited text file. I need to be able 'test' each line of the text file to make sure certain columns have correct data. For example, column 2 should only have the term 'New Customer' column 14 should only have the term 'Dog' or 'Cat' If any compare fails, then print the incorrect term. package TestImport import java.io.BufferedReader; import java.io.FileReader; public class PreValidateData { public static void main(String args[]) throws Exception { String dataFileName = "C:/Users/BigDaddy/Desktop/test.csv" BufferedReader bReader = new BufferedReader(new FileReader(dataFileName)); String line; while (line = bReader.readLine()) { //Not sure what to put here. This doesn't work String datavalue[] = line.split("\t"); String value2 = datavalue[1]; String value14 = datavalue[13]; if(value2 != "New Customer"){ Println("FAILURE: line:" + value2.linenumber + "in column 2 is not New Customer. but = " + datavalue[2]) } if(value14 != "Ndog" or "cat){ Println("FAILURE: line:" + value14.linenumber + "in column 14 is not cat or dog. but = " + term) } } bReader.close(); } } I'm not sure where to even begin. Any suggestions?
has comment: http://stackoverflow.com/comment/42028159
possible better answer: http://stackoverflow.com/a/26723599
has title: Groovy or Java to parse text file and compare
tagged with: groovy
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26719220
has comment: http://stackoverflow.com/comment/42028146
accepted answer: http://stackoverflow.com/a/26719220
has comment: http://stackoverflow.com/comment/42028681
favorite count: 0
has comment: http://stackoverflow.com/comment/42029854
upvote count: 0
has answer: http://stackoverflow.com/a/26723599
type: AnsweredQuestion
score: -2
tagged with: java

http://stackoverflow.com/q/26757150
has body: Create MongoDB river in Elasticsearch using Java API client.index(Requests.indexRequest("_river").type("my_river").id("_meta").source(source)).actionGet(); How to create source for an above mentioned code. i need to create mongodb river in elasticsearch , i am able to search using curl commands, But need help to create index and searching form java application
downvote count: 0
favorite count: 0
upvote count: 1
tagged with: elasticsearch
answer count: 0
type: UnansweredQuestion
has title: Create index in elastic search using java to create MongoDB river
score: 1
tagged with: elasticsearch-mongo-river
tagged with: java
type: Question
tagged with: mongodb

http://stackoverflow.com/q/26750342
type: UnansweredQuestion
tagged with: jboss
has body: We are upgrading hibernate 3.6 to hibernate 4.3.6 in our application and we are using hibernate JPA 2.0 in Jboss 6.0.0. We have excluded jpa components and other JBoss components and bundled our own libs (i.e jpa hibernate etc) after deploying and starting the Jboss. We get : 17:50:31,788 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///C:/Jboss/jboss-6.0.0.Final/server/XXXXXX/deploy/XXXXXX-6.4.1.ear state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error deploying XXXXXXEJB3.jar: org/hibernate/classic/Session at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:194) [:6.0.0.Final] at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:60) [:6.0.0.Final] at org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer.deploy(AbstractSimpleVFSRealDeployer.java:56) [:2.2.0.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1603) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:…
has title: Upgrade Hibernate 3.6 to hibernate 4.3.6 on jboss 6.0.0 AS getting java.lang.NoClassDefFoundError: org/hibernate/classic/Session
type: Question
tagged with: spring
has answer: http://stackoverflow.com/a/26750621
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: jpa

http://stackoverflow.com/q/26754502
has comment: http://stackoverflow.com/comment/42091926
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42092007
answer count: 3
has answer: http://stackoverflow.com/a/26754532
accepted answer: http://stackoverflow.com/a/26754618
has title: Comparing string to an array of string elements
tagged with: string
has answer: http://stackoverflow.com/a/26754702
favorite count: 0
possible better answer: http://stackoverflow.com/a/26754532
upvote count: 2
has body: So, I want to compare from string to array of strings String [] string = new String [10]; string [1] = "pencil"; string [2] = "pen"; string [3] = "eraser"; how do i compare string to the array of strings from above?
has comment: http://stackoverflow.com/comment/42092280
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42092141
has answer: http://stackoverflow.com/a/26754618
type: Question
score: 2

http://stackoverflow.com/a/26797611
answers question: http://stackoverflow.com/q/26794313
has body: Just initialize database using the ApplicationListener interface. Please take a look at this question: How to add a hook to the application context initialization event? It is possible to create all the data in the onApplicationEvent method. Anyway don't use dbunit, just create all your tests with @Transactional, and @DirtiesContext (DirtiesContext on the class level) using ClassMode=AfterEachTestMethod So the code would be like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:testContext.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class YourTestClassTest { //... }
score: 0
has comment: http://stackoverflow.com/comment/42346476
type: Answer

http://stackoverflow.com/comment/42190901
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26809068
has text: How would I do this? I know how to set up a BufferedReader and the String.split but the verifying part I'm not sure about.
score: 0

http://stackoverflow.com/q/26785859
has title: How to set different images as faces/sides of a 3D cube in Java 3D API?
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26786156
tagged with: image
has body: I've created a small piece of code which draws a 3D cube in my SWT application allowing to rotate it. Now, I want to change each face/side of the cube and draw a different image on it, but I can't find how to do it (or at least, in an easy way, if that's possible). I was able to change the complete texture of the cube to an image, but it change all the faces and I want to set a different image to each face. Is this possible? Any code example? Thanks
type: Question
answer count: 2
tagged with: 3d
downvote count: 0
has answer: http://stackoverflow.com/a/26786156
favorite count: 0
tagged with: geometry
possible better answer: http://stackoverflow.com/a/27187454
upvote count: 1
has answer: http://stackoverflow.com/a/27187454
type: AnsweredQuestion

http://stackoverflow.com/comment/42100636
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26757903
score: 1
has text: (btw, "Companion Object" is the correct nomenclature. You may want to stop calling it "Accompanying object" ;)

http://stackoverflow.com/q/26803484
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/42180586
downvote count: 2
tagged with: loops
has answer: http://stackoverflow.com/a/26803717
has comment: http://stackoverflow.com/comment/42180481
tagged with: average
type: Question
has comment: http://stackoverflow.com/comment/42180485
has body: I'm new to java programming and using NetBeans IDE 8.0, I'm trying to write a code which loops over a txt file full of numbers (numbers.txt), finds all the numbers below 10, and all the numbers over 30, and then calculates the average of these numbers, and outputs in something like "The average of numbers in range is __" This is the code I've got so far, as I'm not quite sure where I've gone wrong: public class RangeAverage { int average=0,num; Scanner scan=new Scanner(new File("numbers.txt")); while(scan.hasNextInt()) { if((num=scan.nextInt()&lt;10 || num &gt;30) { average+=num; } } System.out.println(" Average of numbers in range is "+average); } The errors I get are on the lines: Scanner scan=new Scanner(new File("numbers.txt")); (Lightbulb symbol) -cannot find symbol symbol: class Scanner location: class RangeAverage -cannot find symbol symbol: class Scanner location: class RangeAverage -cannot find symbol symbol: class Scanner location: class RangeAverage ----------- and on the line System.out.println(" Average of numbers in range is "+average); (a ! error) -cannot find symbol symbol: class out location: class System &lt;identifier&gt; expected illegal start of type ------------- Any help would be appreciated, thanks!
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/5072127
has comment: http://stackoverflow.com/comment/42180867
has answer: http://stackoverflow.com/a/26803581
favorite count: 0
has comment: http://stackoverflow.com/comment/42201483
has title: Looping over a txt file, finding numbers within a range and their average
has comment: http://stackoverflow.com/comment/42201666
type: UnansweredQuestion
tagged with: range
has comment: http://stackoverflow.com/comment/42180450
has comment: http://stackoverflow.com/comment/42180212
has comment: http://stackoverflow.com/comment/42180249

http://stackoverflow.com/comment/98477984
has text: I had exactly the same requirement, and end up building my own library - https://github.com/mangatmodi/RandomJson However, if you want to stream data to Kafka, you could use the following rather than using a library and writing own code - https://github.com/everwatchsolutions/json-data-generator
score: 0
comment on: http://stackoverflow.com/q/26795661
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26793296
answers question: http://stackoverflow.com/q/26793222
has body: You could construct the ObjectOutputStream once and save the reference as a field. Also, you should flush(). Assuming you have a class Snake I would construct by passing in the socket.getOutputStream() like private ObjectOutputStream oos; public Snake(OutputStream os) { oos = new ObjectOutputStream(os); } public void sendSnake() { try { oos.writeObject(snakeBody); } catch(IOException ioe) { ioe.printStackTrace(); } finally { oos.flush(); } } And then you can call sendSnake with your Snake instance multiple times, Snake s = new Snake(socket.getOutputStream()); s.sendSnake(); s.sendSnake();
has comment: http://stackoverflow.com/comment/42162458
has comment: http://stackoverflow.com/comment/42162392
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42162021
has comment: http://stackoverflow.com/comment/42162222
has comment: http://stackoverflow.com/comment/42162477
downvote count: 0
score: 1

http://stackoverflow.com/a/26708083
has body: For Content-Type: multipart/form-data we should use FileItem methods getFieldName() getString() to get regular form fields data. Here I'm providing more details from docs with the snippets, to read all form fields data in Servelet using ServletFileUpload Give a look into apache-docs for Processing the uploaded items See below code-snip for understanding on this processing: Handling uploaded Form elements content both regular fields and files // Process the uploaded items Iterator&lt;FileItem&gt; iter = items.iterator(); while (iter.hasNext()) { FileItem item = iter.next(); if (item.isFormField()) { processFormField(item); } else { processUploadedFile(item); } } Process a regular form field // processFormField if (item.isFormField()) { String name = item.getFieldName(); String value = item.getString(); ... } Process a file upload // processUploadedFile if (!item.isFormField()) { String fieldName = item.getFieldName(); String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); long sizeInBytes = item.getSize(); ... } Please proceed rest of the code in http://commons.apache.org/proper/commons-fileupload/using.html
accepted answer of: http://stackoverflow.com/q/26707222
type: Answer
answers question: http://stackoverflow.com/q/26707222
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41995512
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26700893
has text: hi, it doesn't work...where are we setting the value for type T?

http://stackoverflow.com/comment/42110073
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26761048
type: AnswerComment
has text: So how do you pass it in, could you show me an example to implement, sorry it is my first time dealing with this.

opencv
type: Tag
tags question: http://stackoverflow.com/q/26799471
tags question: http://stackoverflow.com/q/26771285
tags question: http://stackoverflow.com/q/26692648
tags question: http://stackoverflow.com/q/26814069
tags question: http://stackoverflow.com/q/26784152
tags question: http://stackoverflow.com/q/26743809
tag name: opencv
tags question: http://stackoverflow.com/q/26807298
tags question: http://stackoverflow.com/q/26822413
tags question: http://stackoverflow.com/q/26760602
tags question: http://stackoverflow.com/q/26829245

http://stackoverflow.com/q/26698962
has title: AnnotationConfigApplicationContext.getBean returns a different bean, Spring
linked to: http://stackoverflow.com/q/26698207
has comment: http://stackoverflow.com/comment/41991949
tagged with: spring
tagged with: inversion-of-control
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41992039
has body: I have a problem that I have a ClassA needs RoomService to be injected, and it works fine that I find in ClassA, the roomService's id is the same. While for some reason, I need roomservice to create room instance based on some input param for me, so I use below config to achieve this: @Configuration @EnableAspectJAutoProxy public class Application { private static ApplicationContext ctx = new AnnotationConfigApplicationContext(Application.class); public static ApplicationContext getApplicationContext(){ return ctx; } @Bean public RoomService roomService(){ return new RoomService();//Singleton } @Bean @Scope("prototype") public AbstractRoom room(AbstractRoom.Mode roomMode){ RoomService roomService = (RoomService) ctx.getBean(RoomService.class); LogUtil.debug("--------from application:" +roomService.id1);//here, I find the id is different every time return roomService.newRoom(roomMode); } } The problem is that I need RoomService to be singleton, but I find that in the Application.java , the ctx.getBean(roomService) always returns a different bean which has different id. Isn't Spring should reuse the same bean? Why is that? Here is how I create a room in RoomService.java public AbstractRoom createRoom(String userID,int playerCount,Mode roomMode){ ApplicationContext ctx =Application.getApplicationContext(); AbstractRoom room = (AbstractRoom)ctx.getBean(AbstractRoom.class,roomMode); } Update: I tried reusing the same ctx and it does not work. One hint is that I find my constructor of RoomService() is called several times(I put a break point in it.) when I run tomcat to start it Here is my web.xml wodinow contextConfigLocation /WEB-INF/dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / Please help!
type: Question
linked to: http://stackoverflow.com/q/13254779
tagged with: ioc-container
linked to: http://stackoverflow.com/q/129207
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26699079
accepted answer: http://stackoverflow.com/a/26699079
tagged with: spring-ioc

applet
tags question: http://stackoverflow.com/q/26801535
tags question: http://stackoverflow.com/q/26702605
tags question: http://stackoverflow.com/q/26742695
tags question: http://stackoverflow.com/q/26760759
tags question: http://stackoverflow.com/q/26684367
type: Tag
tags question: http://stackoverflow.com/q/26790454
tag name: applet
tags question: http://stackoverflow.com/q/26777481
tags question: http://stackoverflow.com/q/26817596
tags question: http://stackoverflow.com/q/26775386
tags question: http://stackoverflow.com/q/26731858
tags question: http://stackoverflow.com/q/26684676
tags question: http://stackoverflow.com/q/26755157
tags question: http://stackoverflow.com/q/26757423
tags question: http://stackoverflow.com/q/26824438
tags question: http://stackoverflow.com/q/26808528
tags question: http://stackoverflow.com/q/26821638
tags question: http://stackoverflow.com/q/26676803
tags question: http://stackoverflow.com/q/26819396
tags question: http://stackoverflow.com/q/26713520
tags question: http://stackoverflow.com/q/26762781
tags question: http://stackoverflow.com/q/26720985

http://stackoverflow.com/q/26724290
has title: Offset epoch date by timezone and hour:minute
upvote count: 2
type: AnsweredQuestion
tagged with: java
tagged with: calendar
type: Question
tagged with: jodatime
tagged with: timestamp-with-timezone
has answer: http://stackoverflow.com/a/26724880
score: 2
answer count: 1
downvote count: 0
has body: My user picks a date, which I store in epoch seconds (or milliseconds if necessary). Separately my user picks a time of day and a timezone. How do I adjust my epoch time with this new information. I feel like I should be able to add X milliseconds based on the hour/minute and then subtract based on the UTC offset of the timezone, but maybe there is a method that does this for me already
favorite count: 0
tagged with: unix-timestamp
accepted answer: http://stackoverflow.com/a/26724880

http://stackoverflow.com/comment/42132618
type: Comment
type: QuestionComment
has text: Hi David..I have updated my original post with my code. please suggest.
comment on: http://stackoverflow.com/q/26776005
score: 0

http://stackoverflow.com/a/26703462
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26702909
downvote count: 0
has comment: http://stackoverflow.com/comment/42001460
has body: Spring Security versions doesn't need to match Spring Framework versions. This is citation from Spring Security docs: Using Spring 4 and Maven Spring Security builds against Spring Framework 3.2.8.RELEASE, but is also tested against Spring Framework 4.0.2.RELEASE. This means you can use Spring Security 3.2.5.RELEASE with Spring Framework 4.0.2.RELEASE. The problem that many users will have is that Spring Security’s transitive dependencies resolve Spring Framework 3.2.8.RELEASE causing all sorts of strange classpath problems. So it is possible to use Spring Security 3.2.5.RELEASE with Spring 4.0.2.RELEASE for sure. But this is talking about Maven usage. I personally believe you can use Spring Security 3.2.5.RELEASE with latest version of Spring Framework without problems. I would suggest to use Spring Boot and it should provide you stable matrix of Spring versions. Latest stable version of Spring Boot is 1.1.8.RELEASE, which cover Spring Framework 4.0.7.RELEASE and Spring Security 3.2.5.RELEASE.
has comment: http://stackoverflow.com/comment/42001213
type: Answer
has comment: http://stackoverflow.com/comment/42001265
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42001381
answers question: http://stackoverflow.com/q/26702909

http://stackoverflow.com/comment/42085918
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26750902
has text: Can you please tell me what is Types.DOUBLE ?
score: 0

http://stackoverflow.com/comment/42085088
has text: set tag to each ID, and getTag() to recognize it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26731870

http://stackoverflow.com/q/26721936
has comment: http://stackoverflow.com/comment/42034295
has comment: http://stackoverflow.com/comment/42034411
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42033813
has comment: http://stackoverflow.com/comment/42043835
has title: Am trying to get chartin web page according to the graph value. but
has comment: http://stackoverflow.com/comment/42034105
type: Question
has comment: http://stackoverflow.com/comment/42034612
tagged with: javascript
has comment: http://stackoverflow.com/comment/42034913
has answer: http://stackoverflow.com/a/27699432
accepted answer: http://stackoverflow.com/a/27699432
has comment: http://stackoverflow.com/comment/42033714
upvote count: 1
has comment: http://stackoverflow.com/comment/42034531
answer count: 1
has comment: http://stackoverflow.com/comment/42033977
downvote count: 0
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/42035110
has comment: http://stackoverflow.com/comment/42034695
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42034390
tagged with: spring-mvc
type: AnsweredQuestion
has body: &lt;script type="text/javascript"&gt; $(document).ready(function (){ myFunc(); }); function myFunc(){ if (document.getElementById('graph').value=10){ var chartData = [{"category":"Payment Details", "value1":10, "value2":90}]; var chart = AmCharts.makeChart("chartdiv", { "theme": "light", "type": "serial", "depth3D":100, "angle":30, "autoMargins":false, "marginBottom":100, "marginLeft":350, "marginRight":300, "pathToImages": "images/", "dataProvider": chartData, "valueAxes": [{ "stackType": "100%", "gridAlpha": 0 }], "graphs": [{ "type":"column", "topRadius":1, "columnWidth":1, "showOnAxis":true, "lineThickness": 2, "lineAlpha": 0.5, "lineColor": "#FFFFFF", "fillColors": "#8d003b", "fillAlphas": 0.8, "valueField": "value1" },{ "type":"column", "topRadius":1, "columnWidth":1, "showOnAxis":true, "lineThickness": 2, "lineAlpha": 0.5, "lineColor": "#cdcdcd", "fillColors": "#cdcdcd", "fillAlphas": 0.5, "valueField": "value2" }], "categoryField": "category", "categoryAxis": { "axisAlpha": 0, "labelOffset":40, "gridAlpha":0 } });} else if (document.getElementById('graph').value=20){ var chartData = [{"category":"Payment Details", "value1":20, "value2":80}]; var chart = AmCharts.makeChart("chartdiv", { "theme": "light", "type": "serial", "depth3D":100, "angle":30, "autoMargins":false, "marginBottom":100, "marginLeft":350, "marginRight":300, "pathToImages": "images/", "dataProvider": chartData, "valueAxes": [{ "stackType": "100%", "gridAlpha": 0 }], "graphs": [{ "type":"column", "topRadius":1, "columnWidth":1, "showOnAxis":true, "lineThickness": 2, "lineAlpha": 0.5, "lineColor": "#FFFFFF", "fillColors": "#8d003b", "fillAlphas": 0.8, "valueField": "value1" },{ "type":"column", "topRadius":1, "columnWidth":1, "showOnAxis":true, "lineThickness": 2, "lineAlpha": 0.5, "lineColor": "#cdcdcd", "fillColors": "#cdcdcd", "fillAlphas": 0.5, "valueField": "value2" }], "categoryField": "category", "categoryAxis": { "axisAlpha": 0, "labelOffset":40, "gridAlpha":0 } }); } &lt;/script&gt; &l…

http://stackoverflow.com/comment/42107976
has text: you can use spring task scheduler to schedule the jobs , it use the @schedule for any method with cron expression .
score: 0
comment on: http://stackoverflow.com/q/26763338
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26753838
answers question: http://stackoverflow.com/q/26752768
has body: You can find this information, if you are using maven and some IDE you can go to the dependancy and make click un > and this will show the librarys used for this dependancy or if you want to use the console you have http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html this will show the same that the IDE. After normally in the documentation of the library used, you can find some doc about the dependancy about this. Other solution is get the .jar and use 7zip to see the POM and know the dependancy used. And for finish my answer if the IDE tell you that you dont have x dependancy normally you have to add this because any of the other dependancy used have it (they used only for the compiling task), but sometime somes projet change a lots of code between the version .a to .b so you will have some problem using the version .b, at this moment i didnt find one good and easy way to fix this, only using the way that i told you (only if i found some problem in the compilation)
has comment: http://stackoverflow.com/comment/42099315
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26752768
score: 0
type: Answer

http://stackoverflow.com/a/33440619
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26698071
type: Answer
score: 2
has body: got into same kind of problem, wasn't able to exclude main spring boot class during testing. Solved it using following approach. Instead of using @SpringBootApplication, use all three annotations which it contains and assign the name to @Configuration @Configuration("myApp") @EnableAutoConfiguration @ComponentScan public class MyApp { .. } In your test class define configuration with exactly same name: @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration // ugly hack how to exclude main configuration @Configuration("myApp") @SpringApplicationConfiguration(classes = MyTest.class) public class MyTest { ... } This should help. Would be nice to have some better way in place how to disable auto scanning for configuration annotations...

http://stackoverflow.com/a/26703376
has body: If a method is declared in a way that it can throw checked exceptions (Exceptions that are not subclasses of RuntimeException), the code that calls it must call it in a try-catch block or the caller method must declare to throw it. Thread.sleep() is declared like this: public static void sleep(long millis) throws InterruptedException; It may throw InterruptedException which directly extends java.lang.Exception so you have to catch it or declare to throw it. And why is Thread.sleep() declared this way? Because if a Thread is sleeping, the thread may be interrupted e.g. with Thread.interrupt() by another thread in which case the sleeping thread (the sleep() method) will throw an instance of this InterruptedException. Example: Thread t = new Thread() { @Override public void run() { try { System.out.println("Sleeping..."); Thread.sleep(10000); System.out.println("Done sleeping, no interrupt."); } catch (InterruptedException e) { System.out.println("I was interrupted!"); e.printStackTrace(); } } }; t.start(); // Start another thread: t t.interrupt(); // Main thread interrupts t, so the Thread.sleep() call // inside t's run() method will throw an InterruptedException! Output: Sleeping... I was interrupted! java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at Main$1.run(Main.java:13)
answers question: http://stackoverflow.com/q/26703324
has comment: http://stackoverflow.com/comment/82369773
has comment: http://stackoverflow.com/comment/53647668
type: AcceptedAnswer
downvote count: 0
score: 48
type: Answer
upvote count: 48
accepted answer of: http://stackoverflow.com/q/26703324

http://stackoverflow.com/comment/42697971
comment on: http://stackoverflow.com/a/27081749
type: Comment
score: 0
type: AnswerComment
has text: Sorry. Way off the mark there. I'll update the code examples. The concept should be the same though. I had thought you were using a particular library (based on your code example).

http://stackoverflow.com/comment/42047879
comment on: http://stackoverflow.com/a/26729599
has text: @nightin_gale What I was suggesting was to use `HtmlUtils.htmlEscape` to escape the string before using it as in your question
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/42050969
has text: Yes, the javadoc is a bit confusing here! This indicates if the item linked to in the observablelist (ie at index value 0,1,2,etc) was updated (ie a new object was placed at that index), not that the object itself changed. The purpose of this is to allow you, within your ListChangeListener to decide if you want to register a ChangeListener on the (probably) ObservableProperty in the list. It should be noted that the ObservableList **does not** require an ObservableProperty as a member, it can hold Object types.
type: AnswerComment
comment on: http://stackoverflow.com/a/26730682
score: 0
type: Comment

http://stackoverflow.com/comment/42043890
has text: This works for the first line, so it is working, but it is not iterating through for the 2nd line and line number
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26727688
type: AnswerComment

http://stackoverflow.com/comment/42223009
score: 0
type: AnswerComment
type: Comment
has text: Oh okay. I've seen it and read bits of it but haven't really did a read up on exactly how it works. School doesn't really teach such stuff so yeah.
comment on: http://stackoverflow.com/a/26827349

http://stackoverflow.com/a/26820189
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Why don't create direct the action listener? letter[i].addActionListener = (new ActionListener() { public void onClick(View view) { textArea.append(""+(char)('A'+ i)); } );
answers question: http://stackoverflow.com/q/26820102

http://stackoverflow.com/comment/42007521
type: Comment
has text: Plug it in and give us the log
score: 1
comment on: http://stackoverflow.com/q/26707480
type: QuestionComment

http://stackoverflow.com/comment/42072038
has text: Ok so, I think you want to get the date too but grouping by day, am I right?
score: 0
comment on: http://stackoverflow.com/a/26721099
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42199196
type: Comment
comment on: http://stackoverflow.com/q/26801535
type: QuestionComment
has text: @AndrewThompson this is awt, i cant use swing for my program and can you ellaborate 5 point.
score: 0

http://stackoverflow.com/q/26791991
type: Question
score: 3
has answer: http://stackoverflow.com/a/75403592
answer count: 1
downvote count: 0
favorite count: 0
has title: jCIFS can't seem to authenticate
tagged with: cifs
has body: I was starting to benchmark how much performance we'd lose by using jCIFS instead of requiring our users to map drives manually themselves, but then I found that I couldn't even pass the first basic test of reading data from a file using jCIFS. I boiled down my issue to a test problem: import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import com.google.common.io.ByteStreams; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbFile; public class TestCifs { public static void main(String[] args) throws Exception { OutputStream output = ByteStreams.nullOutputStream(); String domain = ""; // have tried the actual name too String user = "&lt;your_user_here&gt;"; String pass = "&lt;your_pass_here&gt;"; String relativePath = "path/to/100MiB"; // Read via UNC path (Windows doing the SMB work.) Path uncFile = Paths.get("\\\\192.168.1.66\\Shared", relativePath); Files.copy(uncFile, output); // Read via jCIFS //TODO: Figure out if this is a real URL in which case we'd have to escape stuff. SmbFile smbFile = new SmbFile("smb://192.168.1.66/Shared/" + relativePath, new NtlmPasswordAuthentication(domain, user, pass)); ByteStreams.copy(smbFile.getInputStream(), output); } } If I run this, it runs past the direct copy and then the jCIFS copy fails with: Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password. at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:546) at jcifs.smb.SmbTransport.send(SmbTransport.java:663) at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:390) at jcifs.smb.SmbSession.send(SmbSession.java:218) at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176) at jcifs.smb.SmbFile.doConnect(SmbFile.java:911) at jcifs.smb.SmbFile.connect(SmbFile.java:954) at jcifs.smb.SmbFile.connect0(SmbFile.java:880) at jcifs.smb.SmbFile.open0(SmbFile.java:972) at jcifs.smb.SmbFile.open(SmbFile.java:1006) at jcifs.smb.SmbFileInputStream.&lt;init&gt;(SmbFileIn…
tagged with: jcifs
upvote count: 3
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42141823
type: AnswerComment
score: 0
has text: Ok, thanks for your answer, I will accept it, can you just tell me what would you prefer in my situation? It looks to me that I should use one of your first two approaches for calling Mahout clustering in a loop, and consider that as a job, and if I need some other components, per example for getting the data, than I should use Oozie? I'm lacking experience on working with Hadoop and because of that I'm forming my question in this way.
comment on: http://stackoverflow.com/a/26776696
type: Comment

http://stackoverflow.com/comment/42078287
type: Comment
comment on: http://stackoverflow.com/q/26746435
type: QuestionComment
has text: The "Submit button pressed" is getting printed yes.
score: 0

http://stackoverflow.com/q/26778159
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42134263
has comment: http://stackoverflow.com/comment/42134273
tagged with: java
has title: JAVA: Parsing String to static final int value
type: Question
has body: I have simple problem, but I'm not able to fix it. I have this interface... public interface KeyInput extends Input { public static final int TEST1 = 0x01; public static final int TEST2 = 0x02; } ...this string variable... String inputString = "TEST1"; ...and this method. public void doSomething(int _input) { } I want to parse inputString variable to KeyInput static final int value. So that I could call.... doSomething(KeyInput.parse(inputString)); I know the enum valueOf, but this doesn't work here...
has comment: http://stackoverflow.com/comment/42134255
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26778291
tagged with: parsing
has comment: http://stackoverflow.com/comment/42135436
has answer: http://stackoverflow.com/a/26778291

http://stackoverflow.com/a/26824164
has comment: http://stackoverflow.com/comment/42217607
has comment: http://stackoverflow.com/comment/42217408
has comment: http://stackoverflow.com/comment/42217393
answers question: http://stackoverflow.com/q/26824045
has comment: http://stackoverflow.com/comment/42217543
has comment: http://stackoverflow.com/comment/42217401
score: 0
has comment: http://stackoverflow.com/comment/42217385
has comment: http://stackoverflow.com/comment/42217309
has comment: http://stackoverflow.com/comment/42217327
has comment: http://stackoverflow.com/comment/42217373
has comment: http://stackoverflow.com/comment/42217320
has comment: http://stackoverflow.com/comment/42217511
has comment: http://stackoverflow.com/comment/42217525
has comment: http://stackoverflow.com/comment/42217490
type: Answer
has comment: http://stackoverflow.com/comment/42217415
has body: New Code: public static void main(String [] args) { Scanner keyboard = new Scanner(System.in); System.out.println("What's your balance?"); double initialBalance = keyboard.nextDouble(); Account chase = new Account(initialBalance); System.out.println(chase + "; Would you like to deposit or withdraw?"); String control2 = "deposit"; boolean control = keyboard.next().equalsIgnoreCase(control2); if(control == true) { double deposit = keyboard.nextDouble(); System.out.println("How much would you like to deposit? " + deposit); chase.deposit(deposit); System.out.println(chase); } } }

http://stackoverflow.com/comment/42208649
has text: Why would you want to use Gradle here? Why not use MoDisco (more) directly from your Eclipse plugin?
comment on: http://stackoverflow.com/q/26817902
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41948280
score: 0
type: Comment
has text: my IDE (NetBeans) makes reference to external things with u code files: AndroidManifest.xml MainActivity.java layout - main.xml and more if u have
comment on: http://stackoverflow.com/a/26673725
type: AnswerComment

http://stackoverflow.com/comment/42112378
score: 0
type: Comment
type: QuestionComment
has text: are you trying to remove old <phone1> <phone2> nodes are replace them with a single <phone> node?
comment on: http://stackoverflow.com/q/26736471

http://stackoverflow.com/a/26709198
has comment: http://stackoverflow.com/comment/42010418
has comment: http://stackoverflow.com/comment/42010347
score: 1
answers question: http://stackoverflow.com/q/26708282
upvote count: 1
has comment: http://stackoverflow.com/comment/42010624
has comment: http://stackoverflow.com/comment/42011048
has body: You have a couple of design errors: Don't use both a BufferedWriter and a DataOutputStream to send/receive data through the socket, if you want to send a string you can use the DataOutpurStream writeUTF(aString) method. Execute the reading (from the socket) on another thread because this code while((n = inStream.read(buffer)) != -1) will block until the socket is close. In the client code you are running the socket communication on the UI Thread which will block your application, create another thread for that. You run out of memory because you're using: while((n = inStream.read()) != -1) { content.write(buffer, 0, n); ... } Which reads only one byte from the stream and writes 4096 to the file. Instead of read() use read(buffer)
downvote count: 0
has comment: http://stackoverflow.com/comment/42058371
type: Answer

http://stackoverflow.com/q/26764562
has comment: http://stackoverflow.com/comment/42110093
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26764731
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42110503
has body: My code reads a file called sort.txt, in which there are lexicon words ordered alphabetically and by length. There is one word in each line. The program works fine and please don't comment how it is written. The user then inputs a word he is searching for, e.g. "C**", and program returns all possible matches (Car, Cat, Cam, etc.). My question is how to search the array using binary search to speed things up. But the binary search would only be used if the first or first two or first 3 characters were input by the user, for instance "Ca*" or "Mou**". If the user inputs "***se" for instance, then the program would skip the binary search and would search the entire array. package test; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Scanner; public class main{ public static void main(String[] args) { String izbira; int dolzina=0; Scanner in = new Scanner(System.in); String vnos; Scanner input = new Scanner(System.in); ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); ArrayList list4 = new ArrayList(); ArrayList list5 = new ArrayList(); ArrayList list6 = new ArrayList(); ArrayList list7 = new ArrayList(); ArrayList list8 = new ArrayList(); ArrayList list9 = new ArrayList(); ArrayList list10plus = new ArrayList(); try { File file = new File("sort.txt"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String vrstica; while ((vrstica = bufferedReader.readLine()) != null) { if (vrstica.length() == 1) { list1.add(vrstica); } if (vrstica.length() == 2) { list2.add(vrstica); } if (vrstica.length() == 3) { list3.add(vrstica); } if (vrstica.length() == 4) { list4.add(vrstica); } if (vrstica.length() == 5) { list5.add(vrstica); } if (vrstica.length() == 6) { list6.add(vrstica); } if (vrstica.length() == 7) { list7.add(vrst…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42110014
has title: java binary search from array list, lexicon words
has comment: http://stackoverflow.com/comment/42110208
has comment: http://stackoverflow.com/comment/42110243

http://stackoverflow.com/comment/42295052
type: Comment
comment on: http://stackoverflow.com/a/26836260
has text: blackSmith's solution is a sound and solid approach. Read the metadata in the mapper, and then concatenate the metadata to the mapper "value" output using a delimiter that should not occur naturally within your data. Within your reducer you will then separate the two values and process them.
type: AnswerComment
score: 0

cryptography
tags question: http://stackoverflow.com/q/26742340
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/26824828
tags question: http://stackoverflow.com/q/26829668
tags question: http://stackoverflow.com/q/26689123
tags question: http://stackoverflow.com/q/26832008
tags question: http://stackoverflow.com/q/26723118
tags question: http://stackoverflow.com/q/26824043
tags question: http://stackoverflow.com/q/26824262
tags question: http://stackoverflow.com/q/26779839
tags question: http://stackoverflow.com/q/26828649
tags question: http://stackoverflow.com/q/26803003

joptionpane
tags question: http://stackoverflow.com/q/26702624
type: Tag
tag name: joptionpane

http://stackoverflow.com/comment/42068043
type: Comment
comment on: http://stackoverflow.com/q/26740345
score: 0
type: QuestionComment
has text: is there supposed to be a "c" at the end of classpath:myservice-mynotes.txtc in the last value line?

http://stackoverflow.com/comment/42137102
type: Comment
has text: Is there more information alfet `Syntax error close to:`?
score: 0
comment on: http://stackoverflow.com/q/26772676
type: QuestionComment

http://stackoverflow.com/a/26723055
score: 0
type: Answer
has body: I think you are trying to compare the strings and if they are not equal,then throw the exception... This might help you!!! if(!courseName.equals("FOOD") ){ throw new IllegalArgumentException("ERROR"); }
answers question: http://stackoverflow.com/q/26722865

http://stackoverflow.com/q/26793828
has title: Using For Loop to Get Prime Numbers java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42164134
tagged with: java
has answer: http://stackoverflow.com/a/26793848
type: UnansweredQuestion
has body: I have to to get prime numbers using for loop, I have everything and it runs, but it always return "is prime" Sample Output : 1201 IS PRIME. 77 IS NOT PRIME. 1213 IS PRIME. 88 IS NOT PRIME. 1217 IS PRIME. 99 IS NOT PRIME. 121 IS NOT PRIME. 1431 IS NOT PRIME. 1223 IS PRIME. 141 IS NOT PRIME. 234 IS NOT PRIME. 97 IS PRIME. 436 IS NOT PRIME. 47 IS PRIME. 7 IS PRIME. 547 IS PRIME. 2456 IS NOT PRIME. 34 IS NOT PRIME. The code: import static java.lang.System.*; import java.lang.Math; public class Prime { private int j; private int result = 0; public Prime() { j = 0; } public Prime(int num) { j = num; } public void setPrime(int num) { j = num; } //boolean isPrime() goes here public boolean isPrime() { boolean prime = true; for(int i = 2; i&lt;= j/2; i++) { if(j % i &gt;= 0) { prime = false; } prime = true; } return prime; } public String toString() { if( isPrime() == false) { return "Number: " + j + " is Not Prime."; } else { return "Number: " + j + " is Prime. "; } } } I have the runner set up and I am reading from a file. The problem is that java is not going through the if statement in the back.
type: Question

http://stackoverflow.com/comment/42037137
has text: @PeterLawrey, I've edited both for clarity. Hopefully that will help.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26721890

http://stackoverflow.com/a/26811651
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26811596
type: Answer
answers question: http://stackoverflow.com/q/26811596
score: 2
has body: char[][] matrix = new char[8][]; matrix[0] = s1.toCharArray(); matrix[1] = s2.toCharArray(); etc...
has comment: http://stackoverflow.com/comment/42195996
has comment: http://stackoverflow.com/comment/42195838
has comment: http://stackoverflow.com/comment/42195727
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42195886

http://stackoverflow.com/comment/41997825
has text: where is your `TempLobbyActivity`? put your manifest file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26702179
score: 0

http://stackoverflow.com/comment/42104739
type: AnswerComment
comment on: http://stackoverflow.com/a/26761610
type: Comment
has text: Does src mean the drive that my folder is in? Currently the folder is in my c: drive, so would I do it like this from the command prompt? ||| cd c:\chap02 ||| javac chap02*.java ||| java chap02.GameLauncher ||| ?
score: 0

http://stackoverflow.com/q/26783591
type: Question
has answer: http://stackoverflow.com/a/26784352
answer count: 1
score: 0
has body: I have troubles with displaying custom cursor in Java Swing app. I set the cursor by this code: Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage("sword.png"); Point hotSpot = new Point(0,0); Cursor cursor = toolkit.createCustomCursor(image, hotSpot, "Sword"); panel.setCursor(cursor); This image(size: 32x32px) is displayed quiet correctly(only rubber colour goes from grey to yellow): but this image(size: 128x128) is displayed incorrectly - smaller than 128x128(probably 64x64) and without some colours: This happened when i run the app on Linux Ubuntu. When i run the app on Windows(tested on Win 8) the pencil image is displayed without any problems and sword image with slightly distorted colours. Both of them have same size(32x32). My question is - what parameters should an image for setting cursors have (size, type, quality, number of colours) and if it depends on Java Swing or particular OS? And if i should set cursor in another way, because my code is incorrect.
type: UnansweredQuestion
tagged with: swing
tagged with: java
has title: Image parameters for setting cursor in Java Swing
tagged with: image
tagged with: cursor

http://stackoverflow.com/comment/99300426
type: AnswerComment
type: Comment
has text: To those like me who tried this in 2019: MappingContextTypeInformationMapper is somewhat a red herring. Even latest spring-data-commons'es MappingContextTypeInformationMapper doesn't populate the `typeMap` in the constructor. The latter calls the `verify()` method only, but to be added to the cache the `createAliasFor()` should be called. So even if you add your types to the mappingContext.getPersistentEntities() it will not change anything.
score: 1
comment on: http://stackoverflow.com/a/48026183

linux-mint
type: Tag
tags question: http://stackoverflow.com/q/26722527
tag name: linux-mint

http://stackoverflow.com/comment/71301482
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/32003499
type: Comment
has text: How to fix it??

http://stackoverflow.com/comment/42030568
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26719754
has text: Take a look at: http://stackoverflow.com/questions/3802510/force-to-open-save-as-popup-open-at-text-link-click-for-pdf-in-html and http://stackoverflow.com/questions/2226192/generate-some-xml-in-javascript-prompt-user-to-save-it Regards

http://stackoverflow.com/q/26713082
has comment: http://stackoverflow.com/comment/42017573
has title: why I have refused the connection of db
tagged with: java
has answer: http://stackoverflow.com/a/69085602
has comment: http://stackoverflow.com/comment/42021481
type: Question
has comment: http://stackoverflow.com/comment/42022187
linked to: http://stackoverflow.com/q/6795580
has body: I have web application. And I have jdbc database pooling system. If my minIdle and initialSize value are 50, I have the following error: [ WARN] [http-nio-8080-exec-25 03:11:33] (SqlExceptionHelper.java:logExceptions:144) SQL Error: 12519, SQLState: 66000 [ERROR] [http-nio-8080-exec-25 03:11:33] (SqlExceptionHelper.java:logExceptions:146) Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found might be this is because I should configure XE oracle to get many connections. I do something like this: ALTER SYSTEM SET processes=10000 scope=spfile But this did not help me. Also: SQL&gt; connect Enter user-name: system Enter password: Connected. SQL&gt; select count(*) from v$process; COUNT(*) ---------- 44 SQL&gt; show parameter processes; NAME TYPE VALUE ------------------------------------ ----------- ----------------------- aq_tm_processes integer 0 db_writer_processes integer 1 gcs_server_processes integer 0 global_txn_processes integer 1 job_queue_processes integer 4 log_archive_max_processes integer 4 processes integer 100 SQL&gt; I have windows 7 x64. and this is Oracle Express edition.
score: 0
has comment: http://stackoverflow.com/comment/42017208
tagged with: jdbc-pool
tagged with: apache-commons-dbcp
answer count: 1
has comment: http://stackoverflow.com/comment/42021991
has comment: http://stackoverflow.com/comment/42021708
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42020367
type: UnansweredQuestion
tagged with: oracle-database

http://stackoverflow.com/comment/42400057
type: Comment
comment on: http://stackoverflow.com/q/26782802
score: 0
type: QuestionComment
has text: Any news about the code ?

http://stackoverflow.com/comment/42194240
type: AnswerComment
comment on: http://stackoverflow.com/a/26724804
type: Comment
has text: @bestsss You're right, the example is weak but I couldn't think of anything better. It doesn't really affect the main point though.
score: 0

http://stackoverflow.com/comment/42042281
comment on: http://stackoverflow.com/q/26726615
score: 0
type: QuestionComment
type: Comment
has text: Regarding your error -- please show more code, describe more context, show the whole error message. Let's get full information so we can better be able to help.

http://stackoverflow.com/q/26702089
has body: I have a typical NullPointerException: Exception in thread "Thread-0" java.lang.NullPointerException at com.game.main.SpriteSheet.grabImage(SpriteSheet.java:17) at com.game.main.Textures.getTextures(Textures.java:30) at com.game.main.Textures.&lt;init&gt;(Textures.java:21) at com.game.main.Game.init(Game.java:80) at com.game.main.Game.run(Game.java:116) at java.lang.Thread.run(Thread.java:745) and I'm pretty sure I know where the null is, I think it's this method (Also this is getImage method loads in whichever grid you want in the spritesheet.png image I created) public BufferedImage grabImage(int column, int row, int width, int height){ System.out.println("img is " + image); //&lt;&lt;&lt;&lt; How I tested for null.. May not be the best way, but image said to be null BufferedImage img = image.getSubimage((column * 32) - 32, (row * 32) - 32, width, height); return img; } I've looked at around about everything in this class, this is the class: SpiteSheet.class package com.game.main; import java.awt.image.BufferedImage; public class SpriteSheet { private BufferedImage image; public SpriteSheet(BufferedImage image){ this.image = image; System.out.println("img is " + this.image); // &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; THIS ONE SHOWS "img is nullException in thread "Thread-0" " in the console } public BufferedImage grabImage(int column, int row, int width, int height){ System.out.println("img is " + image); //&lt;&lt;&lt;&lt; How I tested for null.. May not be the best way, but image said to be null BufferedImage img = image.getSubimage((column * 32) - 32, (row * 32) - 32, width, height); return img; } } And i was wondering how I would be able to initiate it? Although I'm guessing it already is as image.getSubimage(code), I tested this.image and it says that, that is the NullPointerException... But it should be already initiated. Some more classes which may be involved Textures.class package com.game.main; import java.awt.image.BufferedImage; public class Textures { pu…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41998693
has title: Why this doesn't appear to be initialized
has comment: http://stackoverflow.com/comment/41998638
has answer: http://stackoverflow.com/a/26702620
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41998668
type: Question
has comment: http://stackoverflow.com/comment/41998784
has comment: http://stackoverflow.com/comment/41998435
score: 0
tagged with: error-handling
has comment: http://stackoverflow.com/comment/41998404
tagged with: bufferedimage
answer count: 1
accepted answer: http://stackoverflow.com/a/26702620
has comment: http://stackoverflow.com/comment/41998341
tagged with: java
has comment: http://stackoverflow.com/comment/41998470

http://stackoverflow.com/comment/42141693
type: QuestionComment
comment on: http://stackoverflow.com/q/26774051
has text: void getUserInput(); void printQualifiedUserName(); int main() { // calling function to get user input getUserInput(); if(userNameLength<1) printf("Your Username do not contain even a single Qualified character in it. Shame on you! \:\)\n"); else printQualifiedUserName(); printf("\n"); return 0; } void getUserInput(){ char c; printf("Enter Username (only alphaNumeric): "); int i = 0;
score: 0
type: Comment

http://stackoverflow.com/a/26761088
downvote count: 0
has body: No there is not, you need to manually set up collision boundaries.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26760829
score: 2

http://stackoverflow.com/a/26757966
answers question: http://stackoverflow.com/q/26757814
has comment: http://stackoverflow.com/comment/42097697
score: -1
has body: When function A calls function B. Press CTRL, then use mouse to left-click on the called-function B, then the cursor would move to the definition of function B. By the same continuous way, you can get deeper and deeper, at last to the final function being called.
downvote count: 2
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42150472
type: QuestionComment
comment on: http://stackoverflow.com/q/26771285
has text: I wasn't sure how findHomography should work, thank you for clearing that up for me! What are the exact inputs I need and how should they be correlated for findHomography to work and find a correct transformation matrix?
score: 0
type: Comment

http://stackoverflow.com/comment/42136623
comment on: http://stackoverflow.com/q/26777941
score: 0
type: QuestionComment
type: Comment
has text: If you have layout name and portlet name with its position then you can get it from typeSettings of layout

http://stackoverflow.com/comment/42291121
comment on: http://stackoverflow.com/a/26811313
type: AnswerComment
has text: I don't know the reason? It should give 2 values not 1.
score: 0
type: Comment

http://stackoverflow.com/a/26742925
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/42071672
has comment: http://stackoverflow.com/comment/42072484
score: 3
accepted answer of: http://stackoverflow.com/q/26742850
answers question: http://stackoverflow.com/q/26742850
has comment: http://stackoverflow.com/comment/42072452
has body: You have not overriden equals, you have instead created a new equals method with a different signature. If you change public boolean equals(MyObject otherObject) { to public boolean equals(Object otherObject) { (and add appropriate casts), your code will work as expected. You could have easily avoided that mistake by using the @Override annotation, which would have lead to a compilation error.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42071754

http://stackoverflow.com/a/26797735
upvote count: 230
has comment: http://stackoverflow.com/comment/86175957
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/59177473
has comment: http://stackoverflow.com/comment/51810799
has comment: http://stackoverflow.com/comment/63224306
has comment: http://stackoverflow.com/comment/84688267
score: 228
has body: Add: build.gradle in your root project folder, and use plugin for example: apply plugin: 'idea' //and standard one apply plugin: 'java' and with this fire from command line: gradle cleanIdea and after that: gradle idea After that everything should work
accepted answer of: http://stackoverflow.com/q/26745541
has comment: http://stackoverflow.com/comment/112634311
answers question: http://stackoverflow.com/q/26745541
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/58672241

http://stackoverflow.com/q/26800090
has title: How to use gridgain with two nodes where each node on its own different host
answer count: 1
has body: Can anyone help me in guiding to use grid gain, The documentation on website is not enough and confusing. We have to run thousands of simulations in the LAN. can anyone help me in running compute grid on multiple hosts in a LAN. I am able to run compute example on multiple nodes on same host, but not on multiple nodes on multiple hosts. Kindly help.
tagged with: gridgain
accepted answer: http://stackoverflow.com/a/26809201
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26809201
score: 0

http://stackoverflow.com/comment/42228940
type: Comment
has text: Post your code how you are setting your list adapter
type: QuestionComment
comment on: http://stackoverflow.com/q/26831043
score: 0

http://stackoverflow.com/q/26758347
favorite count: 0
has comment: http://stackoverflow.com/comment/42098248
has comment: http://stackoverflow.com/comment/42098193
has comment: http://stackoverflow.com/comment/42098235
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42098263
has answer: http://stackoverflow.com/a/26758477
has title: Can someone try to understand my feedback with my java code?
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26758418
type: Question
has body: my Java code isn't quite completed as it should be and this is the feedback that I received but I don't understand it, what do I need to do? In using the printf statement, you need to explicitly include the printing of a new line at the end of the text that is printed. As you do not do this the next line you output which contains a # character will be excluded from the comparison. class Main { public static void main( String args[] ) { System.out.print("#Please enter the student number : "); int studentNumber = BIO.getInt(); while(studentNumber &gt; 0) { System.out.print("#Please enter the coursework mark : "); int courseWork = BIO.getInt(); System.out.print("#Please enter the exam mark : "); int examMark = BIO.getInt(); double average = (double)(courseWork + examMark) / 2; System.out.printf("sn = " + studentNumber + " ex = " + examMark + " cw = " + courseWork + " mark = " + average); System.out.print("#Please enter the student number : "); studentNumber = BIO.getInt(); } System.out.print("#End of data"); } } Thanks for your help.
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/42098314

http://stackoverflow.com/a/26682284
has body: Please don't use Raw Types. You could iterate the List and call Map.get() with something like List&lt;HashMap&lt;String,String&gt;&gt; avaliacaoList; for (HashMap&lt;String,String&gt; map : avaliacaoList) { System.out.println(map.get("id_grade_curricular")); }
score: 1
answers question: http://stackoverflow.com/q/26682197
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42066294
comment on: http://stackoverflow.com/q/26739948
score: 0
type: Comment
type: QuestionComment
has text: Oh ok. Well I am noticing a few things that might point you in the right direction (hopefully), your service isn't inheriting from IntentService but from the regular service class. And your service starting code is very complicated, why not just startService(new Intent(this, CaptureService.class));

http://stackoverflow.com/q/26821638
tagged with: swing
has comment: http://stackoverflow.com/comment/42212772
has body: I have the following class extending JPanel (which currently doesn't make much sense from where it's being called to repaint, so ignore that. I'll be happy with it it painting anything for the meantime): public class GamePanel extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawCounter(g); } private void drawCounter(Graphics g) { g.drawRect(100,80,70,40); g.drawString("Dia Dhuit", 105, 100); } } Here's the relevant code in the main class: public class AUIApplet3 extends JApplet { GamePanel gamePan; public void scheduleNumbers(int[] randomNumbers, int speed, int amount) { long initialDelay = INITIAL_DELAY; final AtomicInteger curNumber = new AtomicInteger(-1); System.out.println(getNumbersAsString()); final Runnable setNumber = () -&gt; { currentNumberLab.setText(Integer.toString(randomNumbers[curNumber.incrementAndGet()])); System.out.println(randomNumbers[curNumber.get()]); gamePan.repaint(); }; setNumberService = scheduler.scheduleAtFixedRate(setNumber, initialDelay, speed, MILLISECONDS); endNumberService = scheduler.schedule(() -&gt; { currentNumberLab.setText(""); answerField.setEditable(true); checkAnswerBut.setEnabled(true); gameStatus = GameStatusEnum.WAITING; System.out.println("Finished in scheduleNumbers() lambda"); setNumberService.cancel(true); }, ((speed * amount)+ initialDelay), MILLISECONDS); } } Here's the entire code for the AUIApplet3 and GamePanel classes. Where I'm calling repaint() in the Runnable lambda inside scheduleNumbers(), I'd like to paint something each time to the gamePan JPanel. And then eventually expand on GamePanel's paintComponent() so that what's being painted is updated with different values each time as well as being able to paint images whenever a game is won or lost by the user. As of right now, the code doesn't paint anything. I'm not entirely sure I'm implementing GamePanel correctly. Edit (Updated code): Is now printing but is displaying on the wrong panel despite repaint() b…
type: Question
has comment: http://stackoverflow.com/comment/42212710
has comment: http://stackoverflow.com/comment/42213380
has comment: http://stackoverflow.com/comment/42212975
score: 0
tagged with: applet
has title: Java: Trying to repaint paintComponent() in JApplet
has comment: http://stackoverflow.com/comment/42213531
has comment: http://stackoverflow.com/comment/42212946
has comment: http://stackoverflow.com/comment/42212775
type: UnansweredQuestion
tagged with: java-8
has comment: http://stackoverflow.com/comment/42213810
tagged with: paint
answer count: 0
tagged with: java

http://stackoverflow.com/comment/42212426
has text: @ProgrammingNewb - If this solve your problem, then accept as answer to help community. Happy coding!
score: 0
comment on: http://stackoverflow.com/q/26820900
type: Comment
type: QuestionComment

header
type: Tag
tags question: http://stackoverflow.com/q/26719838
tag name: header

http://stackoverflow.com/a/26793263
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42193570
type: Answer
answers question: http://stackoverflow.com/q/26791829
score: 1
accepted answer of: http://stackoverflow.com/q/26791829
has comment: http://stackoverflow.com/comment/42163421
downvote count: 0
has body: well ActivityNotFoundException that mean you have not declare this activity in AndroidManifest file.you need to declare all activities in manifest file error exactly says you the problem find explicit activity class {com.example.coffeeshop/com.example.coffeeshop.Login}; have you declared this activity in your AndroidManifest.xml? add this line to manifest file finaly manifest should looks like// example <?xml version="1.0" encoding="utf-8"?>
upvote count: 1

http://stackoverflow.com/a/26768226
has comment: http://stackoverflow.com/comment/42117363
accepted answer of: http://stackoverflow.com/q/26768122
type: Answer
answers question: http://stackoverflow.com/q/26768122
upvote count: 1
has body: Since PlacardHolder is an array of Objects (Strings), every entry is initialized with null. Before iterating through the array, you should assign each arrayelement an actual Object. EDIT Minor detail: if an entry in an array is null, you cannot call any methods from this element, so PlacardHolder[i].equals(...) generates the exception.
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/26713537
has body: you must add lib for this class.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26711096
downvote count: 0
has comment: http://stackoverflow.com/comment/42018189
has comment: http://stackoverflow.com/comment/42018320
type: Answer
has comment: http://stackoverflow.com/comment/42018754

http://stackoverflow.com/a/26780902
score: 1
answers question: http://stackoverflow.com/q/26768810
type: AcceptedAnswer
has body: Okay so my resolution to the issue was two fold: 1 (THE MOST CRITICAL): I keep forgetting to remember that in order to scale a control, the size must be relatively static: that is, DO NOT SET THE MAX WIDTH/HEIGHT TO LARGE NUMBERS. Also, do NOT allow the control to grow vertically or horizontally. That is my first (and most common and frustrating mistake). 2: Bind the scaleX and scaleY properties: This comes from my relatively recent ramp-up on property knowledge. There are many ways to accomplish the scale method but this feels the cleanest to me. this.Message.scaleXProperty().bind(Bindings.createDoubleBinding(() -&gt; { return (this.getWidth() - 40.0) / this.Message.getWidth(); }, this.widthProperty()) ); this.Message.scaleYProperty().bind(Bindings.createDoubleBinding(() -&gt; { return (this.getHeight() - 40.0) / this.Message.getHeight(); }, this.heightProperty())); So in review: 1: Control to be scaled must be static in size. 2: Bind control scaleX and scaleY properties. phew.
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26768810
downvote count: 0

http://stackoverflow.com/a/26809677
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26789739
answers question: http://stackoverflow.com/q/26789739
type: Answer
has body: Solved problem by looping reading and writing : int countWritten=0; while (countWritten &lt; buffSize) { countWritten+=socketChannel.write(sendBB); }

http://stackoverflow.com/a/26775402
upvote count: 3
has comment: http://stackoverflow.com/comment/42129500
answers question: http://stackoverflow.com/q/26775346
downvote count: 0
has comment: http://stackoverflow.com/comment/42129811
type: Answer
has body: Tried h:outputText ? With no camelcase? http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_outputText.html
score: 3

http://stackoverflow.com/comment/64291068
has text: Can you expand your answer to include an explanation of why this is helpful to the OP's requirements?
type: Comment
comment on: http://stackoverflow.com/a/38442737
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42195430
comment on: http://stackoverflow.com/a/26810999
type: AnswerComment
score: 0
type: Comment
has text: Jeff I have an image as a background of my Activity :(

http://stackoverflow.com/comment/42166065
score: 4
has text: Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26795934

http://stackoverflow.com/comment/42101174
score: 2
comment on: http://stackoverflow.com/q/26759954
has text: If your program never adds null values, why should you check?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26779198
tagged with: java
has comment: http://stackoverflow.com/comment/78556015
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42136880
tagged with: pdfrenderer
score: 0
linked to: http://stackoverflow.com/q/11613505
tagged with: android
type: UnansweredQuestion
has title: Opening pdf of sd card in webview
linked to: http://stackoverflow.com/q/9434487
tagged with: webview
has body: i am trying to load pdf in webview from my sdcard but it gives message "Sorry, we were unable to find the document at the original source. Verify that the document still exists!" i also googled this but after banging my head a lot i got nothing than this one and this one ... webView = (WebView) findViewById(R.id.webview_compontent); fill_form = (Button) findViewById(R.id.fill_form); fill_form.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "In Progress", Toast.LENGTH_LONG).show(); } }); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); // webView.getSettings().setUseWideViewPort(true); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { progDailog.show(); view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, final String url) { progDailog.dismiss(); } }); // String fileurl = Environment.getExternalStorageDirectory()+File.separator +"pk.pdf"; File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"pk.pdf"); Uri fileurl = (Uri.fromFile(file)); String Url = "http://docs.google.com/gview?embedded=true&amp;url=" + fileurl; webView.loadUrl(Url); } Please give any idea how to do this ?(I don't want to use any payable rendering library.)
has answer: http://stackoverflow.com/a/26779420
linked to: http://stackoverflow.com/q/9926746

http://stackoverflow.com/q/26798718
type: Question
has body: I have just read that characters(char[] ch, int start, int length) can get called multiple times for one inner XML data (e.g. John Smith ). In my project I have to parse big XML file (1.5 GB) and put it in the database, so I cant just manually go through the database and the file to see if everything is OK. So my question is is it safe to do something like this: public void characters(char[] ch, int start, int length) throws SAXException { dataForDatabase = new String(ch,start,length); } Where dataForDatabase is this parser's class member. and after that in endElement... public void endElement(String uri, String localName, String qname) throws SAXException { putDataToDatabase(dataForDatabase); } Won't dataForDatabase get overridden if characters() method gets called multiple times? Thanks in advance!
tagged with: saxparser
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26798809
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: DefaultHandler characters() method behavior
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/a/45986747
has body: The first base 64 contains only the key Base64.encodeBase64String(publicKey.getEncoded()) The second base 64 contains the whole public certificate Base64.encodeBase64String(cert.getEncoded())
downvote count: 0
answers question: http://stackoverflow.com/q/26711731
type: Answer
upvote count: 6
score: 6

http://stackoverflow.com/comment/42027474
score: 1
type: QuestionComment
type: Comment
has text: Try it from the command line if on linux to get more verbose output when an error happens.
comment on: http://stackoverflow.com/q/26715354

http://stackoverflow.com/comment/42000786
comment on: http://stackoverflow.com/a/26703495
type: AnswerComment
score: 0
type: Comment
has text: You don't need it, the URL is defined by convention, but you need a controller.

http://stackoverflow.com/q/26757142
tagged with: merge
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has body: I would like to merge sorted partitions locally (on driver). I did .mapPartitionsToPair() on my data which created Iterable&lt;Tuple2&lt;D,X&gt;&gt; where D is a type that has ordering (lets say some kind of date), and X is a type with some merging rules. The result is ordered by D uniquely. I need my final result as the reduction of these partitions, also be ordered by D uniquely. Is there any local reduction that counts on the input to be ordered by key? Can I use any other approach to reach my goal? I'm using Spark 1.1.0.
has title: Spark: Merge sorted partitions
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26767209
answer count: 1
upvote count: 3
tagged with: apache-spark

http://stackoverflow.com/a/26684851
has body: You can proceed in a much simpler way. The 3 valid cases are very similar and can be treated as one, the game can be started only once after the loop because we know that once the loop exits, level has a valid value. boolean valid = false; int level; do { try { level = scan.nextInt(); valid = 1 &lt;= level &amp;&amp; level &lt;= 3; if (valid) { System.out.println(String.format("You selected level %d !",level)); } else { System.out.println("That's not an option!"); } } catch(InputMismatchException input) { scan.next(); System.out.println("That's not an option!"); } } while (!valid); // start the game
type: Answer
answers question: http://stackoverflow.com/q/26684729
score: 0

http://stackoverflow.com/a/26695215
upvote count: 3
answers question: http://stackoverflow.com/q/26695184
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26695184
type: Answer
score: 3
has body: Because you define fields as static. Static fields belong to class not to objects. In order objects to have their own fields you should not use static keyword. When you create a new Edge object, you overwrite these static fields with new values. private static int weight; private static Vertex A; private static Vertex B; Change as below. private int weight; private Vertex A; private Vertex B;

http://stackoverflow.com/a/26800124
answers question: http://stackoverflow.com/q/26800016
has comment: http://stackoverflow.com/comment/42174339
downvote count: 1
has body: Here you are passing a class name MyCrawler as a parameter. controller.start(MyCrawler, numberOfCrawlers); I think class name should not be a parameter. I am also working little bit on Crawling!
has comment: http://stackoverflow.com/comment/42174059
upvote count: 0
has comment: http://stackoverflow.com/comment/42174685
score: -1
has comment: http://stackoverflow.com/comment/42174576
has comment: http://stackoverflow.com/comment/42173981
has comment: http://stackoverflow.com/comment/42174147
type: Answer
has comment: http://stackoverflow.com/comment/42175085
has comment: http://stackoverflow.com/comment/42174188

http://stackoverflow.com/a/26767693
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26767692
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26767692
score: 2
has body: According to the Google Documentation there is supposed to be at least one default module: The default module Every application must have a single default module. To define the default module, include the setting default in the module's appengine-web.xml file, or leave the setting out. Also be sure to list the default module as the first module in the EAR directory's META-INF/application.xml file, as shown in the example below. source: https://cloud.google.com/appengine/docs/java/modules/ However, both modules have an &lt;application&gt; tag in their appengine-web.xml file. The solution I found to work is to remove the tag from one of the appengine-web.xml files.

http://stackoverflow.com/a/26708423
answers question: http://stackoverflow.com/q/26707676
accepted answer of: http://stackoverflow.com/q/26707676
has comment: http://stackoverflow.com/comment/42024310
has comment: http://stackoverflow.com/comment/42023209
score: 0
has body: This happens due to presence of bad records. Your map is expecting an input like the following : Matrix:Reeves,5 But the input file somewhere contains a record without both these characters : &amp; ,. An empty line may be the culprit. All you need is length checks for the splits arrays. Instead of access indices directly, put them inside a validation block. eg : String [] fields = line1.split(":"); if( fields.length&gt;1 ){ String Movieid = fields[0]; String line2 = fields[1]; } else { // initialize Movieid &amp; line2 tosome default value // OR simply put a 'return' statement to skip bad inputs } Same strategy has to be followed for the splitline array. I think you don't need codes for that. Again don't use StringTokenizer, it's still in existence due to legacy reasons.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41955390
type: Comment
has text: You leave poor Bertrand Russel and the (unrelated teapot) alone :-). I really see both sides of this, have a look at http://stackoverflow.com/questions/299068/how-slow-are-java-exceptions . It is possible that there is measurable difference but as we progress with Java versions, this is increasingly unlikely.
comment on: http://stackoverflow.com/a/26676595
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42144296
score: 0
has text: if you could provide me with a simple solution, I would greatly appreciate it.
comment on: http://stackoverflow.com/a/26774838
type: AnswerComment
type: Comment

http://stackoverflow.com/a/57586956
upvote count: 2
answers question: http://stackoverflow.com/q/26829424
type: Answer
score: 2
downvote count: 0
has body: When using maven, for Apache POI, make sure to add all the latest dependencies related to Apache POI as follows: org.apache.poi poi 4.1.0 org.apache.poi poi-ooxml 4.1.0 org.apache.xmlbeans xmlbeans 3.1.0 org.apache.poi poi-scratchpad 4.1.0 Save and run. Errors should be resolved.

http://stackoverflow.com/q/26821099
score: 0
has body: Below code is blocking my UI , I have checked other posts and this seems to be a correct implementation , Please let me know what I am doing wrong here: public class RecordTest { public static boolean stopFlag=false; public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell (display); Label label = new Label (shell, SWT.NONE); label.setText ("Enter your URL:"); final Text text = new Text (shell, SWT.BORDER); text.setLayoutData (new RowData (100, SWT.DEFAULT)); Button ok = new Button (shell, SWT.PUSH); ok.setText ("Start Record"); Thread updateThread = new Thread() { public void run() { Display.getDefault().asyncExec(new Recorder(stopFlag)); } }; // background thread updateThread.setDaemon(true); updateThread.start(); ok.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Start Record"); } }); Button cancel = new Button (shell, SWT.PUSH); cancel.setText ("Stop Recording"); cancel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Stop Recording"); stopFlag=true; } }); shell.setDefaultButton (cancel); shell.setLayout (new RowLayout ()); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } } ------------------------------------Recorder.java----------------------------------------- public class Recorder implements Runnable { private boolean stopFlag = false; public Recorder(boolean stopFlag) { this.stopFlag = stopFlag; } @Override public void run() { for (int i = 0; i &lt; 10; i++) { try { System.out.println("Waiting ...."); Thread.sleep(3000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
answer count: 1
tagged with: swt-awt
has answer: http://stackoverflow.com/a/26821177
type: AnsweredQuestion
tagged with: multithreading
tagged with: swt
accepted answer: http://stackoverflow.com/a/26821177
type: Question
tagged with: java
has title: SWT background thread blocking the GUI

http://stackoverflow.com/a/26826594
type: Answer
has comment: http://stackoverflow.com/comment/42245744
has comment: http://stackoverflow.com/comment/42245845
answers question: http://stackoverflow.com/q/26826579
score: 9
upvote count: 9
has body: It should be changed to an interface in Java 8 correct? Not unless you want to break all backwards compatibility, no. If you changed it to an interface, then anything written as: public class Foo extends Observable would be broken. I suspect it may well also be invalid in terms of binary compatibility too, but just source incompatibility would be enough to make it a no-go change, IMO. Likewise: It's currently a concrete class, not an abstract class... so new Observable() is currently valid but wouldn't be as an interface As you say yourself in another answer, the default implementation uses state... so it can't be implemented by interface default methods
downvote count: 0
has comment: http://stackoverflow.com/comment/42245981

classloader
tags question: http://stackoverflow.com/q/26736799
tags question: http://stackoverflow.com/q/26801268
tags question: http://stackoverflow.com/q/26721345
tags question: http://stackoverflow.com/q/26707515
tags question: http://stackoverflow.com/q/26695256
tags question: http://stackoverflow.com/q/26709026
tags question: http://stackoverflow.com/q/26793116
tags question: http://stackoverflow.com/q/26683724
tags question: http://stackoverflow.com/q/26730541
tags question: http://stackoverflow.com/q/26761553
tags question: http://stackoverflow.com/q/26701928
tags question: http://stackoverflow.com/q/26723277
tags question: http://stackoverflow.com/q/26765109
tags question: http://stackoverflow.com/q/26803622
type: Tag
tags question: http://stackoverflow.com/q/26778692
tags question: http://stackoverflow.com/q/26798131
tags question: http://stackoverflow.com/q/26748246
tags question: http://stackoverflow.com/q/26691959
tags question: http://stackoverflow.com/q/26807346
tag name: classloader
tags question: http://stackoverflow.com/q/26703274

http://stackoverflow.com/a/26799263
type: Answer
has comment: http://stackoverflow.com/comment/42172442
has body: Try this: bar.setBackgroundColor(Color.parseColor("#00C4CD"));
score: 0
answers question: http://stackoverflow.com/q/26799171

inheritance
tags question: http://stackoverflow.com/q/26733439
tags question: http://stackoverflow.com/q/26739200
tags question: http://stackoverflow.com/q/26769207
tags question: http://stackoverflow.com/q/26697347
tags question: http://stackoverflow.com/q/26822618
tags question: http://stackoverflow.com/q/26811548
tags question: http://stackoverflow.com/q/26782442
tag name: inheritance
tags question: http://stackoverflow.com/q/26689833
tags question: http://stackoverflow.com/q/26740746
tags question: http://stackoverflow.com/q/26690847
tags question: http://stackoverflow.com/q/26741526
tags question: http://stackoverflow.com/q/26722212
type: Tag
tags question: http://stackoverflow.com/q/26827244
tags question: http://stackoverflow.com/q/26691076
tags question: http://stackoverflow.com/q/26804592
tags question: http://stackoverflow.com/q/26731794
tags question: http://stackoverflow.com/q/26821736
tags question: http://stackoverflow.com/q/26793568
tags question: http://stackoverflow.com/q/26811401
tags question: http://stackoverflow.com/q/26825846
tags question: http://stackoverflow.com/q/26709320
tags question: http://stackoverflow.com/q/26702340
tags question: http://stackoverflow.com/q/26676169
tags question: http://stackoverflow.com/q/26719473
tags question: http://stackoverflow.com/q/26701005

http://stackoverflow.com/q/26776855
has comment: http://stackoverflow.com/comment/42133859
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42136127
favorite count: 0
has comment: http://stackoverflow.com/comment/42134857
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/27714914
tagged with: android
has answer: http://stackoverflow.com/a/29561900
tagged with: proguard
has title: Android Proguard: How to set up in Eclipse?
score: 1
has comment: http://stackoverflow.com/comment/42136731
upvote count: 1
linked to: http://stackoverflow.com/q/3417122
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42137670
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42135363
has comment: http://stackoverflow.com/comment/42136585
has body: I am trying to set up ProGuard for a standard "Hello World" application in Eclipse. I have taken the step of uncommenting the line in project.properties, However Proguard is not enabled. What is wrong with my code / what am I missing? Code is shown below, note that I have named the application Proguard. Project.properties: # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # #To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-20 android.library.reference.1=../appcompat_v7 proguard-project.txt: # To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #}

http://stackoverflow.com/a/26677832
has body: The problem is that the NuoDB JDBC jar is not in your classpath. The NuoDB documentation states that it is located under the directory where NuoDB is install, under a subdirectory named jar. You must either add that location to your web application class path (assuming your tomcat is on the same machine as your database), or copy the jar over to where tomcat will be able to find it, together with all the other jars you are using.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26676951
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26676951

http://stackoverflow.com/a/26786713
upvote count: 3
has body: Make sure to specify character encoding when reading the file, in order to avoid using the platform's default encoding, which varies between operating systems. Just by coincidence, the default on Linux and Mac happens to match the file encoding and produces correct output, but you should not rely on it.
answers question: http://stackoverflow.com/q/26783723
score: 3
accepted answer of: http://stackoverflow.com/q/26783723
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26798154
tagged with: annotations
tagged with: java-8
downvote count: 0
tagged with: java
has body: How can i Run Annotation Processor without compiling sources using javac (Java 8 can't use Apt)? Is there any parameter for javac that could run only annotation processing without compiling all files? What i want to do by javac: Just find annotated elements and process them using defined annotation processor using -processor flag do not compile any source that doesn't have any annotation Because i want do this on Java 8 it's impossible to use Apt for this task? Or maybe it is?
has title: How to Run Annotation Processor without compiling sources using javac (Java 8 can't use Apt)
has comment: http://stackoverflow.com/comment/42171950
type: Question
score: 5
tagged with: annotation-processing
has answer: http://stackoverflow.com/a/26799553
has comment: http://stackoverflow.com/comment/42172361
tagged with: javac
answer count: 1
has comment: http://stackoverflow.com/comment/42172605
favorite count: 0
upvote count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/42095863
comment on: http://stackoverflow.com/q/26756513
score: 0
type: Comment
type: QuestionComment
has text: So if there is possibility of running out of memory JVM calls Garbage Collector is it? but what if that object keeps on allocating. ?

http://stackoverflow.com/a/26799219
downvote count: 0
type: Answer
has body: To remove the node you need to use the parent node not the document. Replace : XMLbook.removeChild(toRemoveString); by : subChapterNode.removeChild(toRemoveString);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26798838

http://stackoverflow.com/q/26747132
favorite count: 0
has title: Luhn's algorithm
has answer: http://stackoverflow.com/a/26747298
has comment: http://stackoverflow.com/comment/42079304
has body: a) Starting with the check digit and moving left, compute the sum of all the decoded digits. b) Compute the remainder of the sum using integer division by 10. If the result is not zero, the credit card number is invalid. Otherwise, the card number is likely to be valid. Here are two examples: Card number: 2315778 Card number 1234567 decode(8, false) = 8 decode(7, false) = 7 decode(7, true) = 5 decode(6, true) = 3 decode(7, false) = 7 decode(5, false) = 5 decode(5, true) = 1 decode(4, true) = 8 decode(1, false) = 1 decode(3, false) = 3 decode(3, true) = 6 decode(2, true) = 4 decode(2, false) = 2 decode(1, false) = 1 Sum = 30 Sum = 31 30 mod 10 = 0 31 mod 10 = 1 This number may be valid This number is invalid Write a static method called checkDigits that is passed a seven-digit credit card number and that performs the steps described above. Reuse the decode method that you wrote in Lab 5.5.1. The method should return the word “valid” if the number passes the test and “invalid” otherwise. import java.util.Scanner; public class JavaApplication90 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = 2315778; System.out.println("Credit card number: " + num + " is " + checkDigits(num)); num = 1234567; System.out.println("Credit card number: " + num + " is " + checkDigits(num)); num = 7654321; System.out.println("Credit card number: " + num + " is " + checkDigits(num)); num = 1111111; System.out.println("Credit card number: " + num + " is " + checkDigits(num)); } public static boolean checkDigits(int num) { int sum = 0; String reverse = new StringBuffer(num).reverse().toString(); for (int i = 0; i &lt; reverse.length(); i++){ int product = 0; if (i % 2 == 0) { product = num * 2; } if (product &lt; 9) product = (product%10)-1; sum = sum+ product ; } return (sum % 10 == 0); } } Output: I am getting true/valid answer for all numbers. I am not able to find my error. Help!
has comment: http://stackoverflow.com/comment/42079438
has comment: http://stackoverflow.com/comment/42079658
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42084082
tagged with: java
has comment: http://stackoverflow.com/comment/42079590
has comment: http://stackoverflow.com/comment/42079376
upvote count: 1
tagged with: methods
accepted answer: http://stackoverflow.com/a/26747298
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/20740444
has comment: http://stackoverflow.com/comment/42079522
duplicate of: http://stackoverflow.com/q/20740444
has comment: http://stackoverflow.com/comment/42079472
score: 0
tagged with: luhn
answer count: 1

http://stackoverflow.com/q/26775696
has body: I'm new to Hadoop, so I have some doubts what to do in the next case. I have an algorithm that includes multiple runs of different jobs and sometimes multiple runs of a single job (in a loop). How should I achieve this, using Oozie, or using Java code? I was looking through Mahout code and in ClusterIterator function function found this: public static void iterateMR(Configuration conf, Path inPath, Path priorPath, Path outPath, int numIterations) throws IOException, InterruptedException, ClassNotFoundException { ClusteringPolicy policy = ClusterClassifier.readPolicy(priorPath); Path clustersOut = null; int iteration = 1; while (iteration &lt;= numIterations) { conf.set(PRIOR_PATH_KEY, priorPath.toString()); String jobName = "Cluster Iterator running iteration " + iteration + " over priorPath: " + priorPath; Job job = new Job(conf, jobName); job.setMapOutputKeyClass(IntWritable.class); job.setMapOutputValueClass(ClusterWritable.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(ClusterWritable.class); job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setMapperClass(CIMapper.class); job.setReducerClass(CIReducer.class); FileInputFormat.addInputPath(job, inPath); clustersOut = new Path(outPath, Cluster.CLUSTERS_DIR + iteration); priorPath = clustersOut; FileOutputFormat.setOutputPath(job, clustersOut); job.setJarByClass(ClusterIterator.class); if (!job.waitForCompletion(true)) { throw new InterruptedException("Cluster Iteration " + iteration + " failed processing " + priorPath); } ClusterClassifier.writePolicy(policy, clustersOut); FileSystem fs = FileSystem.get(outPath.toUri(), conf); iteration++; if (isConverged(clustersOut, conf, fs)) { break; } } Path finalClustersIn = new Path(outPath, Cluster.CLUSTERS_DIR + (iteration - 1) + Cluster.FINAL_ITERATION_SUFFIX); FileSystem.get(clustersOut.toUri(), conf).rename(clustersOut, finalClustersIn); } So, they have a loop in which they r…
tagged with: hadoop
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26776696
tagged with: oozie
tagged with: mahout
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26776696
type: Question
has title: Java code or Oozie

http://stackoverflow.com/q/26799398
type: Question
tagged with: apache-kafka
has body: The application throws a java.lang.NoSuchMethodException Stacktrace DAGScheduler: Failed to run runJob at ReceiverTracker.scala:275 Exception in thread "Thread-33" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 6.0 failed 4 times, most recent failure: Lost task 0.3 in stage 6.0 (TID 77, 172.20.7.60): java.lang.NoSuchMethodException: org.apache.spark.examples.streaming.KafkaKeyDecoder.&lt;init&gt;(kafka.utils.VerifiableProperties) java.lang.Class.getConstructor0(Class.java:2810) java.lang.Class.getConstructor(Class.java:1718) org.apache.spark.streaming.kafka.KafkaReceiver.onStart(KafkaInputDStream.scala:106) org.apache.spark.streaming.receiver.ReceiverSupervisor.startReceiver(ReceiverSupervisor.scala:121) org.apache.spark.streaming.receiver.ReceiverSupervisor.start(ReceiverSupervisor.scala:106) org.apache.spark.streaming.scheduler.ReceiverTracker$ReceiverLauncher$$anonfun$9.apply(ReceiverTracker.scala:264) org.apache.spark.streaming.scheduler.ReceiverTracker$ReceiverLauncher$$anonfun$9.apply(ReceiverTracker.scala:257) org.apache.spark.SparkContext$$anonfun$runJob$4.apply(SparkContext.scala:1121) org.apache.spark.SparkContext$$anonfun$runJob$4.apply(SparkContext.scala:1121) org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:62) org.apache.spark.scheduler.Task.run(Task.scala:54) org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:177) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:745) Seems issue has already been fixed in spark 1.1.0 as per this Link Spark : 1.1.0 Kafka : 0.8.1.1
has answer: http://stackoverflow.com/a/27383401
has comment: http://stackoverflow.com/comment/42172677
answer count: 2
tagged with: apache-spark
downvote count: 0
has title: Exception while starting java spark-streaming application
favorite count: 0
tagged with: spark-streaming
has comment: http://stackoverflow.com/comment/47037671
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29510134
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26772689
upvote count: 5
has body: How do you handle error condition while writing stored procedure or accessing stored procedure from java?
has answer: http://stackoverflow.com/a/26772800
has answer: http://stackoverflow.com/a/54355493
accepted answer: http://stackoverflow.com/a/26772800
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/95704322
has answer: http://stackoverflow.com/a/44933234
type: Question
linked to: http://stackoverflow.com/q/42169951
score: 5
has title: Stored Procedure error handling using java
favorite count: 0
tagged with: procedure
possible better answer: http://stackoverflow.com/a/29016522
has answer: http://stackoverflow.com/a/29016522
tagged with: jdbc
answer count: 4

http://stackoverflow.com/a/26765356
has body: &lt;h:inputFile styleClass="form-control" id="slideImage"&gt; &lt;f:validator validatorId="NewImageValidator"/&gt; &lt;/h:inputFile&gt; First, you are- not using a value on the h:inputFile, hence your file will not be submitted into any BakingBean Property and the value passed to the converter will always be null. That's not true actually. The validator will still pickup the right value, but ofc. if you want continue to use the file, you should store it in your backing bean. Second, your form is missing a submit button. If you have a look at the JSF LifeCycle, the validation is invoked, after the values of the components have been evaluated (after submitting a form, not while the user fills out data, i.e. is picking a file) If you want to execute the validation right away, there is no way around (partial)-submitting the form and transfer the file to the server. Depending on the size this might be a bad approach. Bot for that purpose you can use f:ajax: &lt;h:form styleClass="form" role="form" prependId="false" enctype="multipart/form-data"&gt; &lt;h:inputFile value="#{myBean.uploadedFile}" styleClass="form-control" id="slideImage"&gt; &lt;f:validator validatorId="NewImageValidator"/&gt; &lt;f:ajax event="change" execute="slideImage" /&gt; &lt;/h:inputFile&gt; &lt;/h:form&gt; but i would prefer to only transfer files the user decides to submit (using a regular submit button). He might re-pick several files, and you don't need to upload them all as the user changes his mind. I think there is no client-side validation of files, because your browser would not allow any client-side script to access an unsubmitted file on the filesystem.
answers question: http://stackoverflow.com/q/26764607
has comment: http://stackoverflow.com/comment/42120654
has comment: http://stackoverflow.com/comment/42222416
score: 0
has comment: http://stackoverflow.com/comment/42153140
type: Answer

http://stackoverflow.com/comment/42050784
type: Comment
score: 1
has text: Shouldn't `DataOutputStream d = new DataOutputStream(new FileOutputStream(jc.getSelectedFile().getPath()));` be something like `DataOutputStream d = new DataOutputStream(new FileOutputStream(new File(path)));`? +1 to @trashgod suggestion of an MCVE.
comment on: http://stackoverflow.com/q/26731370
type: QuestionComment

http://stackoverflow.com/comment/42086091
comment on: http://stackoverflow.com/a/26750902
score: 0
type: AnswerComment
has text: if ( value8 != null && !value8.isEmpty()) getting error on this lineis The operator != is undefined for the argument type(s) double, null - Cannot invoke isEmpty() on the primitive type double
type: Comment

http://stackoverflow.com/a/26807905
downvote count: 0
has body: Try this: Date date = new SimpleDateFormat("hh:mm:ss").parse("07:15:45"); String newDate = new SimpleDateFormat("h:mm a").format(date); This will print 7:15 AM
type: Answer
accepted answer of: http://stackoverflow.com/q/26807839
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/26807839
type: AcceptedAnswer

http://stackoverflow.com/q/26677751
has title: In Android, when is an Interface called?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26677859
tagged with: java
type: Question
score: 0
has body: This is my first attempt at an Android game. I need to draw a path that starts at the center of the screen, and I'm getting the center screen coordinates using OnGlobalLayoutListener. In order to pass the center coordinates to my View class I'm using an Interface. Now, assuming that the Interface is working, it's passing 0,0 because the drawn path is starting at the upper left of my Relative Layout. I'm getting the correct coordinates because for now I'm passing them to a TextView so I can see the coordinates, but they're not getting passed to the View class because the path starts in the upper left, not the center of my Relative Layout. So I guess my question is: Does the Interface get triggered before onCreate completes? And if so, how can I get the center screen data to the Interface before the Interface is triggered? Can I somehow trigger the Interface after I get the screen data? Here are the classes I'm working with, first the Main Activity: public class Game1 extends Activity implements GBoardValueSetter { DrawPath dp; TextView gameScore_TV, gameTime_TV; private CountDownTimer mainGameCD; private boolean mainGameTimerHasStarted = false; private final long mainCDTime = 30 * 1000; private final long mainCDInterval = 1 * 1000; // ---GameBoard variables RelativeLayout root_RL, gBoardInfo_RL, gBoard_RL; LayoutInflater LayInf = null; View root_VUE, gBoardInfo_VUE; LayoutParams root_LP, gBoardInfo_LP, gBoard_LP; int xScr2Int, yScr2Int, xScrInt, yScrInt, xCenterInt, yCenterInt; String xCenterStr, yCenterStr, xHStr, yWStr; float xCenter_FL, yCenter_FL; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.cutin, R.anim.cutout); root_RL = new RelativeLayout(this); root_LP = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); root_RL.setId(1); root_RL.setBackgroundColor(Color.WHITE); root_RL.setLayoutParams(root_LP); setContentV…
answer count: 1
has answer: http://stackoverflow.com/a/26677859
has comment: http://stackoverflow.com/comment/41954461
tagged with: android
has comment: http://stackoverflow.com/comment/41954615
has comment: http://stackoverflow.com/comment/41954429

http://stackoverflow.com/comment/41982983
type: QuestionComment
has text: Well, what does your debugging find?
comment on: http://stackoverflow.com/q/26693640
score: 1
type: Comment

http://stackoverflow.com/q/26791968
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42160253
tagged with: easymock
tagged with: methods
accepted answer: http://stackoverflow.com/a/26796110
type: Question
tagged with: stub
tagged with: helper
answer count: 1
has answer: http://stackoverflow.com/a/26796110
has title: Easymock stub helper methods
type: AnsweredQuestion
has body: I'm trying to find a way to use EasyMock to test only a method execute() in class Foo, expect the number of times a method in a Mock object is invoked by that method, but ignoring the number of times the same method in the mock object is invoked by the helper methods of the same class Foo when called by method execute(). Because I have other test methods to test the helper methods, and just want to limit my testing to one method, not other methods when called in the same class. The way I have it now, the test would fail because cust.getAccount() is executed more than 1 by execute(), method1() and method2(). For example: class under test public class Foo{ private Customer cust; &lt;&lt;&lt; this will be mocked public void execute(){ cust.getAccount(); &lt;&lt;&lt; this will be expected as 1 for execute() ... ... method1(); &lt;&lt;&lt; calling helper method 1 ... } protected method1(){ for (...){ cust.getAccount(); } method2(); &lt;&lt;&lt; calling helper method 2 } method 2(){ cust.getAccount(); } } Testing class public class TestFoo{ @Test public void testExecute(){ Customer custMock = createMock(Customer.class); expect(custMock.getAccount()).andReturn("1111").times(1); replay(custMock); Foo foo = new Foo(); foo.execute(); } } I've looked into andStubReturn(), but haven't quite figured it out yet. Thank you all for your guidance.

http://stackoverflow.com/a/26792285
accepted answer of: http://stackoverflow.com/q/26787733
answers question: http://stackoverflow.com/q/26787733
score: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
downvote count: 2
has body: here is the complete program and everything is working fine: import java.io.ObjectInputStream.GetField; import java.util.Scanner; public class main { public static void main(String[] args) { Scanner in = new Scanner(System.in); char[] Num1; char[] Num2; String num1 = in.nextLine(); String num2 = in.nextLine(); in.close(); Num1 = num1.toCharArray(); Num2 = num2.toCharArray(); check(Num1, Num2); } static int DaQMultiplay(char[] num1,char[] num2){ int res=0; if(num1.length&lt;=1){ int num1sd = 0; int num2sd = 0; if(num1!=null &amp;&amp; !num1.equals("") &amp;&amp; new String(num2).trim().length()&gt;0){ num1sd =Integer.parseInt(new String(num1)); } if(num2!=null &amp;&amp; !num2.equals("") &amp;&amp; new String(num2).trim().length()&gt;0){ num2sd=Integer.parseInt(new String(num2)); } return (num1sd*num2sd); } double len = num1.length; int lenl = (int) Math.ceil(len/2); char []ln1 = new char[lenl]; char []rn1 = new char[(int) (len-lenl)]; char []ln2 = new char[lenl]; char []rn2 = new char[(int) (len-lenl)]; for (int i = 0; i &lt; ln1.length; i++) { ln1[i]=num1[i]; } for (int i = 0; i &lt; rn1.length; i++) { rn1[i]=num1[i+lenl]; } for (int i = 0; i &lt; ln2.length; i++) { ln2[i]=num2[i]; } for (int i = 0; i &lt; rn2.length; i++) { if(num2.length&gt;i+lenl){ rn2[i]=num2[i+lenl]; } } res+=(DaQMultiplay(ln1,ln2)*(Math.pow(10, len))); res+=(DaQMultiplay(rn1,ln2)*(Math.pow(10, (len/2)))); res+=(DaQMultiplay(ln1,rn2)*(Math.pow(10, (len/2)))); res+=(DaQMultiplay(rn1, rn2)); return res; } static void check(char []Num1,char []Num2){ int res=0; if ((Num1.length%2)==0) { res=DaQMultiplay(Num1, Num2); System.out.println(res); } else{ String num1 = String.valueOf(Num1); num1 = num1+"0"; String num2 = String.valueOf(Num2); num2 = num2+"0"; Num1=num1.toCharArray(); Num2=num2.toCharArray(); res=DaQMultiplay(Num1, Num2); res=(res/100); System.out.println(res); } } }

http://stackoverflow.com/comment/42017498
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26712582
has text: @EJP when you are maintaining resource bundles you don't want to mess up the order because messages next to each other are there because of there shared context. But maybe some automatic process is there to fill in missing keys. So this shouldn't mess everything up.

http://stackoverflow.com/a/26782105
answers question: http://stackoverflow.com/q/26781990
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The problem is you are mapping in a small region, e.g. 4 KB and then attempting to read the whole file which I guess is more than 4 KB. BTW, you should always close a file once you have finished with it in a finally block or with a try-with-resource block. buffer.clear(); doesn't do anything in this case. The main advantage of using memory mapped files and avoiding needing to copy the data into a byte[]. If you need a byte[] just read it into a byte[] directly. If you want an optimal solution, try to avoid using a byte[].
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26781990

http://stackoverflow.com/comment/41956654
has text: @zapl so I have the best performance when I create only 6-8 threads? And each additional thread will not increase the performance?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26678072
type: QuestionComment

http://stackoverflow.com/q/26691076
possible better answer: http://stackoverflow.com/a/26691404
has answer: http://stackoverflow.com/a/26706316
type: Question
has title: Java inheritance how to take user input and pass it to sub-sub class?
has comment: http://stackoverflow.com/comment/41978675
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/26692157
favorite count: 0
has comment: http://stackoverflow.com/comment/41978662
has answer: http://stackoverflow.com/a/26691404
answer count: 4
has answer: http://stackoverflow.com/a/26692157
tagged with: user-input
downvote count: 2
tagged with: shapes
upvote count: 1
has body: This is my first ever post here so bear with me please! I have a program that I need to write. Here are the instructions: create a class called areaExcersice in that class you will have a super class called shapes then below it twoDimensionalShapes followed by sub sub class circle and square under the twoDimensionalShapes. In circle extends twoDimensionalShapes, I will pass the user input of radius for example: System.out.print("what is the radius"); and then radius = input.nextDouble() already know how to create and assign classes in a hierarchy system, however, I have no idea how I'm gonna call my circle class under the twiDimensionalShapes. I have to create an if statement so the user can select which shape to choose so something like this "press 1 for circle or 2 for square" and on my if(user_input == 1){ Here is my question how would I call circle class under twodDimensionalShapes to find the area and pass on radius? Thanks this is all i need to know please if you can just point me out in the good direction i already have created an instance for ex Circle c = new Circle Then in my if statement i would do c.getArea() but then where would I put my radius that is asked from the user?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26692164
tagged with: java
score: -1

http://stackoverflow.com/comment/41981219
type: QuestionComment
has text: Not sure if it's a duplicate, I looked through some of the other questions involving this, but it's strange because I have several things in my code that repeat, and they all work, and then just one part of the code doesn't work.
score: 0
comment on: http://stackoverflow.com/q/26692784
type: Comment

http://stackoverflow.com/q/26771953
type: Question
has title: Return Lambda from Method in Java 8?
has body: I have just begun to use Java 8 and I am wondering if there is a way to write a method that returns a Function? Right now I have method like below: Function&lt;Integer, String&gt; getMyFunction() { return new Function&lt;Integer, String&gt;() { @Override public String apply(Integer integer) { return "Hello, world!" } } } Is there a way to write that more succinctly in Java 8? I was hoping this would work but it does not: Function&lt;Integer, String&gt; getMyFunction() { return (it) -&gt; { return "Hello, world: " + it } }
has answer: http://stackoverflow.com/a/26772995
score: 45
has answer: http://stackoverflow.com/a/26772000
accepted answer: http://stackoverflow.com/a/26772000
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/39483829
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26772995
downvote count: 0
upvote count: 45
has answer: http://stackoverflow.com/a/26799014
tagged with: java
has answer: http://stackoverflow.com/a/36772536

http://stackoverflow.com/comment/42158111
comment on: http://stackoverflow.com/q/26791074
score: 0
type: Comment
has text: I don't have a log4j.properties in my eclipse project, but I posted my log4j.xml.
type: QuestionComment

http://stackoverflow.com/a/26721723
type: Answer
score: 0
has body: Because each while loop wants to fill 1 more cell. The last loop can't fill the required number of cells, because there are no more empty cells available. Modify the &lt;= condition in all loops to &lt; and it will be OK. public static void assignCellTypes(char[][] tissue, int percentBlank, int percentX){ //Your code goes here Random rnd = new Random(); int row = 0; int col = 0; int rndRow = rnd.nextInt(tissue.length); int rndCol = rnd.nextInt(tissue.length); int numOfCells = (tissue.length * tissue.length); double numOfBlankCells = numOfCells * (percentBlank/100.0); numOfBlankCells = Math.ceil(numOfBlankCells); double numOfXCells = (numOfCells-numOfBlankCells) * (percentX/100.0); numOfXCells = Math.ceil(numOfXCells); double numOfOCells = numOfCells - (numOfBlankCells + numOfXCells); if (numOfCells &lt; numOfBlankCells + numOfXCells + numOfOCells) { System.out.println("Percentages can't be over 100%"); System.exit(0); } int counterBlank = 0; while (counterBlank &lt; numOfBlankCells) { rndRow = rnd.nextInt(tissue.length); rndCol = rnd.nextInt(tissue.length); if (tissue[rndRow][rndCol] == '\0') { tissue[rndRow][rndCol] = ' '; counterBlank++; } } int counterX = 0; while (counterX &lt; numOfXCells) { rndRow = rnd.nextInt(tissue.length); rndCol = rnd.nextInt(tissue.length); if (tissue[rndRow][rndCol] == '\0') { tissue[rndRow][rndCol] = 'X'; counterX++; } } int counterO = 0; while (counterO &lt; numOfOCells) { rndRow = rnd.nextInt(tissue.length); rndCol = rnd.nextInt(tissue.length); if (tissue[rndRow][rndCol] == '\0') { tissue[rndRow][rndCol] = 'O'; counterO++; } } } But what about producing the same result from the other side - pass through the cells linearly and fill the cells with the random values at once? :)
accepted answer of: http://stackoverflow.com/q/26721259
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42034468
answers question: http://stackoverflow.com/q/26721259

http://stackoverflow.com/q/26774772
favorite count: 0
has comment: http://stackoverflow.com/comment/42149302
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26774824
tagged with: enums
has answer: http://stackoverflow.com/a/26774838
tagged with: java
tagged with: collections
downvote count: 1
type: Question
has title: How to sort a List of Objects in ascending order based on an enum using Java?
score: -1
has comment: http://stackoverflow.com/comment/42135026
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/42129331
has body: Lets say you have a particular enum called Field: public enum Field { ALBUM, YEAR, DESCRIPTION } And you have a corresponding Java interface called Music public interface Music { String getAlbum(); } And you implement it like this: public class MusicImpl implements Music { public String getAlbum() { return this.getField(Field.ALBUM) } @Override public Object getField(Field field) { Object myObject = field.getClass(); return myObject; } } How can you sort it using the field: public class MusicManager { public List&lt;Music&gt; sortAlbums(Field field, boolean ascending) { List&lt;Music&gt; albums = new ArrayList&lt;Music&gt;(); Music music = new MusciImpl(); if (ascending = true) albums.add(music); Collections.sort(albums); } return albums; } } Eclipse is throwing the following error at Collections.sort(albums): Bound mismatch: The generic method sort(List&lt;T&gt;) of type Collections is not applicable for the arguments (List&lt;Music&gt;). The inferred type Music is not a valid substitute for the bounded parameter &lt;T extends Comparable&lt;? super T&gt;&gt;
has comment: http://stackoverflow.com/comment/42149427

http://stackoverflow.com/a/26697966
downvote count: 0
has body: Check this code for sum function. public static void sum(int[] num1, int[] num2){ int num1len = num1.length; int num2len = num2.length; int[] sum= new int[num1len&gt;num2len?num1len:num2len]; for (int i = sum.length-1 ; i&gt; 0; i--){ if(num1len&gt;0) sum[i] += num1[--num1len]; if(num2len&gt;0) sum[i] += num2[--num2len]; if(sum[i] &gt;= 10){ sum[i] = sum[i]%10; sum[i-1]++; } } for (int i = 0; i&lt; sum.length; i++) System.out.print(sum[i]); }
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26697830

http://stackoverflow.com/comment/42173374
type: QuestionComment
type: Comment
has text: So specify a different character set and see if the output changes.
comment on: http://stackoverflow.com/q/26799782
score: 0

http://stackoverflow.com/comment/42023212
type: QuestionComment
type: Comment
has text: I suggest you switch to using an ArrayList<Integer> instead of this IntList. It's possible this class behaves different than ArrayList, and the docs in the link you posted are far from being sufficient. If you make the code work with ArrayList, you can later move back to IntList (if you really want to).
comment on: http://stackoverflow.com/q/26715648
score: 0

http://stackoverflow.com/comment/42215989
type: Comment
has text: I'm not sure what you mean exactly by the type of sender object, since it's `Object` (and you'd be doing a lot of `instanceof` to see *which* one it is, anyway). I only threw that out there as a suggestion. The alternate route is still valid; you shouldn't be using exceptions as flow control.
comment on: http://stackoverflow.com/a/26823320
score: 0
type: AnswerComment

http://stackoverflow.com/q/26745541
possible better answer: http://stackoverflow.com/a/40861094
has answer: http://stackoverflow.com/a/46233362
has answer: http://stackoverflow.com/a/36061609
has answer: http://stackoverflow.com/a/40861094
tagged with: git
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26790884
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/57840809
accepted answer: http://stackoverflow.com/a/26797735
type: Question
linked to: http://stackoverflow.com/q/16977739
has answer: http://stackoverflow.com/a/74441944
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/46466763
has answer: http://stackoverflow.com/a/37885112
has body: I have looked around quite a bit and haven't found the best solution to convert an existing IntelliJ project to Gradle. I work in a team environment and we currently share the .ipr file as we have a few build configurations that we track. We will be getting rid of those in favor of Gradle eventually but I can't screw things up too much until the Gradle conversion is done. Also, our Java source files are located in the root of the src directory instead of src/main/java as is standard. Is there a way I can add Gradle to my project that won't make me delete and recreate my IntelliJ project and won't screw everyone else up when they do a Git pull?
has answer: http://stackoverflow.com/a/65344994
score: 179
favorite count: 0
upvote count: 179
answer count: 9
has answer: http://stackoverflow.com/a/26797735
has title: Best way to add Gradle support to IntelliJ Project

oracle-database
tags question: http://stackoverflow.com/q/26704383
tags question: http://stackoverflow.com/q/26675812
tags question: http://stackoverflow.com/q/26754842
tags question: http://stackoverflow.com/q/26820700
tags question: http://stackoverflow.com/q/26727788
tags question: http://stackoverflow.com/q/26729067
tags question: http://stackoverflow.com/q/26752131
tag name: oracle-database
tags question: http://stackoverflow.com/q/26802570
tags question: http://stackoverflow.com/q/26737840
tags question: http://stackoverflow.com/q/26790471
type: Tag
tags question: http://stackoverflow.com/q/26757751
tags question: http://stackoverflow.com/q/26748616
tags question: http://stackoverflow.com/q/26745971
tags question: http://stackoverflow.com/q/26715287
tags question: http://stackoverflow.com/q/26755267
tags question: http://stackoverflow.com/q/26758972
tags question: http://stackoverflow.com/q/26778780
tags question: http://stackoverflow.com/q/26676527
tags question: http://stackoverflow.com/q/26807759
tags question: http://stackoverflow.com/q/26795106
tags question: http://stackoverflow.com/q/26680987
tags question: http://stackoverflow.com/q/26713082
tags question: http://stackoverflow.com/q/26698263

http://stackoverflow.com/a/26751112
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26750916
score: 1
upvote count: 1
has body: Whatever you are building e.g. LinkedList, ArrayList, Vector, Stack in and returning from someFunction() will be implemented with listexample. If you are using List interface reference, it has one benefit, that you can assign any type of object to it (LinkedList, ArrayList, Vector, Stack).

http://stackoverflow.com/q/26716050
has answer: http://stackoverflow.com/a/26797692
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/42022834
has comment: http://stackoverflow.com/comment/42022332
has comment: http://stackoverflow.com/comment/42024964
tagged with: java
tagged with: hibernate
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29914689
favorite count: 0
has body: I am trying to upgrade my project from version 3.6.10 to 4.3.6, and I am getting "commit failed" error on application start. Instead of using: SessionFactoryUtils.getSession(sessionFactory, allowCreate); , for obtaining the session, now I am using: sessionFactory.getCurrentSession(); Transactions are handled with TransactionManager, and Spring's NameMatchTransactionAttributeSource. This is the stack trace that I am getting: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#0' defined in class path resource [frontmvcSpringContext.xml]: Invocation of init method failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: commit failed at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:681) at o…
has title: Error "commit failed" after upgrading to Hibernate 4
type: Question
tagged with: spring

http://stackoverflow.com/a/33629185
score: 0
has body: public static boolean isNetworkOn(Context context, int networkType) { final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (Build.VERSION.SDK_INT &gt;= 21) { final Network[] networks = connectivityManager.getAllNetworks(); for (Network network : networks) { final NetworkInfo networkInfo = connectivityManager.getNetworkInfo(network); if (networkInfo.getType() == networkType &amp;&amp; networkInfo.isConnectedOrConnecting()) { return true; } } } else { @SuppressWarnings("deprecation") final NetworkInfo networkInfo = connectivityManager.getNetworkInfo(networkType); if (networkInfo.isConnectedOrConnecting()) { return true; } } return false; }
type: Answer
answers question: http://stackoverflow.com/q/26755871

http://stackoverflow.com/q/26773403
tagged with: loops
type: Question
tagged with: for-loop
answer count: 3
accepted answer: http://stackoverflow.com/a/26773452
has comment: http://stackoverflow.com/comment/42126168
has comment: http://stackoverflow.com/comment/42146495
has title: Perfect number from input
has answer: http://stackoverflow.com/a/43075335
has comment: http://stackoverflow.com/comment/42126265
tagged with: perfect-numbers
possible better answer: http://stackoverflow.com/a/26773823
has answer: http://stackoverflow.com/a/26773823
has body: I'm trying to print out if a number is perfect or not by having the user enter in a number. When I enter a perfect number like 6, for example, it tells me that it is not a perfect number and can't figure out why. My final code needs to print out like 6 = 1 + 2 + 3. But I'm not that far yet. Scanner scanner = new Scanner(System.in); System.out.println("Enter a positive integer: "); int n = scanner.nextInt(); int sum = 0; for(int i = 1;i&lt;n;i++){ if(n%2==0) sum += i; } if(sum==n){ System.out.println(n + " is a positive number"); } else { System.out.println(n + " is not a positive number"); }
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26773452

http://stackoverflow.com/q/26783540
has comment: http://stackoverflow.com/comment/62590162
favorite count: 0
has comment: http://stackoverflow.com/comment/42373073
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381599
has comment: http://stackoverflow.com/comment/42269574
score: 2
has comment: http://stackoverflow.com/comment/42528184
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: weblogic
has title: WebLogic 12c: persistent store api for use in own java code
has body: I'd like to use the weblogic persistent store from own java code deployed to WebLogic 12c. While there is plenty of information on how to configure persistent stores, I found nothing about using them from own code, like official Oracle documentation or code example or at least a javadoc. Any pointers would be greatly appreciated.
downvote count: 0

http://stackoverflow.com/a/26785081
has comment: http://stackoverflow.com/comment/42147060
answers question: http://stackoverflow.com/q/26784924
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42147693
has body: Static initialization is done in the order it's written in the code. So in your code it will enter the static block first and then will go to the variable declaration... you cant use a variable before it is declared and thats why it wont compile... public final class MyStaticClass { private static final A a; private static final B b; private MyStaticClass() {} static { a = new A(); b = new B(a); // Cannot access a field before it is defined } } }
has comment: http://stackoverflow.com/comment/42147031
upvote count: 1
has comment: http://stackoverflow.com/comment/42147363
type: Answer

http://stackoverflow.com/comment/42161853
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26793280
has text: do you mean , one of your user input football, another input game, and you want the activity to be "football game", and then when any user uses "football" or "game", they can find this activity? What about there is a "basketball game", should the user get both of them when using "game" to search?

http://stackoverflow.com/comment/42201868
has text: This is a great help thanks for answering my question i really appreciate it!
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26812984

http://stackoverflow.com/comment/42120102
comment on: http://stackoverflow.com/q/26769828
type: Comment
type: QuestionComment
score: 0
has text: what do you mean with build the clases and create classes? It is create the clases and later the tables?

http://stackoverflow.com/comment/42054871
type: AnswerComment
has text: yes.it will give error.in the GET request parameters are sent as a part of URL.
type: Comment
comment on: http://stackoverflow.com/a/26730402
score: 0

http://stackoverflow.com/comment/42090470
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26748004
has text: The general rule is: every time the entity is updated in the underlying database its version field will increase by one. Try to update the existing entity and the invoke flush/commit.

http://stackoverflow.com/comment/41983573
comment on: http://stackoverflow.com/q/26694081
has text: @ErikEriksson not really. Your timestamp object is really just a long type internally, with some fancy wrapper to print nice human readable strings (do a print of your System.currentTimeMillis() and see). So the sort algo just has to arrange them in the proper order, ascending per the javadoc (ie, which number is smaller goes first, then so on...)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/28351140
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26718165
type: Answer
has body: Actually it is not possible at all. As stated in oracle docs: "The web.xml descriptor is always processed first." What you could do is create another web-fragment.xml with your RunSecond listener and set the relative order between the fragments using "ordering". Hope it helps.
score: 2
accepted answer of: http://stackoverflow.com/q/26718165
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/42310209
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26762680
has text: Just wanted to point out that in this case, by setting the expectation that the web service returns "Haus" and asserting that that the test subject returns "Haus" we really haven't achieved much of a test. The answer about using @Mocked is correct, but to me it seems more important to make sure that we actually achieve some useful test, so I would propose that the test subject be restructured *or* the test be changed to verify only that the test subject calls out to the web service with the expected parameter.

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/26673121
tags question: http://stackoverflow.com/q/26796260
type: Tag

http://stackoverflow.com/a/26676427
upvote count: 1
type: Answer
has body: If your LeadVO contains the date you want to sort by, implement Comparable interface in your VO and then sort the VO collection using Collections.sort(). public class LeadVO implements Comparable&lt;LeadVO&gt; { private Date date; // other properties, getters and setters @Override public int compareTo(LeadVO other) { return date.compareTo(other.getDate()); } } and the sort like this: Collections.sort(leadVoList); You should ideally add null checks or use something like ObjectUtils.compare from commons-lang if your date is not guaranteed to be non-null. Also you could do this by creating a Comparator instead of implementing Comparable as suggested by other posters, which might be better if you need to sort your VO by multiple values. If you just need to sort it by date, this approach might be a little simpler.
score: 1
accepted answer of: http://stackoverflow.com/q/26676210
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26676210
downvote count: 0

http://stackoverflow.com/comment/41953295
score: 0
type: AnswerComment
has text: It should be noted that in many high-level languages (i.e. without a compiler) regexes are faster than your method. Just try this exact method in Python, PHP, Ruby, Perl, etc. and it will be faster to use a properly written regex instead.
type: Comment
comment on: http://stackoverflow.com/a/26674792

http://stackoverflow.com/comment/41947021
type: QuestionComment
comment on: http://stackoverflow.com/q/26673316
has text: Perhaps this: [Google Guava Collections API - BiMap](https://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/BiMap.html)
score: 0
type: Comment

http://stackoverflow.com/q/26735044
tagged with: database
score: 0
answer count: 1
tagged with: jdbc
tagged with: esper
has title: Esper: How to configure Esper to connect a Relational Database, through a JDBC, using Esper's configuration API
accepted answer: http://stackoverflow.com/a/26735420
type: AnsweredQuestion
has body: I would like to know how a java client application that is using Esper's engine (v5.0.0) may configure engine instance so he can to connect to a relation database, say pgSQL. This is essential to write EPL queries capable to join event streams (or data stream) with static/historic data from a database (5.13. Accessing Relational Data via SQL). That is, to Read from a database. (Write to a database requires the usage of a EsperIO adapter.) From Esper's docs I figure out that Configuration and ConfigurationDBRef classes should be used to configure Esper's database connection through its API. However, at the best of my research, the remaining documentation is not very clear about the entire configuration process, for which I'm struggling to.
tagged with: java
has answer: http://stackoverflow.com/a/26735420
type: Question
tagged with: configuration

http://stackoverflow.com/comment/41967073
has text: You don't need tricks or tweaks, unless text line lengths are larger than the chosen language & op system can handle, which is unlikely, or unless you are trying to read the entire file into memory.
comment on: http://stackoverflow.com/q/26684292
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42431254
has text: Err it may sounds stupid but can you have a look at it http://stackoverflow.com/questions/26934688/while-displaying-a-listview-through-parse-coms-database-error-arrayadapter-cre i guess you can help, i'm really desperate here but not getting the correct answer i think you can help :|
type: AnswerComment
comment on: http://stackoverflow.com/a/26701821
score: 0
type: Comment

http://stackoverflow.com/q/26775990
has comment: http://stackoverflow.com/comment/42137396
tagged with: db2
score: 0
tagged with: procedure
has title: Java Client doesn't get ResultSet from Stored Procedure (written in Java - SQLJ) on DB2 zOS
has body: I'm trying to recieve a ResultSet from a SQLJ Java Stored Procedure. The Client doesn't get the ResultSet. So I don't know if there is anything wrong with my create, transfer or receive of the ResultSet. This is how I create the Procedure: CREATE PROCEDURE SCHEMA.JOBNAMENGET (IN FILTER CHARACTER(8)) EXTERNAL NAME 'STPDFIDB.JOBNAMENGET (java.lang.String,java.sql.ResultSet[])' DYNAMIC RESULT SETS 1 LANGUAGE JAVA PARAMETER STYLE JAVA NO COLLID PACKAGE PATH 'SCHEMA,NULLID' PROGRAM TYPE SUB WLM ENVIRONMENT XXXXXXXX; The Code of the external Java Procedure: import java.sql.*; import com.ibm.db2.jcc.DB2Connection; import java.util.Properties; import sqlj.runtime.ExecutionContext; #sql iterator Cursor1 (String, String); public class STPDFIDB { #sql static context STPD2FIDB_Ctx; public static void JOBNAMENGET ( String filter, ResultSet[] outRS)throws SQLException { Connection conndb2 = null; STPD2FIDB_Ctx ctx = null; Cursor1 cursor1 = null; System.out.println("Vor dem Try"); try { System.out.println("in dem try"); // Establish Connection; if type-2 z/OS this will trigger load of DLL System.out.println (); conndb2 = DriverManager.getConnection("jdbc:default:connection" ); conndb2.setAutoCommit(false); ctx = new STPD2FIDB_Ctx ( conndb2 ); #sql [ctx] cursor1 = { SELECT JOBNAME, KURZBESCHREIBUNG FROM SCHEMA.JOBNAMEN WHERE JOBNAME LIKE :filter }; System.out.print("cursor durchgeführt"); } catch (SQLException ex) { System.err.println("SQLException information"); System.err.println("Error msg: " + ex.getMessage()); System.err.println("SQLSTATE: " + ex.getSQLState()); System.err.println("Error code: " + ex.getErrorCode()); ex.printStackTrace(); } catch ( Exception e ) { System.out.println ( " ***** ERROR - Unable to load DB2 Universal Driver, " + e ); } outRS[0] = cursor1.getResultSet(); System.out.println("Whileschleife"); // // while (outRS[0].next()){ // System.out.println("Jobname = " + outRS[0].getString(1)); // } } } And the call from the Client: String ergebnis = ""; ResultSe…
tagged with: resultset
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42139017
answer count: 0
tagged with: java
tagged with: sqlj
type: Question

http://stackoverflow.com/comment/42134768
type: Comment
comment on: http://stackoverflow.com/q/26778362
score: 0
type: QuestionComment
has text: A set has no order. If you want to order cards, don't use a set for that.

http://stackoverflow.com/q/26826668
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26841282
tagged with: web-services
tagged with: gwt
tagged with: java
type: Question
has title: Line 22: No source code is available for type in html libgdx
tagged with: libgdx
tagged with: javascript
has body: i'm trying to run html libgdx project, where i have a splash screen that uses tweenengine [ERROR] Line 22: No source code is available for type aurelienribon.tweenengine.TweenManager any idea how to fix this? thanks
score: 0

http://stackoverflow.com/comment/41986193
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26695600
has text: it actually works.. http://ideone.com/xnGnj1
score: 0

http://stackoverflow.com/comment/42067565
type: QuestionComment
comment on: http://stackoverflow.com/q/26740362
has text: Post the stacktrace, and tell us with line is failing. Please.
score: 0
type: Comment

http://stackoverflow.com/q/26755690
answer count: 3
accepted answer: http://stackoverflow.com/a/26755830
has answer: http://stackoverflow.com/a/26755810
has title: Java enum, different value depending on bool value
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26755779
has body: I want to create an enum class, lets say: public enum runtimeStatus { STATUS1("passed"), STATUS2("failed"), STATUS3("notrun"); private String status; private runtimeStatus(String statusCode) { status = statusCode; } public String getStatus() { return status; } } Okay, I'm accesing those properties with runtimeStatus.STATUS1.getStatus(); But how can I accomplish to pass a boolean to that call, so I get a different output. Lets say for STATUS1 if passed boolean is TRUE to return "passed" if its FALSE to return "passed-type2"
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26755830
possible better answer: http://stackoverflow.com/a/26755779
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/42093720
has comment: http://stackoverflow.com/comment/42093727

http://stackoverflow.com/a/26675301
score: 3
answers question: http://stackoverflow.com/q/26675116
downvote count: 0
type: Answer
has body: Get the page's source URL url = new URL("http://www.example.com/"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String row = ""; String text = ""; while ((row = in.readLine()) != null) { text += row; } in.close(); Then find that string in text if (text.contains("yourString")) { System.out.print("Found!"); } You should try to do your homework yourself by the way
upvote count: 3

http://stackoverflow.com/comment/42161877
score: 0
comment on: http://stackoverflow.com/a/26793095
has text: hour, minute, and second don't need to be primitive longs.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42042579
score: 6
comment on: http://stackoverflow.com/q/26726868
type: Comment
type: QuestionComment
has text: You cannot avoid O(N^2), as you are generating N^2 output values.

http://stackoverflow.com/comment/138768316
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26675158
type: AnswerComment
has text: I don't think it is working. I am stuck with same issue .I have one method genericMain inside Jar. JAr has been added module + classpath, still While invoking using reflection facing ClassNotFoundException

http://stackoverflow.com/comment/42091967
type: QuestionComment
comment on: http://stackoverflow.com/q/26754442
has text: In string `"?rtg"` what should it be replaced with?
score: 0
type: Comment

http://stackoverflow.com/a/26699081
has body: I would suggest to do Serializable ser = (Serializable) list; String key = getString(R.string.app_name) + ".myList"; intent.putExtra(key, ser); in case the ArrayList[] is not recognized as Serializable.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26698888
has comment: http://stackoverflow.com/comment/41992974

http://stackoverflow.com/comment/42138555
has text: This parser is used in RetroFit, so not an real option there as its part of an android project.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26777867
type: QuestionComment

http://stackoverflow.com/a/26755826
downvote count: 0
has body: The first is initialization. While the second is a method that returns Test type object
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26755794
upvote count: 1

http://stackoverflow.com/comment/42190518
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26808538
has text: Good luck for your debugging it is nice to see you are actually trying to do it by yourself instead of begging for code
score: 0

http://stackoverflow.com/q/26794306
favorite count: 0
has body: I have written a "crawler", that has the option of specifying the number of "threads". The idea is that if the user specifies 5 threads, the crawler will actually try to download 5 web pages in one go. In other words, I need: the fastest way, to download MULTIPLE HTML pages in Java But it must also: Be able to tell me the response code (200, 404 etc) Determine the MIME type --> preferably by only getting the headers (so I dont have to download an entire 100 Mb file only to find out it's HTML) In PHP I would consider things like Curl, or Guzzle and in some cases maybe even "file_get_contents". However, I don't know what the fastest way would be in Java. Can anyone please tell me?
has title: JAVA: Fastest way to download multiple files at once?
tagged with: download
answer count: 0
downvote count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42163352
upvote count: 1
has comment: http://stackoverflow.com/comment/42163455

http://stackoverflow.com/a/26787479
type: Answer
answers question: http://stackoverflow.com/q/26787351
has body: Flush app - is essentially killing an app process. The easiest way to kill a process is: Process.killProcess(Process.myPid()); Android will restart your process for you though, but as I understand that's what you are looking for
score: 0

http://stackoverflow.com/q/26796691
has answer: http://stackoverflow.com/a/26796967
tagged with: output
upvote count: 1
possible better answer: http://stackoverflow.com/a/26796794
type: AnsweredQuestion
tagged with: bufferedwriter
has body: I am having trouble with the space. How can I print out the output file correctly? When I run my code, which is like..... This is how my main method looks like, and generate the output file..... main()....{ File stats = new File(statFile); stats.createNewFile(); // my code here.... the stat values change here. FileWriter statFileWriter = new FileWriter(stats, true); BufferedWriter statsOutput = new BufferedWriter(statFileWriter); statsOutput.write(Stats.printStat()); statsOutput.flush(); } This is the Stat class that I can change the values in the program, and print out the string with the values. public class Stats { public static String dataFile = ""; public static int cacheHits = 0; public static int diskReads = 0; public static int diskWrites = 0; public static long executionTime = 0; public static String printStat() { String print = ""; print += "Sort on " + dataFile; print += "\nCache Hits: " + cacheHits; print += "\nDisk Reads: " + diskReads; print += "\nDisk Writes: " + diskWrites; print += "\nTime is " + executionTime; return print; } } This should make output like: Sort on sorted_b.dat Cache Hits: 30922 Disk Reads: 1 Disk Writes: 1 Time is 16 Sort on sorted_a.dat Cache Hits: 62899 Disk Reads: 2 Disk Writes: 2 Time is 0 But When I run the main twice in the testcase, the actual output was: Sort on sorted_b.dat Cache Hits: 30922 Disk Reads: 1 Disk Writes: 1 Time is 16Sort on sorted_a.dat ------&gt; the new stat is not start from the nextline. Cache Hits: 62899 Disk Reads: 2 Disk Writes: 2 Time is 0 if I add extra "/n" at the end of the print += "\nTime is " + executionTime; this line, like print += "\nTime is " + executionTime + \n; It will make extra one more line at the end, like Sort on sorted_b.dat Cache Hits: 30922 Disk Reads: 1 Disk Writes: 1 Time is 16 Sort on sorted_a.dat Cache Hits: 62899 Disk Reads: 2 Disk Writes: 2 Time is 0 ------------blank, but extra line. How can I print the output with no extra line, and correct printed?
has answer: http://stackoverflow.com/a/26796794
score: 1
tagged with: java
tagged with: filewriter
type: Question
has comment: http://stackoverflow.com/comment/42167447
accepted answer: http://stackoverflow.com/a/26796967
has title: output file new line not start from the nextline
downvote count: 0
has answer: http://stackoverflow.com/a/26796882
answer count: 3
tagged with: junit
favorite count: 0

http://stackoverflow.com/comment/113786327
has text: Does this answer your question? [Does spring have a shutdown process to put cleanup code?](https://stackoverflow.com/questions/8585350/does-spring-have-a-shutdown-process-to-put-cleanup-code)
score: 0
comment on: http://stackoverflow.com/q/26678208
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26721548
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26721482
has body: You mean something like this? This skips length 1 and 2 adds length 3 and stops when length 4 is found. int num = 3; while ((vrstica = bufferedReader.readLine()) != null) { //Do nothing for length 1 and 2 if (vrstica.length() == num) { list3.add(vrstica); } else if (vrstica.length() &gt; num) { //stop reading the file break; } }
has comment: http://stackoverflow.com/comment/42033164

http://stackoverflow.com/a/26699822
answers question: http://stackoverflow.com/q/26699286
upvote count: 3
type: Answer
score: 3
has body: You are most likely missing enabling annotation-driven cache configuration (cache:annotation-driven). See this example: <cache:annotation-driven /> Go to this page for more documentation: http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/cache.html
has comment: http://stackoverflow.com/comment/42036212
accepted answer of: http://stackoverflow.com/q/26699286
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42159404
has text: Just a normal .jar file
comment on: http://stackoverflow.com/q/26791859
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26805488
has body: I have a class that goes off to a server to perform a query, and what I'd like to do is replace that call (which requires a live server to be up and running in the background) with a mock call that returns some canned response for the purposes of unit testing. I'm brand new to BCEL and I've looked at this post, tweaked it as well as I can, but can't seem to get it working for me: Replacing statically referenced method in Java Here's some code: // ======================================================= public class JUnitByteCodeUtils { public static final String EVAL_QUERY_CLASS_NAME_SHORT = "ServerApi"; public static final String EVAL_QUERY_CLASS_NAME_FULL = "org.foo." + EVAL_QUERY_CLASS_NAME_SHORT; public static final String EVAL_QUERY_METHOD_NAME = "evaluateQuery"; public static final String EVAL_QUERY_METHOD_SIGNATURE = "(Ljava/lang/String;)Lorg/foo/QueryResultSet;"; public static final Type QUERY_RESULTSET_TYPE = new ObjectType( QueryResultSet.class.getName() ); /** * Redirect/replace calls to {@code ServerApi.evaluateQuery(String)} within the specified class to the specified static 'redirectTo' method in the specified 'redirectTo' class * * @param classToRedirect - Class containing calls to {@code ServerApi.evaluateQuery(String)} * @param redirectToClass - The class containing the static method to be called instead * @param redirectToMethod - The static method to be called instead */ public static void redirectQueryEvaluationCalls( String classToRedirect, String redirectToClass, String redirectToMethod ) { JavaClass compiledClass; try { compiledClass = Repository.lookupClass( classToRedirect ); } catch( ClassNotFoundException ex ) { throw new RuntimeException( "Unable to resolve class [" + classToRedirect + "]", ex ); } // (2) Create a working class from the compiled class (that we can modify) final ClassGen workingClass = new ClassGen( compiledClass ); final ConstantPoolGen constantPool = workingClass.getConstantPool(); // (3) Locate the query evaluation metho…
tagged with: junit
linked to: http://stackoverflow.com/q/21105403
accepted answer: http://stackoverflow.com/a/28342439
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26806809
tagged with: java
linked to: http://stackoverflow.com/q/12119720
has answer: http://stackoverflow.com/a/26806809
type: Question
has comment: http://stackoverflow.com/comment/42185039
answer count: 2
tagged with: bcel
has comment: http://stackoverflow.com/comment/42185025
has answer: http://stackoverflow.com/a/28342439
has title: Replace method call at runimte in JUnit test case using BCEL?
has comment: http://stackoverflow.com/comment/42183961
score: 0

http://stackoverflow.com/a/26699686
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41993482
accepted answer of: http://stackoverflow.com/q/26699606
score: 0
has comment: http://stackoverflow.com/comment/41994025
type: Answer
has comment: http://stackoverflow.com/comment/41993255
has comment: http://stackoverflow.com/comment/41993662
has comment: http://stackoverflow.com/comment/41993649
has body: Try: pst = getConnection().prepareStatement("DELETE FROM customer WHERE code = '"+ code + "' and id IN (select * from (SELECT MAX(c.id) FROM customer c where code = '"+ code + "') as d)");
answers question: http://stackoverflow.com/q/26699606

http://stackoverflow.com/comment/41966880
type: Comment
type: QuestionComment
has text: it should have been "aardvarak" as the desired output
score: 0
comment on: http://stackoverflow.com/q/26682595

http://stackoverflow.com/a/26836842
type: Answer
has body: TCP/IP is a standardized protocol, just about every platform has an implementation of it. So yes, you can have a Java client and a C++ client and a C# client and a Pyphon client and any other client written in any other TCP-enabled language all connected to the same server at the same time.
answers question: http://stackoverflow.com/q/26832359
accepted answer of: http://stackoverflow.com/q/26832359
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/42139796
has text: thats true, ty. I removed it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26781139
type: Comment

http://stackoverflow.com/comment/41964852
has text: yeah im stuck on reading the fib. seq.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26683089

http://stackoverflow.com/comment/42211212
comment on: http://stackoverflow.com/q/26819914
score: 0
type: Comment
type: QuestionComment
has text: @RyanJ I got it I got it I got it... this little detail caused me a lot of pain and 2 days to find... now it makes the whole singly linked list a lot easier, since I know this little flaw I had in my class. Thanks a lot!

http://stackoverflow.com/comment/42234028
type: QuestionComment
has text: @FilipBartuzi - There was no CharSequence. It was an afterthought. A better design would have had String be a subclass of a common class that also had a MutableString subclass or some such, but that didn't happen.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26828405

http://stackoverflow.com/comment/42131140
type: Comment
type: QuestionComment
has text: Yes please, a example will go a long way to helping the community figure out the problem.
comment on: http://stackoverflow.com/q/26767407
score: 0

http://stackoverflow.com/q/26776440
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26799619
type: Question
has title: howt to get Parent Value from firebase java
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26785487
has answer: http://stackoverflow.com/a/26785487
has body: I'm currently new to Firebase. I put a key in-->> user->answer->key->true and then I used this : Firebase re = New Firebase(blabla..user-&gt;answer); refLoadId_Question_Question.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Map&lt;String, Object&gt; newPost = (Map&lt;String, Object&gt;) dataSnapshot.getValue(); System.out.println("Id_question1: " + dataSnapshot.getValue()); System.out.println("Id_question1: " + dataSnapshot.getChildren().toString()); list_id_question.add(dataSnapshot.getKey()); } @Override public void onCancelled(FirebaseError firebaseError) { } }); I receive : Id_question1: {-Ja3RTtq5DMGIdVF9-pC=true} in dataSnapsho.getValue(); my Question is it Possible to get key Value from Object type in java? I want to get this value :-Ja3RTtq5DMGIdVF9-pC anyone Please help? Thanks..
accepted answer: http://stackoverflow.com/a/26799619
tagged with: firebase

http://stackoverflow.com/q/26706654
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: datagram
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/26706884
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26706884
has title: Receiving Datagram packets are not displayed
has body: I was trying to make a small java program which writes a text message from server to client using DatagramServer and DatagramPacket. This is the code i've written on the server and client portion. serverm.java byte b[] = new byte[1200]; System.out.println("Enter some text"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputMessage = br.readLine(); b = inputMessage.getBytes(); DatagramSocket d = new DatagramSocket(6125); DatagramPacket p = new DatagramPacket(b,i,InetAddress.getLocalHost(),5461); d.send(p); clientm.java byte b[] = new byte[1024]; try { DatagramSocket d = new DatagramSocket(5461); DatagramPacket p = new DatagramPacket(b,1024); d.receive(p); String outputMessage = new String(p.getData(),0,p.getLength()); System.out.println(outputMessage); } When running the java program, it runs when the server sends a message to the client - the received message only prints empty line. How can i get the string to be displayed ?

http://stackoverflow.com/q/26817013
possible better answer: http://stackoverflow.com/a/26933851
favorite count: 0
has answer: http://stackoverflow.com/a/26933851
accepted answer: http://stackoverflow.com/a/26818028
upvote count: 1
tagged with: parallel-processing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5686200
has comment: http://stackoverflow.com/comment/42204666
score: 1
tagged with: java
tagged with: multiprocessing
type: Question
answer count: 2
tagged with: for-loop
has body: Edit: The answers given by 'Z Boson', 'Chiron' and 'Mattias F' are probably exactly what I need. However, I don't know any C or C++ which is a requirement for OPENMP and JNI. OpenCL does have existing third party Java API available, but I don't know how efficient the GPU will be for my needs. I found an interesting solution here: Parallelizing a for loop, but will this reduce my computation time by multiple hours? I will eventually implement the C++ methodology, but for now I need a quick fix. Any additional advice? I have a problem where I need to iterate a series of operations across all 2^n combinations of n elements, the code for which may be found here: https://stackoverflow.com/questions/26577172/brute-force-optimally-deleting-2s-from-a-random-matrix-how-can-i-make-it-fas. Until I figure out the maths behind my random matrices, I want to optimize the current process as much as possible because iterating across n = 24 takes hours even after configuring my Java JVM (hotspot) for high throughput via the command line. Hence, if I were to implement multiprocessing/parallel computing across all four of my CPU cores, would this substantially decrease the time to completion? I ask because I know nothing about multiprocessing/threading nor its implementation and am only in a first semester introductory course to java. I don't want to waste time learning this if it's ill advised. Specifically, in this situation (from what I've read on S.O. thus far), I would submit at least 'n' batches of jobs where each batch contains at most all the combinations of 'x &lt; n' elements from n for some x. Advice?
downvote count: 0
has comment: http://stackoverflow.com/comment/42204827
has answer: http://stackoverflow.com/a/26818028
has comment: http://stackoverflow.com/comment/42205375
has title: Is 'parallelizing' my for loop the right choice? (Without JNI/OPENMP)

http://stackoverflow.com/q/26831895
type: Question
has comment: http://stackoverflow.com/comment/42230452
answer count: 2
has comment: http://stackoverflow.com/comment/42230439
upvote count: 0
has title: printing number 6 using nested loops
possible better answer: http://stackoverflow.com/a/26832049
has body: my cod is supposed to print this: 6666 6 6 6666 6 6 6666 where as my cod is printing can you find the mistake in mu code: 6 66 6 this is my code : if (x == 6) { for (int i = 1; i &lt;= 5; i++) { if (i == 1 &amp;&amp; i == 3 &amp;&amp; i == 5) for (int k = 1; k &lt;= 4; k++) System.out.print(x); if (i == 2) { System.out.println(x); System.out.print(x); } if (i == 4) System.out.print(x + " " + x); } System.out.println(); }
accepted answer: http://stackoverflow.com/a/26832053
has comment: http://stackoverflow.com/comment/42230421
favorite count: 0
has comment: http://stackoverflow.com/comment/42230409
has answer: http://stackoverflow.com/a/26832053
score: -3
has answer: http://stackoverflow.com/a/26832049
type: AnsweredQuestion
tagged with: java
downvote count: 3
tagged with: loops

http://stackoverflow.com/comment/42107157
has text: getInstance of action bar in that fragment and setDisplayHomeAsUpEnabled to false
score: 0
comment on: http://stackoverflow.com/q/26762917
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42057642
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26735084
has text: @NaveenTamrakar The code in the linked article will not prevent a new instance of the activity being created, which is what OP wants.

jersey
tags question: http://stackoverflow.com/q/26804823
tags question: http://stackoverflow.com/q/26829456
tags question: http://stackoverflow.com/q/26757099
tags question: http://stackoverflow.com/q/26739673
tags question: http://stackoverflow.com/q/26804330
tags question: http://stackoverflow.com/q/26818492
tags question: http://stackoverflow.com/q/26678546
tags question: http://stackoverflow.com/q/26778891
tags question: http://stackoverflow.com/q/26673405
tags question: http://stackoverflow.com/q/26697102
tags question: http://stackoverflow.com/q/26749793
tags question: http://stackoverflow.com/q/26793672
tags question: http://stackoverflow.com/q/26814901
tags question: http://stackoverflow.com/q/26694544
tags question: http://stackoverflow.com/q/26683225
tags question: http://stackoverflow.com/q/26781613
tags question: http://stackoverflow.com/q/26784297
tags question: http://stackoverflow.com/q/26736716
tags question: http://stackoverflow.com/q/26823338
tags question: http://stackoverflow.com/q/26803622
tags question: http://stackoverflow.com/q/26830759
tags question: http://stackoverflow.com/q/26762195
tags question: http://stackoverflow.com/q/26751854
tag name: jersey
tags question: http://stackoverflow.com/q/26681603
tags question: http://stackoverflow.com/q/26763039
tags question: http://stackoverflow.com/q/26760555
tags question: http://stackoverflow.com/q/26796363
tags question: http://stackoverflow.com/q/26732194
tags question: http://stackoverflow.com/q/26738564
tags question: http://stackoverflow.com/q/26728736
tags question: http://stackoverflow.com/q/26709288
tags question: http://stackoverflow.com/q/26794176
tags question: http://stackoverflow.com/q/26765891
tags question: http://stackoverflow.com/q/26755170
type: Tag
tags question: http://stackoverflow.com/q/26675905
tags question: http://stackoverflow.com/q/26714380

http://stackoverflow.com/comment/42194943
type: AnswerComment
comment on: http://stackoverflow.com/a/26811098
type: Comment
has text: It is reasonable to assume that the oracle list is larger than the ms list, otherwise there would be lots of misses. If so, although convenient to call `removeAll()`, there are negative performance implications to doing so, because logically there will be many pointless calls to remove items not in the set.
score: 0

http://stackoverflow.com/comment/42267077
comment on: http://stackoverflow.com/a/26820555
score: 0
type: AnswerComment
has text: i added a filter page for adddvdform servlet and so null ptr ex. is thrown .. thanks i identified err reason in error stack .. thanks RRR i appreciate ur willingness to help in this case .. my code works fine.. –
type: Comment

http://stackoverflow.com/q/26696847
has comment: http://stackoverflow.com/comment/41988417
has title: Impossible to create a new app with Eclipse
score: 0
has comment: http://stackoverflow.com/comment/41990212
tagged with: java
has body: With Eclipse, I can't succeed in creating a new Android app. After having clicked on "File"-"Android application project", I choose the options I need but, when I click on the "Finish" button, the application hangs... Currently, it is telling me "Refreshing external folders:(99%)" and this message appeared 5 minutes ago. I have seen in other questions that the problem could be related to the ".android" folder, so I deleted it and restarted the SDK manager to recreate it. No improvement! I have also tried several times to uninstall the SDK and Eclipse but with no result... What can I do? I use Eclipse Luna and my SDK is up to date.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41990242
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41990105
answer count: 0
tagged with: sdk
type: Question
linked to: http://stackoverflow.com/q/8309203
tagged with: android

http://stackoverflow.com/a/26827646
type: Answer
has body: Try something like: boolean valid = false; while(valid == false){ //input code here //if statement changing 'valid' to true, if the input is valid }
answers question: http://stackoverflow.com/q/26827562
score: 0

http://stackoverflow.com/a/26699230
score: 0
has body: You can use DecimalFormat like this: DecimalFormat myFormatter = new DecimalFormat("###,###,###"); System.out.print(myFormatter.format(value)); Please reder to this page for more info on formatters http://docs.oracle.com/javase/tutorial/java/data/numberformat.html
type: Answer
answers question: http://stackoverflow.com/q/26699172

http://stackoverflow.com/comment/42058389
has text: But do you have any ideas?
comment on: http://stackoverflow.com/a/26736000
type: Comment
score: 0
type: AnswerComment

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/26753414
tags question: http://stackoverflow.com/q/26680667
tags question: http://stackoverflow.com/q/26685038
type: Tag

http://stackoverflow.com/comment/42123660
comment on: http://stackoverflow.com/q/26709202
has text: It seems like OpenID is the right way to go. I looked online and found the openid4java library (https://code.google.com/p/openid4java/) which seems to be what I'm looking for. The only issue is that I have no idea how to set it up. When I import it to eclipse as a Maven project, it keeps telling me that I have an error of some sort.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42020338
type: Comment
type: QuestionComment
has text: Looks to me like this is the `org.json` library.
score: 1
comment on: http://stackoverflow.com/q/26714110

http://stackoverflow.com/a/26759701
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: It seems like File.deleteOnExit() is fragile when it comes to process termination. In contrast, using the NIO API with the StandardOpenOption.DELETE_ON_CLOSE seems to be more reliable even though it’s specification only says: “If the close method is not invoked then a best effort attempt is made to delete the file when the Java virtual machine terminates” E.g. when running the following program: File f1=File.createTempFile("deleteOnExit", ".tmp"); f1.deleteOnExit(); final Path f2 = Files.createTempFile("deleteOnClose", ".tmp"); FileChannel ch = FileChannel.open(f2, StandardOpenOption.DELETE_ON_CLOSE); System.out.println(f1); System.out.println(f2); LockSupport.parkNanos(Long.MAX_VALUE); // the following statement is never reached, but it’s here to avoid // early cleanup of the channel by garbage collector ch.close(); and killing the process while it hangs at parkNanos, the JVM leaves the deleteOnExit tmp file while correctly deleting the deleteOnClose file on my machine.
answers question: http://stackoverflow.com/q/26754424

http://stackoverflow.com/comment/41946951
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26673544
score: 0
has text: Try `myWebView.loadUrl("http://gastro.hero.ch/index.php");` instead

http://stackoverflow.com/a/26797009
upvote count: 2
answers question: http://stackoverflow.com/q/26795976
has comment: http://stackoverflow.com/comment/42172688
type: Answer
downvote count: 0
score: 2
has body: No The jvm extracts the jar file to the memory and not to the file. It reads the MANIFEST.MF inside META-INF which has an entry for the main class. Jvm looks for the public static void main class inside this main class. This is how jvm finds the main class and executes the executable jar files

http://stackoverflow.com/a/26718527
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26718422
has body: There are three methods that might help Date.before(Date), Date.after(Date) and Date.equals(Date) you could do something like public static int compareTo(Date a, Date b) { if (a.equals(b)) return 0; return (a.before(b) ? -1 : 1); }

http://stackoverflow.com/comment/42075829
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26680241
score: 0
has text: My new code works on Windows but not on Linux. Any ideas? I also added the new code.

http://stackoverflow.com/comment/41951184
type: AnswerComment
comment on: http://stackoverflow.com/a/26676028
type: Comment
has text: Thanks to the Jboss Dev Thread: https://developer.jboss.org/message/817632#817632
score: 0

http://stackoverflow.com/comment/42168652
type: QuestionComment
comment on: http://stackoverflow.com/q/26797316
has text: have you tried `System.getProperty("os.name")` ?
score: 0
type: Comment

http://stackoverflow.com/q/26828405
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42224440
has comment: http://stackoverflow.com/comment/42233990
has title: Why Java's String has the method length() rather than property length (like an array?)
answer count: 1
has comment: http://stackoverflow.com/comment/42232664
linked to: http://stackoverflow.com/q/14856327
has comment: http://stackoverflow.com/comment/42232035
has comment: http://stackoverflow.com/comment/42224659
tagged with: java
has comment: http://stackoverflow.com/comment/42234051
has comment: http://stackoverflow.com/comment/42224274
upvote count: 1
has comment: http://stackoverflow.com/comment/42224285
has comment: http://stackoverflow.com/comment/42224370
has answer: http://stackoverflow.com/a/26828518
has comment: http://stackoverflow.com/comment/42224604
has comment: http://stackoverflow.com/comment/42234028
linked to: http://stackoverflow.com/q/1965500
has comment: http://stackoverflow.com/comment/42232714
has comment: http://stackoverflow.com/comment/42224308
has body: Java has immutable strings so its initialised size never changes (like size of an array). The question is - if size never changes why Java requires to call a method length() rather than property length like in an array? Is length()
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/1965500
has comment: http://stackoverflow.com/comment/42224323
downvote count: 0
accepted answer: http://stackoverflow.com/a/26828518
score: 1
tagged with: string

http://stackoverflow.com/a/26769630
has comment: http://stackoverflow.com/comment/42119729
accepted answer of: http://stackoverflow.com/q/26769565
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42119777
answers question: http://stackoverflow.com/q/26769565
has comment: http://stackoverflow.com/comment/42119845
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42119751
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42119829
has body: You could concatenate the results from each recursive call with the root value to get a string with the whole list, which could then be returned.
has comment: http://stackoverflow.com/comment/42120462

http://stackoverflow.com/q/26695904
favorite count: 0
tagged with: timer
type: UnansweredQuestion
tagged with: animation
upvote count: 1
has title: My Animation Moves Across The Screen Too Fast (Graphics) (Beginner)
tagged with: performance
has comment: http://stackoverflow.com/comment/41986767
score: 1
tagged with: java
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/26695928
answer count: 1
downvote count: 0
has body: I'm doing a project for school and I chose to recreate Duck Hunt. It's coming along pretty well so far, except for one problem, the ducks that fly out move way too fast, I have it setup as follows, the x and y are obviously the x and y coordinates of the duck that's flying and I have a loop that does y--. But like I said that goes up far too fast, and I can't use doubles with the graphics class, only an int. Heres the code I write. (First post, I think I posted the code correctly, sorry if I didn't) import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.awt.TextField; import java.awt.MouseInfo; public class duck extends Applet implements ActionListener, MouseListener{ boolean start= true; int x; int y=400; int bx=350; int by= 285; int counter=1; int c=2;// (int) (Math.random()*4)+1; boolean dog=true; boolean dog3=false; boolean bird=false; public void init(){ } public void paint(Graphics g){ //BackGround this.resize (612,574); g.drawImage(getImage(getCodeBase(), "background.png"), 0, 0, this); g.drawString("" +c, 10, 300); //Crosshair Follow g.drawOval (MouseInfo.getPointerInfo().getLocation().x-24, MouseInfo.getPointerInfo().getLocation().y-63, 50, 50); g.drawLine (MouseInfo.getPointerInfo().getLocation().x-24, MouseInfo.getPointerInfo().getLocation().y-37, MouseInfo.getPointerInfo().getLocation().x+24, MouseInfo.getPointerInfo().getLocation().y-37); g.drawLine (MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y-64, MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y-15); g.drawString ("" +MouseInfo.getPointerInfo().getLocation().x +" " +MouseInfo.getPointerInfo().getLocation().y, 100, 100); //this.repaint(); //Dog if (dog==true) g.drawImage(getImage(getCodeBase(), "dog.gif"), x, y, this); x++; this.repaint(); if (x&gt;200){ dog=false; dog3=true; } if (y&lt;285){ dog3=false; //this.repaint(); } if (dog3==true){ y=y-1; bird=true; } //Bird if (bird==true ){ //Start Path…

http://stackoverflow.com/a/26807862
upvote count: 2
has body: AFAIK -- the answer is no (at least not officially). The only two supported auth schemes at the moment are Basic Auth + OAuth (http://dropwizard.io/manual/auth.html). I wasn't able to find any third party authenticators either -- sorry :(
downvote count: 0
answers question: http://stackoverflow.com/q/26804030
type: Answer
score: 2

http://stackoverflow.com/comment/42099684
score: 0
type: Comment
type: QuestionComment
has text: Ok. Than its done. Maybe Android 5 will provide you the possibilty to do what you want, as it introduces Peripheral mode to android
comment on: http://stackoverflow.com/q/26752480

http://stackoverflow.com/comment/42017868
score: 0
has text: So, are you doing recursion for both else-if statements? I don't get the part where you wrote matchedLinesInFile. Is this a new method you wrote or? Also, I've gone ahead and traversed the directories, but I still don't know how to read the files. I've written something, but it's not actually counting the strings read.
type: Comment
comment on: http://stackoverflow.com/a/26695221
type: AnswerComment

http://stackoverflow.com/comment/42175289
type: QuestionComment
comment on: http://stackoverflow.com/q/26800772
type: Comment
has text: Do mean that you want to start some other activity other than Home Activity or Do you want to resume an existing Home activity screen?
score: 0

http://stackoverflow.com/comment/42071406
comment on: http://stackoverflow.com/q/26742595
score: 0
type: Comment
type: QuestionComment
has text: I would call the `radioGroup.setOnCheckedChangeListener( ... )` stuff separately, outside of the `OnClickListener` code.

http://stackoverflow.com/comment/42113989
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26766446
has text: try to see it from this perspective: once you make the check in line 40, then there is no use to make another check whether the array is not null, because at that point you are sure that it's not null. you have 2 options - throw it out completely or move it in front of the 'greater/less than' check.

http://stackoverflow.com/comment/42096293
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26757066
has text: @forgivenson See error at the end

http://stackoverflow.com/comment/42110118
type: Comment
comment on: http://stackoverflow.com/q/26764476
score: 0
has text: Did you clean the project already? It sometimes also helps to close eclipse and open it again.
type: QuestionComment

http://stackoverflow.com/a/26813952
answers question: http://stackoverflow.com/q/26813935
has comment: http://stackoverflow.com/comment/42199617
has body: You might create a method like onlyDigits(String) and use a Pattern with your provided regex like private static Pattern pattern = Pattern.compile("[2-9]+"); public static boolean onlyDigits(String in) { Matcher m = pattern.matcher(in); return m.matches(); } Then you can call it like public static void main(String[] args) { System.out.println(onlyDigits("123")); System.out.println(onlyDigits("123a")); System.out.println(onlyDigits("234")); }
has comment: http://stackoverflow.com/comment/42199596
score: 0
type: Answer

http://stackoverflow.com/q/26754164
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26761720
has comment: http://stackoverflow.com/comment/42092539
has comment: http://stackoverflow.com/comment/42091382
has body: I have to calculate the next date based on the current date. For example, say today is '05-NOV-2014' and user have gave an input like 1st Monday. so based on the user input if the 1st Monday of the current month has already gone past then i have to find out the 1st Monday of next month. if the 1st Monday is yet to come in the current month then i have to find out the date within the current month. I am using java.util.Calendar class. //user inputs int dayOfWeek = 3; // as user has provided 'Tuesday' int noOfWeek = 1; // as user provided 1st Calendar cal = Calendar.getInstance(); // getting the current instance. int currentDayOfWeek = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); // getting the cCurrentDayOfWeek in integer. int currentNoOfWeek = Calendar.getInstance().get(Calendar.DAY_OF_WEEK_IN_MONTH); // getting which week it is in the current month if(noOfWeek &lt; currentNoOfWeek){ // the date has gone past in the current month. } else if ((noOfWeek == currentNoOfWeek) &amp;&amp; dayOfWeek &lt; currentDayOfWeek){ // though the week number is same but as the currentDayOfWeek is greater than the provided day so in this case also date has gone past in the current month. } No able to proceed further. seeking your help.
accepted answer: http://stackoverflow.com/a/26761720
tagged with: java.util.calendar
upvote count: 2
score: 2
type: AnsweredQuestion
has title: How to get the date of next specified day of week
possible better answer: http://stackoverflow.com/a/26758390
tagged with: java
has answer: http://stackoverflow.com/a/26758390
tagged with: date
type: Question

http://stackoverflow.com/comment/41970032
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26674183
has text: @Seelenvirtuose, I have just changed size, nothing else. If you are sure then tell me what to do changes ?

http://stackoverflow.com/comment/41960857
comment on: http://stackoverflow.com/q/26680886
type: QuestionComment
has text: no i want just the link for yahoo finance and how to use it with JList in java
score: 0
type: Comment

http://stackoverflow.com/q/26747831
possible better answer: http://stackoverflow.com/a/26750500
has answer: http://stackoverflow.com/a/26750500
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26748050
upvote count: 18
type: Question
answer count: 2
downvote count: 0
score: 18
tagged with: jsp
has title: JSP Expression Language get parameter
has answer: http://stackoverflow.com/a/26748050
favorite count: 0
tagged with: el
has body: I am trying to get a String parameter "username" from the request with Expression Language. I've done some research, but couldn't find a way to do so, I would like something similar to ${pageContext.request.parameter.username} How get a specific request parameter, using only expression language?

http://stackoverflow.com/a/26693828
has body: Made in in one line, and removed the SELECT db; and it worked. Here's my query PreparedStatement sql = con.prepareStatement("CREATE TABLE IF NOT EXISTS " + db + ".blocks (`player` varchar(16) NOT NULL, `itemid` text NOT NULL, `location` text NOT NULL, `action` text NOT NULL, `time` bigint(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26690465

http://stackoverflow.com/q/26768195
tagged with: java
has answer: http://stackoverflow.com/a/26768434
has answer: http://stackoverflow.com/a/26768554
tagged with: loops
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26768434
score: -1
has answer: http://stackoverflow.com/a/26768636
upvote count: 0
has body: First off I'm sorry if this is a wierd one, but I don't exactly know what I'm trying to do in coding terms. To clarify what I wish to do, I want to know a way to "Save" the value of receipt to either a list/set/array then go trough the process that determined the value of receipt and save that to the list again, and when I print the list the two different values of receipt are printed after eachoter. Lets say first time the value of receipt was determined it was equal to x, then after I've saved that to a list and gone trough the same value determening process receipt= y and I add that to the list. Would it print: x and then y. Or y and y? And if it prints the new value of receipt twice, how do I make it print the two different values after eachother? import java.util.Scanner; public class TicketV005 { // start of public class public static void main (String [] args) { // start of main Scanner keyboard = new Scanner(System.in); int printedTickets,ticketTotal; String fareType, purchaseLoc; String answer1 =("null"); String receipt =("null"); int zoneAmount = 0; double price = 0; int answer2 = 0; System.out.print("How many tickets do you wish to buy?(Answer with a number please.) "); ticketTotal = keyboard.nextInt(); printedTickets = 0; while (ticketTotal &lt;= 0) { System.out.println("\nIncorrect input, try again."); System.out.println("How many tickets do you wish to buy?(Answer with a number please.) "); ticketTotal = keyboard.nextInt(); } while(ticketTotal !=printedTickets ) { System.out.print("Welcome! Are you buying a reduced fare ticket?(y/n) "); answer1 = keyboard.next(); if (answer1.equals("y")) fareType=("reduced fare"); else if (answer1.equals("n")) fareType=("standard fare"); else fareType=("null"); while (fareType.equals("null")) { System.out.println("\nIncorrect input, try again."); System.out.println("Welcome! Are you buying a reduced fare ticket?(y/n) "); answer1 = keyboard.next(); } System.out.println("Would you like to purchase your ticket at 1. the a…
tagged with: variables
favorite count: 0
has answer: http://stackoverflow.com/a/26768414
has title: Is there a way to print a variable, alter the same variable and print the two of them in a list?
possible better answer: http://stackoverflow.com/a/26768414
answer count: 4
tagged with: user-input
type: AnsweredQuestion

http://stackoverflow.com/q/26710650
upvote count: 2
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26710680
score: 2
downvote count: 0
type: UnansweredQuestion
has body: I wrote a very simple Java program : class test { public static void main (String args[]) { int i = 23; int j = i/10; System.out.println ("Value of i: " +i); System.out.println ("Value of j: " +j); } } The output is as expected - i = 23 and j = 2 Now, I kept changing the value of i in the program. And the output started to change. The value of i = 02 and the output becomes - i = 2 and j = 0 The value of i = 023 and the output becomes - i = 19 and j = 1 Now I am confused. When I gave the value of i = 023 in the program, in the output I expected to get i = 23 and j = 2. But why is i becoming 19?
has answer: http://stackoverflow.com/a/26711215
has title: Integer leading zero issue in Java
type: Question
has answer: http://stackoverflow.com/a/26710671
tagged with: java

http://stackoverflow.com/comment/41995374
type: QuestionComment
type: Comment
has text: @LuiggiMendoza: i don't see where the error is. What does it mean "you cannot create new instances on a generic definition"?
score: 0
comment on: http://stackoverflow.com/q/26700793

http://stackoverflow.com/q/26760689
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/42102857
linked to: http://stackoverflow.com/q/5245221
answer count: 1
accepted answer: http://stackoverflow.com/a/26760786
has comment: http://stackoverflow.com/comment/42102931
type: AnsweredQuestion
has body: I have many tables created in mysql, Is there any way I convert fields in table to java class with the setter and getter and constructor?
tagged with: java
tagged with: mysql
type: Question
has title: Is there anyway convert mysql table to Java class
has answer: http://stackoverflow.com/a/26760786

http://stackoverflow.com/a/26731730
answers question: http://stackoverflow.com/q/26731566
type: Answer
score: 1
upvote count: 1
has body: I think you'd need native tools for that. You can make pppd answer the call and run a custom script or program. But I have not fiddled with that for a long time. See linux modem howto. There should be plenty of information.
downvote count: 0

http://stackoverflow.com/comment/42158024
type: Comment
comment on: http://stackoverflow.com/a/26790974
type: AnswerComment
has text: I can confirm that @Voo is 100% correct. I've been doing just that for over a decade now with no problems.
score: 0

http://stackoverflow.com/q/26804983
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/49736113
answer count: 1
downvote count: 0
favorite count: 0
has body: I am sending emails from my google app engine app via Java api. I am using the standard code: final Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(adminEmail, "Admin")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(emailAddress, user.getFullName())); msg.setSubject(subject); msg.setContent(msgBody, "text/html; charset=utf-8"); Transport.send(msg); I have also setup DKIM according to the documentation on google apps as outlined here: https://support.google.com/a/answer/174124?hl=en By adding the following TXT records on my godaddy domain setup: host:google._domainkey TXT Value key:v=DKIM1; k=rsa; p=[binary] Also: -the adminEmail account I am sending the emails from has been added as an owner of the google app engine application. -It has been more than 48 hours since I set this up. -My emails do not go to junk for gmail, only hotmail. Am I missing something? Why are my mails going to junk for hotmail?
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: dkim
tagged with: gmail
score: 2
tagged with: java
has title: GAE (Google App engine) generated emails go to hotmail junk folder
tagged with: hotmail

http://stackoverflow.com/comment/42278058
type: AnswerComment
type: Comment
has text: Thanks for the answer ... I was actually confused with `AES` and `RIJNDAEL`. Now I got the answer that I was actually looking for. Best part of answer: `new BufferedBlockCipher(new RijndaelEngine(256))`.
comment on: http://stackoverflow.com/a/26827491
score: 0

http://stackoverflow.com/a/28311734
type: Answer
has body: No, Coherence only persists data that has been modified (e.g. via a put()) by the application. If you need to modify the data without it being written back to the database, I believe you need to signify the update as being a "synthetic" update via an EntryProcessor and the BinaryEntry interface.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26679073
answers question: http://stackoverflow.com/q/26679073
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42185622
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26803003
has text: @ArtjomB. I've restructured that answer, hopefully it's easier to read now.
score: 0

http://stackoverflow.com/q/26830759
answer count: 1
tagged with: jax-rs
favorite count: 0
tagged with: rest
has body: I've created a WebApp that make CRUD operations using a REST server. I use java Jersey and gradle. When I do a POST operation, I send the object in JSON format, as follows: ToDo t = new ToDo(...); // Object to be posted Response response = client.target("http://localhost:8091/todos") .request(MediaType.APPLICATION_JSON) .post(Entity.entity(t, MediaType.APPLICATION_JSON)); But it throws an exception: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class todos.ToDo, genericType=class todos.ToDo. My build.gradle: buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+') } } apply plugin: 'java' apply plugin: 'war' apply plugin: 'jettyEclipse' apply plugin: 'eclipse' apply plugin: 'eclipse-wtp' repositories { mavenCentral() } dependencies { providedCompile 'javax.servlet:javax.servlet-api:3.0.1' compile 'org.glassfish.jersey.core:jersey-client:2.3.1' } Here my full project
type: AnsweredQuestion
score: 3
downvote count: 0
has title: JSON MediaType in Jersey
accepted answer: http://stackoverflow.com/a/26831206
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/26831206
upvote count: 3

http://stackoverflow.com/comment/41963081
type: Comment
has text: Given my experience with game making in C++: it is, IMO, useful to wrap your game a class - this way you can destroy it and create a new one while letting class worry about cleanup/resetting values.
score: 0
comment on: http://stackoverflow.com/q/26682147
type: QuestionComment

http://stackoverflow.com/a/26806088
score: 0
type: Answer
has body: Have you tried to store your TetFields in a dynamic datastructure such as a Map, Set or List?. Then you could iterate through it and get, set or delete the text. Using a set (unordered) or a List (ordered) you are not able to identify it by a specific identifier (name, ID, ...), but using a Map you put an identifier as a key and TextField as a value pair into it which allows to get the unique TextField for a given identifier.
answers question: http://stackoverflow.com/q/26805754
has comment: http://stackoverflow.com/comment/42185952

junit
type: Tag
tags question: http://stackoverflow.com/q/26816050
tags question: http://stackoverflow.com/q/26743097
tags question: http://stackoverflow.com/q/26822288
tags question: http://stackoverflow.com/q/26807844
tags question: http://stackoverflow.com/q/26794313
tags question: http://stackoverflow.com/q/26738169
tags question: http://stackoverflow.com/q/26721377
tag name: junit
tags question: http://stackoverflow.com/q/26802620
tags question: http://stackoverflow.com/q/26715244
tags question: http://stackoverflow.com/q/26720795
tags question: http://stackoverflow.com/q/26744962
tags question: http://stackoverflow.com/q/26805488
tags question: http://stackoverflow.com/q/26804341
tags question: http://stackoverflow.com/q/26677890
tags question: http://stackoverflow.com/q/26698071
tags question: http://stackoverflow.com/q/26673609
tags question: http://stackoverflow.com/q/26753514
tags question: http://stackoverflow.com/q/26802607
tags question: http://stackoverflow.com/q/26752994
tags question: http://stackoverflow.com/q/26714607
tags question: http://stackoverflow.com/q/26718086
tags question: http://stackoverflow.com/q/26830108
tags question: http://stackoverflow.com/q/26783852
tags question: http://stackoverflow.com/q/26796691
tags question: http://stackoverflow.com/q/26832201
tags question: http://stackoverflow.com/q/26816661
tags question: http://stackoverflow.com/q/26741710
tags question: http://stackoverflow.com/q/26727656
tags question: http://stackoverflow.com/q/26716889
tags question: http://stackoverflow.com/q/26724980
tags question: http://stackoverflow.com/q/26775984
tags question: http://stackoverflow.com/q/26776001
tags question: http://stackoverflow.com/q/26791644
tags question: http://stackoverflow.com/q/26776207

http://stackoverflow.com/comment/41977291
type: QuestionComment
comment on: http://stackoverflow.com/q/26690319
has text: then u can use sqlite databse.look this http://www.javaworkspace.com/connectdatabase/connectSQLite.do
score: 0
type: Comment

http://stackoverflow.com/a/26737240
has body: If you need to use different editors/renderers in the same column, you can follow the approach described in this answer and override JTable#getCellEditor() based on the cell (column and row intersection). JTable#getCellRenderer() can be overriden if needed as well. In Concepts: Editors and Renderers is described the strategy followed by tables to get a renderer/editor so you can take advantage of it to solve your problem.
upvote count: 2
answers question: http://stackoverflow.com/q/26736735
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26736735
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/30240074
type: Answer
downvote count: 1
upvote count: 11
has body: 1. Sorting with ASPOSE library Currently, there is no sorting available for Apache POI. I suggest ASPOSE Java for Apache POI. With that library, your class would look like: //Obtain the DataSorter object in the workbook DataSorter sorter = workbook.getDataSorter(); //Set the first order sorter.setOrder1(SortOrder.ASCENDING); //Define the first key. sorter.setKey1(0); //Set the second order sorter.setOrder2(SortOrder.ASCENDING); //Define the second key sorter.setKey2(1); //Create a cells area (range). CellArea ca = new CellArea(); //Specify the start row index. ca.StartRow = 1; //Specify the start column index. ca.StartColumn = 0; //Specify the last row index. ca.EndRow = 9; //Specify the last column index. ca.EndColumn = 2; //Sort data in the specified data range (A2:C10) sorter.sort(cells, ca); Reference: : https://asposeapachepoi.codeplex.com/wikipage?title=Sort%20Data. 2. With Java Collections.sort() If you don't want to or can't use ASPOSE, like me, you could create a class that represents a data row in your source file, which implements java.lang.Comparable. Override the method compareTo with your criteria and use Collections.sort() to sort your list ascendingly. Something like this: //imports omitted public class MyRow implements Comparable&lt;MyRow&gt;{ private String column1; private int column2; @Override public int compareTo(MyRow o) { return this.column1.compareTo(o.column2); } } Then, in your main class (or the class that you want to sort you list of MyRow in), you would code: Collections.sort(yourList&lt;MyRow&gt;);
has comment: http://stackoverflow.com/comment/127551530
answers question: http://stackoverflow.com/q/26718371
score: 10
has comment: http://stackoverflow.com/comment/78152371

http://stackoverflow.com/comment/42136880
comment on: http://stackoverflow.com/q/26779198
type: Comment
type: QuestionComment
has text: Unlike iPhone android 's webkit is not that strong, that it can open a PDF file. You need to use a third party library to open a PDF doc. I would recommend MuPDF library for viewing PDF files on android platform.
score: 1

http://stackoverflow.com/comment/41954186
comment on: http://stackoverflow.com/a/26677616
score: 0
type: Comment
type: AnswerComment
has text: Another Team name can be multi words as well.

http://stackoverflow.com/a/26768150
has comment: http://stackoverflow.com/comment/42118868
has comment: http://stackoverflow.com/comment/42118606
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26767585
has body: No, it's not very efficient. Though it could be worse. At least it's still O(N) where N is the number of decimal digits in the given number. invertInt is not really needed. You are using it because you are appending it to the answer that you pass down the the recursions, which will cause that number to be inverted. But there are at least two other ways to do it so that it won't be inverted. If you note, there is only a very slight difference between the the way you handle negative numbers and positive numbers. Perhaps you can just run the same procedure for both of them, if you remember that processing a negative number is the same as processing its positive opposite, and tacking the - when you're done. There is no reason for all the flags for negative and inversion. Both of them are only done at the top level. So you can do those things at the intToString(int number) function and not in your recursive function, and save yourself a lot of condition checking, and of course, the replaceAll() call. There is no need to pass down the answer. You can base your return value on what the recursive call returned. Remember that for numbers like 1,2,3, you'll get the string '1','2','3'. So if you have 23, and you pass down 2, you can use the 2 you got to build your answer. Your algorithm does not return the correct answer for 0. It's the correct answer when you think in recursive terms, but not when you call it with 0 from main. There are at least two ways to handle that. And a bit of style advice: Always indent your code properly. You don't need to compare boolean values to true or false. If you have a boolean variable x, you can use if (x) or if (!x) rather than if (x==true) and if (x==false). Name your boolean variables in a way that will make this more intuitive, like isNegative or needsInversion. An if (isNegative) makes sense when you read it. More detailed information in case you could not find the solution: How do we avoid the inversion? There are two ways, basically. I…
has comment: http://stackoverflow.com/comment/42130794
answers question: http://stackoverflow.com/q/26767585
has comment: http://stackoverflow.com/comment/42118223
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42119134
has comment: http://stackoverflow.com/comment/42118719
has comment: http://stackoverflow.com/comment/42118548
has comment: http://stackoverflow.com/comment/42117498

http://stackoverflow.com/comment/42174758
type: Comment
has text: When you create an object in this way `FormA classObj = new FormA();` all @Autowired inside that class does not injected.
comment on: http://stackoverflow.com/a/26800589
score: 0
type: AnswerComment

http://stackoverflow.com/a/26695971
has comment: http://stackoverflow.com/comment/42065793
has comment: http://stackoverflow.com/comment/41986995
score: 1
has comment: http://stackoverflow.com/comment/41987009
accepted answer of: http://stackoverflow.com/q/26695850
has comment: http://stackoverflow.com/comment/41986972
has comment: http://stackoverflow.com/comment/41986950
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41987074
downvote count: 0
has comment: http://stackoverflow.com/comment/41987073
has body: There are two ways you can go about this 1) As you are reading them in keep a counter for each word and then when you output this you can output the counter 2) As you are outputting keep a counter and when the word changes then you output the counter and the word and then set the counter back to zero. You can start by in your for loop using String.equals. Then if this is true, increment. If its false then do whatever you need (assign the value somewhere or just output it) and then set the counter to 0.
has comment: http://stackoverflow.com/comment/41987111
has comment: http://stackoverflow.com/comment/41986958
type: Answer
has comment: http://stackoverflow.com/comment/41995524
answers question: http://stackoverflow.com/q/26695850
has comment: http://stackoverflow.com/comment/41986825
has comment: http://stackoverflow.com/comment/41987120
upvote count: 1
has comment: http://stackoverflow.com/comment/41995528

http://stackoverflow.com/comment/42004447
type: QuestionComment
comment on: http://stackoverflow.com/q/26705798
has text: *"on the click of a JMenu button, I want to dynamically add a JTextArea to my JPanel."* Use a `CardLayout` instead.. It is easy and it works.
score: 1
type: Comment

http://stackoverflow.com/comment/43669774
comment on: http://stackoverflow.com/q/26802793
type: Comment
type: QuestionComment
score: 0
has text: you might be right @LucianoRodríguez but now any search will render this link in the top 5 so reasons for downvoting would help

http://stackoverflow.com/a/26771148
answers question: http://stackoverflow.com/q/26770936
score: 0
type: Answer
has body: Just initialize your String variable to null String name = null; It's possible because of the try/catch block for name to get to the sysytem.out line without any value being assigned to it. For example, if userInput.nextLine() raises an illegal argument exception, name will not be assigned a value, yet the rest of the function will execute because the exception is caught. Anything that happens between the exception and the catch line is skipped. Thus, the String "name" could be used before anything is assigned to it; the compiler is therefore forcing you to explicitly initiliaze it. If you could use the variable/memory address without guaranteeing it had been set to a value first, you might find "name" holding erroneous data from the last time that memory address was used. The compiler is guaranteeing that can't happen.

http://stackoverflow.com/a/26721003
has comment: http://stackoverflow.com/comment/42033073
type: Answer
answers question: http://stackoverflow.com/q/26720910
has comment: http://stackoverflow.com/comment/42033124
accepted answer of: http://stackoverflow.com/q/26720910
score: 0
type: AcceptedAnswer
has body: db.notifyAll(); the notifyAll is a method of Object, that is used to wake up all the thread are waiting on this object's monitor. It is not a sqlite-related method, and you don't need to call it (since your db object is not acting as sync-object). You can get rid of that call.
has comment: http://stackoverflow.com/comment/42032942
has comment: http://stackoverflow.com/comment/42032680
has comment: http://stackoverflow.com/comment/42032581

http://stackoverflow.com/comment/42213108
score: 2
has text: *pulls the method* is not any kind of software terminology that anyone understands but you!
type: QuestionComment
comment on: http://stackoverflow.com/q/26821736
type: Comment

http://stackoverflow.com/q/26822178
has comment: http://stackoverflow.com/comment/42213829
has answer: http://stackoverflow.com/a/26823102
has comment: http://stackoverflow.com/comment/42213709
tagged with: java
has title: How to call void method on a GUI button?
type: Question
has comment: http://stackoverflow.com/comment/42213786
has comment: http://stackoverflow.com/comment/42213964
has body: I really need a help with how to call this void method on my button. The point is that the method has to be void according to the requirement. I have the method and the button on which I'm trying to call the method public static void printIntBinary(int x) { if (x &lt;= 0) { } else { // System.out.println(x % 2) printIntBinary(x / 2); System.out.println(x % 2); } } //Portion of my Gui.. runButton actionListner runButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { try{ int mm = Integer.parseInt(binaryTextField.getText()); //I'm having problem down here.. Because my method printInBinary is void type binaryOutPut.append(Recurs.printIntBinary(mm)); } catch(IllegalArgumentException ex){ JOptionPane.showMessageDialog(null, "ertyui"); }
answer count: 1
has comment: http://stackoverflow.com/comment/42214141
has comment: http://stackoverflow.com/comment/42213887
has comment: http://stackoverflow.com/comment/42213866
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/41967081
type: AnswerComment
comment on: http://stackoverflow.com/a/26682828
score: 0
type: Comment
has text: @Daniel you could be right, but in my opinion it looks definitely better without braces in a single-line loop.

http://stackoverflow.com/a/26815599
has body: It works. But only doing you make here is creting new object. Add some more operations for your object. public static void main(String[] args) { Circle myCircle = new Circle(); myCircle.setRadius(); myCircle.display(); } UPD: Also you have some mistakes: diametr = 2 * radius (not radius * radius) public void Circle() - is a function, not constructor. It's bad practice to use methods with the same name as contructor. So if you want it be a constructor remove 'void' It will be more flexible if you will use setRadius method like that: public void setRadius(double r) { radius = r; diameter = 2 * radius; area = Math.PI * radius * radius; }
has comment: http://stackoverflow.com/comment/42202374
answers question: http://stackoverflow.com/q/26815552
score: 0
has comment: http://stackoverflow.com/comment/42202390
type: Answer
has comment: http://stackoverflow.com/comment/42202336

http://stackoverflow.com/comment/41974655
type: QuestionComment
score: 1
has text: You could always use Retrofit's ErrorHandler in the RestAdapter builder. http://square.github.io/retrofit/javadoc/retrofit/ErrorHandler.html
comment on: http://stackoverflow.com/q/26688559
type: Comment

http://stackoverflow.com/a/46520443
has body: I just changed the toolbar theme to be @style/ThemeOverlay.AppCompat.Light and the arrow became dark gray &lt;android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:gravity="center" app:layout_collapseMode="pin" app:theme="@style/ThemeOverlay.AppCompat.Light"&gt;
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/26788464
type: Answer
score: 3

http://stackoverflow.com/q/26822897
type: UnansweredQuestion
has title: Java connection to access database fails?
downvote count: 0
has answer: http://stackoverflow.com/a/26823162
score: 1
tagged with: java
has body: Iam using windows 8.1 (64 bit) with microsoft office 32bit version. Iam trying to connect to an access file to retrieve username and password but the connection to the access database cannot be made, I have searched alot on the internet but can't seem to find a solution for this problem. I downloaded office 64bit with Microsoft Access Database Engine 2010 Redistributable but I still get the same error. What should I do to overcome this issue? Java method: dbcon() { try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:db5"); }catch(Exception e){ System.out.println(e); } } Error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified java.lang.NullPointerException null
type: Question
answer count: 2
tagged with: database
tagged with: odbc
upvote count: 1
tagged with: connection
has answer: http://stackoverflow.com/a/26823015
favorite count: 0

http://stackoverflow.com/a/30138620
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: there is a parameter you have to set which is called either pruned or non-pruned. pruned mean the tree only display the most important leaves of the decision tree. non-pruned mean it displayed every variable in the decision tree. here you are just using pruned tree. if you want the full tree set pruned = "False"
accepted answer of: http://stackoverflow.com/q/26710927
answers question: http://stackoverflow.com/q/26710927

custom-exceptions
type: Tag
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/26766265

http://stackoverflow.com/q/26730388
has comment: http://stackoverflow.com/comment/42049625
favorite count: 0
accepted answer: http://stackoverflow.com/a/26730467
tagged with: spring
tagged with: autowired
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26730489
has answer: http://stackoverflow.com/a/26730489
type: Question
upvote count: 4
has body: I have a package named com.example.service, and in my Spring Configuration class I have the annotation @ComponentScan({"com.example.service"},{"com.example.controller"}). When I try to @Autowire a service, code compilation fails with a NoSuchBeanDefinitionException. The MyService interface is annotated with @Service. Currently I use a quite ugly workaround and declare every single service bean in my ExampleConfig.java like @Bean public MyService myService() { return new MyServiceImpl(); } Generally the @ComponentScan seems to work, if I remove the controller package, the controllers are not found. What did I understand wrong? Please let me know, if I missed out any relevant information.
score: 4
answer count: 2
has comment: http://stackoverflow.com/comment/42050636
has answer: http://stackoverflow.com/a/26730467
downvote count: 0
has title: Spring @ComponentScan for @Service

http://stackoverflow.com/comment/42099062
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26758678
score: 0
has text: Again, I have read that and tried that but where do I put the public static boolean isInteger(String s) { try { Integer.parseInt(s); } catch(NumberFormatException e) { return false; } // only got here if we didn't return false return true; }

http://stackoverflow.com/comment/42149940
score: 0
comment on: http://stackoverflow.com/q/26782787
type: Comment
type: QuestionComment
has text: How does that compare to uncompressed texture data (PNG supports RLE compression, IIRC)? Are you including generated mipmaps, copies made into system and VRAM? How are you measuring memory use (overall JVM, difference pre- and post-loading, or specifically those objects)?

http://stackoverflow.com/a/26791981
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26791913
has body: An alternative way using Collections.reverse(): List&lt;String&gt; list = Arrays.asList("cool", "really", "are", "You"); System.out.println(list); Collections.reverse(list); System.out.println(list); Output: [cool, really, are, You] [You, are, really, cool]
downvote count: 0
type: Answer

http://stackoverflow.com/q/26774019
answer count: 3
has comment: http://stackoverflow.com/comment/42127594
tagged with: url
favorite count: 0
has comment: http://stackoverflow.com/comment/42128126
has answer: http://stackoverflow.com/a/26774136
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42127453
tagged with: java
has body: I was going through java.net package and read this: URLs are "write-once" objects. Once you've created a URL object, you cannot change any of its attributes (protocol, host name, filename, or port number). But, if we look into the java.net.URL we will find this: protected void set(String protocol, String host, int port, String file, String ref) and protected void set(String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) So, I know these are protected methods but these can be accessed via public static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) So, my question is, if that statement I quoted on top is vague or I just misunderstood it?
has answer: http://stackoverflow.com/a/26774113
has answer: http://stackoverflow.com/a/26774934
type: Question
accepted answer: http://stackoverflow.com/a/26774136
has title: How URLs are write once?
score: 5
possible better answer: http://stackoverflow.com/a/26774113
has comment: http://stackoverflow.com/comment/42127415
upvote count: 5
downvote count: 0

http://stackoverflow.com/q/26820637
accepted answer: http://stackoverflow.com/a/26821209
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: maven
has body: I am attempting to run https://github.com/GoogleCloudPlatform/appengine-java-vm-hello with the command mvn appengine:gcloud_app_run. The appengine-maven-plugin makes use of the gcloud command line tools. However, at version 1.9.15 there is currently a bug that does not allow you to use unix:\\\ Sockets as your $DOCKER_HOST. A patch has been written and I was asked to test it; the message is as follows. Can you test 1.9.16-SNAPSHOT with sonatype-nexus-snapshots Sonatype Nexus Snapshots https://oss.sonatype.org/content/repositories/google-snapshots/ true always ? I did try putting the as a direct child of the <project> level of my pom.xml; it seems to accept that although I still have errors when running mvn appengine:gcloud_app_run: [INFO] File "/home/stephen/google-cloud-sdk/lib/docker/docker/tls.py", line 41, in init [INFO] 'Path to a certificate and key files must be provided' [INFO] docker.docker.errors.TLSParameterError: Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See http://docs.docker.com/examples/https/ for API details. [ERROR] Error: gcloud app run exit code= 1 I then tried changing <appengine.target.version>1.9.15</appengine.target.version> in my pom.xml file to 1.9.16-SNAPSHOT ; this time when running mvn appengine:gcloud_app_run I get: [ERROR] Failed to execute goal on project hello: Could not resolve dependencies for project com.google.appengine.demos:hello:war:1.0-SNAPSHOT: Could not find artifact com.google.appengine:appengine-api-1.0-sdk:jar:1.9.16-SNAPSHOT -> [Help 1] So, I have no idea what I am doing. Specifically, I don't know how to upgrade to SNAPSHOT or where I put this thing. If you can resolve the problem I would really appreciate an explanation or link to what is going on here, as there is obviously some background knowledge that I don't have.
answer count: 1
has title: How do I test using SNAPSHOT and where do I put a <pluginRepository>?
tagged with: java
has answer: http://stackoverflow.com/a/26821209
upvote count: 1

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

http://stackoverflow.com/comment/118735314
type: Comment
has text: @Gili in Java we don't put a new line before the opening curly bracket like we do for C++ or C# languages.
type: AnswerComment
comment on: http://stackoverflow.com/a/38947571
score: 0

http://stackoverflow.com/q/26761845
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/35409603
score: 8
favorite count: 0
tagged with: rest
upvote count: 8
has title: In Spring Boot, adding a custom converter by extending MappingJackson2HttpMessageConverter seems to overwrite the existing converter
possible better answer: http://stackoverflow.com/a/35409603
has answer: http://stackoverflow.com/a/26766253
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: media-type
type: Question
tagged with: spring-boot
linked to: http://stackoverflow.com/q/12027668
accepted answer: http://stackoverflow.com/a/26766253
has body: I'm trying to create a converter for a custom media-type like application/vnd.custom.hal+json. I saw this answer here, but it won't work since you don't have access to the protected constructor of AbstractHttpMessageConverter&lt;T&gt; (super class of MappingJackson2HttpMessageConverter). Which means that the following code does not work: class MyCustomVndConverter extends MappingJacksonHttpMessageConverter { public MyCustomVndConverter (){ super(MediaType.valueOf("application/vnd.myservice+json")); } } However, the following does work and basically just mimics what the constructor actually does anyway: setSupportedMediaTypes(Collections.singletonList( MediaType.valueOf("application‌​/vnd.myservice+json") )); So I did this for my class, and then added the converter to my existing list of converters by following Spring Boot's documentation here. My code basically looks like this: //Defining the converter; the media-type is simply a custom media-type that is //still application/hal+json, i.e., JSON with some additional semantics on top //of what HAL already adds to JSON public class TracksMediaTypeConverter extends MappingJackson2HttpMessageConverter { public TracksMediaTypeConverter() { setSupportedMediaTypes(Collections.singletonList( new MediaType("application‌​", "vnd.tracks.v1.hal+json") )); } } //Adding the message converter @Configuration @EnableSwagger public class MyApplicationConfiguration { ... @Bean public HttpMessageConverters customConverters() { return new HttpMessageConverters(new TracksMediaTypeConverter()); } } As per the documentation, this should work. But what I noticed is that this has the effect of replacing the existing MappingJackson2HttpMessageCoverter, which handles application/json;charset=UTF-8 and application/*+json;charset=UTF-8. I verified this by attaching a debugger to my app and stepping through breakpoints inside Spring's AbstractMessageCoverterMethodProcessor.java class. There, the private field messageConverters contains the list o…

http://stackoverflow.com/q/26716215
tagged with: javax.imageio
score: 3
answer count: 0
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42091219
has comment: http://stackoverflow.com/comment/42103303
type: Question
has comment: http://stackoverflow.com/comment/54045946
tagged with: type-conversion
upvote count: 3
has comment: http://stackoverflow.com/comment/42091257
favorite count: 0
has title: Java: Read a CMYK image to BufferdImage and keep the right color model
has comment: http://stackoverflow.com/comment/42103772
type: UnansweredQuestion
tagged with: cmyk
has body: I used the twelvemonkeys collection (extending the imageio functionality (very helpful, thank you for that)) to build an image converter (change format, scale, etc.). Until this converter has to deal with RGB images, everything works fine. But now I have to convert CMYK images as well. It is no problem to read a CMYK image (automatically converted to RGB) and write it to disk. The problem is that the image has to stay in the CMYK format. I tried the following options to solve my problem: a) Use the advanced reading process to set a CMYK color model for the input file: ImageInputStream input = ImageIO.createImageInputStream(file); Iterator&lt;ImageReader&gt; readers = ImageIO.getImageReaders(input); // = com.twelvemonkeys.imageio.plugins.jpeg ImageReader reader = readers.next(); reader.setInput(input); ImageReadParam param = reader.getDefaultReadParam(); for (Iterator&lt;ImageTypeSpecifier&gt; iterator = reader.getImageTypes(0); iterator.hasNext();) { ImageTypeSpecifier currStep = iterator.next(); //Quick and drity test: Search a CMYK image type for the reading process if (currStep.getBufferedImageType() == 0) { param.setDestinationType(currStep); break; } } BufferedImage image = reader.read(0, param); ImageIO.write(image, "jpg", output); reader.dispose(); Result: A CMYK image with very dark colors was produced. b) Read the CMYK image the normal way: BufferedImage img = ImageIO.read(file); //creates an RGB image by befault and try to save it as a CMYK image: Iterator&lt;ImageWriter&gt; writers = ImageIO.getImageWritersByFormatName("jpg"); ImageWriter writer = writers.next(); ImageOutputStream output = ImageIO.createImageOutputStream(outputFile); writer.setOutput(output); //Set DestinationType to CMYK image type ImageWriteParam param = writer.getDefaultWriteParam(); param.setDestinationType(CMYK_IMAGE_TYPE); // Same ImageTypeSpecifier as in the first example used for reading (just for testing) writer.write(img); output.close(); writer.dispose(); Result: A CMYK image w…
tagged with: color-scheme

http://stackoverflow.com/a/26751688
answers question: http://stackoverflow.com/q/26750711
score: 0
has body: byte [] b=str.getBytes(); //will convert string(encoding could only be Unicode in jvm) to bytes using file.encoding. You should check whether the str contains correct information, if so, you need not care the 1047 encoding, just run str.getBytes("IBM-500"), you will get the 500 encoded bytes. Again, String object only use Unicode, if you convert string to bytes, the encoding matters the result bytes array.
type: Answer

http://stackoverflow.com/comment/42186112
score: 0
comment on: http://stackoverflow.com/a/26795686
type: Comment
has text: @Yvainovski Most likely because you left out a **colon**: `"file:/c:/bla/bla/bla/haha.jpg"` is the result of `new File("c:/bla/bla/bla/haha.jpg").toURI().toURL().toString()`.
type: AnswerComment

http://stackoverflow.com/a/26700817
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26700742
type: Answer
has body: You could do: if ( "aeiouAEIOU".indexOf(answerPosition) &gt;= 0 ) { vowels += answerPosition + " "; } inside the loop. Additionally, as a matter of style, you might write the iteration slightly differently: for (char c: answer.toCharArray()) { if ( "aeiouAEIOU".indexOf(c) &gt;= 0 ) { vowels += c + " "; } }

http://stackoverflow.com/a/26810774
type: Answer
answers question: http://stackoverflow.com/q/26806575
has body: The first version is a 'List of any type'. This is not generic, not safe and not recommended. The second version is a 'List of unknown type'. This means you will get objects of the most general type Object, and won't be able to add anything else than null. Since these are the only type safe operations when nothing is known about the type. You might think the version version is more succinct, and it is. However duck typed languages tend to be more succinct, but that doesn't make them the right choice. Using the raw List is only possible due to backwards compatibility, and you will get a compiler warning. For more fun, consider the following types, and how they differ from your two: foo(List&lt;Object&gt; list) foo(List&lt;? extends Object&gt; list) foo(List&lt;? super Object&gt; list) foo(List&lt;? super Iterable&lt;? extends Object&gt;&gt; list)
score: 0

http://stackoverflow.com/q/26701116
has answer: http://stackoverflow.com/a/26709705
has title: Cookies not set with HttpUrlConnection
has body: I'm trying ton connect to a site, according to this page : http://www.mkyong.com/java/how-to-automate-login-a-website-java-example/ But it seems, that the cookies are not set. Cannot find the problem... My aim is to authenticate to this sit in order to grab the Html. If there is another, more simple, solution, don't hesitate. package htmlmKyongTest; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.CookieHandler; import java.net.CookieManager; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import javax.net.ssl.HttpsURLConnection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class HttpUrlConnectionExample { private List&lt;String&gt; cookies; private HttpsURLConnection conn; private final String USER_AGENT = "Mozilla/5.0"; public static void main(String[] args) throws Exception { String url = "https://www.entea.fr/"; String gmail = "https://www.entea.fr/etabs/0671688W/Pages/Accueil.aspx"; HttpUrlConnectionExample http = new HttpUrlConnectionExample(); // make sure cookies is turn on CookieHandler.setDefault(new CookieManager()); // 1. Send a "GET" request, so that you can extract the form's data. String page = http.GetPageContent(url); String postParams = http.getFormParams(page, "myUsername", "myPassword"); // 2. Construct above post's content and then send a POST request for // authentication http.sendPost(url, postParams); // 3. success String result = http.GetPageContent(gmail); System.out.println(result); } private void sendPost(String url, String postParams) throws Exception { URL obj = new URL(url); conn = (HttpsURLConnection) obj.openConnection(); // Acts like a browser conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Host", "www.entea.fr"); conn.setRequestProperty("User-Agent", USER_…
tagged with: httpsurlconnection
accepted answer: http://stackoverflow.com/a/26709705
type: AnsweredQuestion
tagged with: cookies
tagged with: java
tagged with: authentication
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/42009817
score: 2
comment on: http://stackoverflow.com/q/26708843
has text: equalsIgnoreCase is you what you should peek at!
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26750783
answers question: http://stackoverflow.com/q/26736164
type: Answer
upvote count: 17
downvote count: 0
has body: First, I strongly recommend you use the webupd8 ppa sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Then to set it sudo update-java-alternatives -s java-8-oracle The advantage is ease of updates.
score: 17

fractions
type: Tag
tags question: http://stackoverflow.com/q/26812131
tag name: fractions

http://stackoverflow.com/comment/42156579
comment on: http://stackoverflow.com/q/26790248
type: Comment
has text: The mistake you make is in assuming that code you inherit must be useful or have a reason for existing.
type: QuestionComment
score: 7

http://stackoverflow.com/comment/42007643
score: 0
type: Comment
type: QuestionComment
has text: @deduplicator - this is a well known consequence of the degree to which android divorces the concept of a user-visible session from that of the hosting process. It is in effect a conceptual problem. No code is required.
comment on: http://stackoverflow.com/q/26707363

http://stackoverflow.com/q/26736164
upvote count: 5
has answer: http://stackoverflow.com/a/26750755
has answer: http://stackoverflow.com/a/26750686
accepted answer: http://stackoverflow.com/a/26750686
has answer: http://stackoverflow.com/a/26750783
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/37471230
tagged with: eclipse
has answer: http://stackoverflow.com/a/26749942
has body: I install ubuntu 14.04 LTS (64bit) After that Install Eclipse Luno Standard for 64bit Install Jdk and follow all the step for setting jdk using following link, http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux Then After I enable to start my eclipse it giving me a following Error, VM terminated. Exit code=2 /usr/bin/java -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms256m -Xmx1024m -jar /home/eheuristic/Ecclipse/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415- 2008.jar -os linux -ws gtk -arch x86_64 -showsplash /home/eheuristic/Ecclipse/eclipse//plugins/org.eclipse.platform_4.4.0.v20140925- 0400/splash.bmp -launcher /home/eheuristic/Ecclipse/eclipse/eclipse -name Eclipse --launcher.library /home/eheuristic/Ecclipse/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1. 200.v20140603-1326/eclipse_1605.so -startup /home/eheuristic/Ecclipse/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.appendVmargs -exitdata 208017 -product org.eclipse.epp.package.java.product -vm /usr/bin/java -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms256m -Xmx1024m -jar /home/eheuristic/Ecclipse/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar I so much try to solve setting Environment variable but can't do, help me one suggest to how to solve it.
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/26750783
downvote count: 0
answer count: 6
tagged with: ubuntu
tagged with: environment-variables
tagged with: android
has answer: http://stackoverflow.com/a/40211739
has title: Eclipse does not launch (Ubuntu) : JVM terminated. Exit code=2
favorite count: 0

http://stackoverflow.com/comment/41993142
type: AnswerComment
has text: I had a previous version that suffered from the same problem where I checked inside the getSingleton() to see if it existed, and if not, created it. I believe that would do the same thing as this, and that didn't work.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26699551

http://stackoverflow.com/comment/42183248
has text: Im sure you can still use the setMaximumSize() no?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26804620
score: 0

http://stackoverflow.com/q/26777302
accepted answer: http://stackoverflow.com/a/26777411
answer count: 1
score: 1
favorite count: 0
type: AnsweredQuestion
has body: What can be reason of this exception: java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(TimSort.java:747) at java.util.TimSort.mergeAt(TimSort.java:483) at java.util.TimSort.mergeForceCollapse(TimSort.java:426) at java.util.TimSort.sort(TimSort.java:223) at java.util.TimSort.sort(TimSort.java:173) at java.util.Arrays.sort(Arrays.java:659) at java.util.Collections.sort(Collections.java:217) ... i use comparator like this: private Comparator&lt;SomeObject&gt; comporator = new Comparator&lt;SomeObject&gt;() { public int compare(SomeObject o1, SomeObject o2) { return Double.compare(o2.getValue(), o1.getValue()); } }; public double getValue() { double value = 0; for (Parameter parameter : parametrs()) { value = value + (parameter.getWeight() * parameter.getSomeValue(this)); } return value;//20.0, 23.0 ... } where parameter.getSomeValue: public int getSomeValue(SomeObject process) { return (int) ((System.currentTimeMillis() - process.getPutTime()) / 1000); } in: public void sort() { synchronized (list) { Collections.sort(list, comporator); } } where: List&lt;SomeObject&gt; list = new ArrayList&lt;SomeObject&gt;(); I can't reproduce this exception, but it arises sometimes. Also, can you give code example where this issue appear in 100% of cases?
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/11441666
has answer: http://stackoverflow.com/a/26777411
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/11441666
linked to: http://stackoverflow.com/q/19325256
has title: java.lang.IllegalArgumentException Comparison method violates its general contract! in Collections#sort
duplicate of: http://stackoverflow.com/q/19325256
tagged with: illegalargumentexception

http://stackoverflow.com/q/26690671
has comment: http://stackoverflow.com/comment/41977937
tagged with: playframework
answer count: 1
has comment: http://stackoverflow.com/comment/41978103
linked to: http://stackoverflow.com/q/10282402
favorite count: 0
has answer: http://stackoverflow.com/a/26690856
has comment: http://stackoverflow.com/comment/41978144
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
has body: I have just started working on play framework. I am trying to build rest api, and is using postgresql for my db connection. It is my first time using both play and postgre. I have made a db connection inside build.sbt. But while running the app I am getting the following issue, play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]] at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) ~[play_2.11-2.3.6.jar:2.3.6] at play.api.Configuration.reportError(Configuration.scala:743) ~[play_2.11-2.3.6.jar:2.3.6] at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:247) ~[play-jdbc_2.11-2.3.6.jar:2.3.6] at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:238) ~[play-jdbc_2.11-2.3.6.jar:2.3.6] at scala.collection.immutable.List.map(List.scala:274) ~[scala-library-2.11.1.jar:na] Caused by: org.postgresql.util.PSQLException: FATAL: database "localhost:5432/sampledb" does not exist at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:572) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:177) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc2.AbstractJdbc2Connection.&lt;init&gt;(AbstractJdbc2Connection.java:136) ~[postgresql-9.3-1100-jdbc41.jar:na] at org.postgresql.jdbc3.AbstractJdbc3Connection.&lt;init&gt;(AbstractJdbc3Connection.java:29) ~[postgresql-9.3-1100-jdbc41.jar:na] I have postgre installed in my local in port 5432, my db configuration in application.conf looks like - db.default.driver=org.postgresql.Driver db.default.url="jdbc:postgresql:localhost:5432/sampledb" db.default.user=postgres db.default.password="test" Any help will be highly appreciated, also I will be really grateful, if link to any good tutorial on play with java can be …
accepted answer: http://stackoverflow.com/a/26690856
downvote count: 1
type: Question
has title: Cannot connect to database [default]
has comment: http://stackoverflow.com/comment/41978067
tagged with: postgresql
tagged with: rest

jaxb
tags question: http://stackoverflow.com/q/26740338
tags question: http://stackoverflow.com/q/26806058
tags question: http://stackoverflow.com/q/26752874
tags question: http://stackoverflow.com/q/26767334
tags question: http://stackoverflow.com/q/26767158
tags question: http://stackoverflow.com/q/26802450
tags question: http://stackoverflow.com/q/26747706
tags question: http://stackoverflow.com/q/26677239
tags question: http://stackoverflow.com/q/26722918
tags question: http://stackoverflow.com/q/26803622
tags question: http://stackoverflow.com/q/26762195
tags question: http://stackoverflow.com/q/26767034
tags question: http://stackoverflow.com/q/26719503
tags question: http://stackoverflow.com/q/26774274
tags question: http://stackoverflow.com/q/26733028
tags question: http://stackoverflow.com/q/26765305
tags question: http://stackoverflow.com/q/26797838
tags question: http://stackoverflow.com/q/26784835
tags question: http://stackoverflow.com/q/26816798
tags question: http://stackoverflow.com/q/26823002
tags question: http://stackoverflow.com/q/26767769
tags question: http://stackoverflow.com/q/26755269
tags question: http://stackoverflow.com/q/26789341
tags question: http://stackoverflow.com/q/26797524
tags question: http://stackoverflow.com/q/26714143
tags question: http://stackoverflow.com/q/26780414
tags question: http://stackoverflow.com/q/26822077
tags question: http://stackoverflow.com/q/26692969
type: Tag
tags question: http://stackoverflow.com/q/26774085
tag name: jaxb
tags question: http://stackoverflow.com/q/26743440
tags question: http://stackoverflow.com/q/26673783
tags question: http://stackoverflow.com/q/26676418
tags question: http://stackoverflow.com/q/26682591
tags question: http://stackoverflow.com/q/26799451
tags question: http://stackoverflow.com/q/26800314
tags question: http://stackoverflow.com/q/26793672

http://stackoverflow.com/comment/42256212
type: Comment
type: QuestionComment
has text: Add some more of your code to the question, please.
score: 0
comment on: http://stackoverflow.com/q/26804526

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/26750272
tag name: ksoap2

http://stackoverflow.com/comment/42147346
type: AnswerComment
comment on: http://stackoverflow.com/a/26785249
score: 0
type: Comment
has text: hehe you beat me to it.

http://stackoverflow.com/comment/42134567
has text: @ParagJ How will you use the date and time parts? Should they be strings?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26774847
type: QuestionComment

char
tags question: http://stackoverflow.com/q/26726449
tags question: http://stackoverflow.com/q/26746658
type: Tag
tags question: http://stackoverflow.com/q/26688990
tag name: char
tags question: http://stackoverflow.com/q/26796454
tags question: http://stackoverflow.com/q/26771276

http://stackoverflow.com/a/26749510
score: 3
upvote count: 3
has body: Yes, but your syntax has a few typos. And you should not use Raw Types. Finally, I suggest you use the List interface and read about Autoboxing and Unboxing. public int getNumbers(List&lt;Integer&gt; studentNumbers, int x) { if (x &gt;= 0 &amp;&amp; x &lt; studentNumbers.size()) { return studentNumbers.get(x); } else { return 0; } }
has comment: http://stackoverflow.com/comment/42083418
has comment: http://stackoverflow.com/comment/42083357
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42083385
type: Answer
accepted answer of: http://stackoverflow.com/q/26749463
answers question: http://stackoverflow.com/q/26749463

http://stackoverflow.com/comment/42015997
score: 0
type: AnswerComment
type: Comment
has text: In this case it'will be safer to ensure that your transaction is not `null`
comment on: http://stackoverflow.com/a/26712219

http://stackoverflow.com/a/26824936
score: 0
answers question: http://stackoverflow.com/q/26819705
has body: Here we are talking, right UI component, right terms retrieving component and also how personalization of terms UI Rendering and Personalization: The jquery autocomplete component or similar UI library can be used to add the user specific results (terms) independently along with general search results (from solr). Use Javascript array based implementation to add the results. For Search we have multiple options Using Suggester or Query elevation component. Suggester is best suited if it is more of term suggestion than search results itself. Once the search results are obtained, include the user specific terms into jquery/JS component by adding personal results from the server. Query elevation is typically user agnostic and are terms dependent, but elevation xml can be customized to add a user specific terms for each query so that appropriate documents are added. This option may not fit your use case well given that this is really designed for user specific searches and may involve constant/periodic updates to this xml.
type: Answer

http://stackoverflow.com/comment/42189475
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26807530
type: QuestionComment
has text: Could you please specify which JPA 2.1 dependency you want to use? I mean `groupId:artifactId`.

http://stackoverflow.com/comment/41983745
score: 0
type: Comment
type: QuestionComment
has text: *Code Snippets* are meant to be used with code which can be run by browser like HTML/CSS/JavaScript. Java code should be wrapped in *Code Sample*.
comment on: http://stackoverflow.com/q/26694220

http://stackoverflow.com/comment/42157187
score: 0
type: Comment
has text: @user3864949 I believe using the hash set has a better performance than an array list. but you need do it for your question
comment on: http://stackoverflow.com/a/26790452
type: AnswerComment

http://stackoverflow.com/comment/42070654
type: Comment
has text: There it is! thanks so much I'm still learning this helped a ton.
comment on: http://stackoverflow.com/a/26742393
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42090163
type: Comment
type: QuestionComment
has text: I would've suggested `string1 += string2` but I can't guarantee that it has the best performance and least memory usage.
score: 0
comment on: http://stackoverflow.com/q/26752725

http://stackoverflow.com/comment/42227964
comment on: http://stackoverflow.com/a/26825611
score: 0
type: Comment
has text: Thank you! This was very helpful, I didn't know you could put text fields in an array, I will be sure to use this a lot!
type: AnswerComment

http://stackoverflow.com/comment/41997043
has text: `"I get a NullPointerException i think"` -- know or know not, there is no "think".
score: 1
comment on: http://stackoverflow.com/q/26701829
type: Comment
type: QuestionComment

log4j
tags question: http://stackoverflow.com/q/26717185
tags question: http://stackoverflow.com/q/26738582
tags question: http://stackoverflow.com/q/26697236
tags question: http://stackoverflow.com/q/26826894
tag name: log4j
tags question: http://stackoverflow.com/q/26798290
tags question: http://stackoverflow.com/q/26717078
tags question: http://stackoverflow.com/q/26683777
tags question: http://stackoverflow.com/q/26676331
tags question: http://stackoverflow.com/q/26802822
tags question: http://stackoverflow.com/q/26727775
tags question: http://stackoverflow.com/q/26791074
type: Tag
tags question: http://stackoverflow.com/q/26718233
tags question: http://stackoverflow.com/q/26718495

http://stackoverflow.com/q/26746430
has title: Read Specific Lines from a text file and then outputing java
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26746472
tagged with: arrays
has answer: http://stackoverflow.com/a/26746529
has body: I have a text file that has a list of values formatted like so: FirstName LastName Labs 10, 25, 25, 15, 30, 50, 40, 40, 40, 25, 50 10, 25, 25, 15, 29, 49, 39, 39, 39, 25, 49 Homework 100, 100, 100, 100, 100, 100, 100, 100 100, 100, 100, 100, 100, 100, 100, 93 Quizzes 10, 10, 15, 10, 9, 10, 15 8, 10, 11, 9, 7, 7, 11 Exams 100, 100, 100, 100, 100 96, 78, 88, 62, 92 Is there a way I can take a specific line, say the line under exams where it reads all 100, and store just that line into a 1D array?
score: 0
has comment: http://stackoverflow.com/comment/42078199
has comment: http://stackoverflow.com/comment/42078262
type: UnansweredQuestion

http://stackoverflow.com/a/26710699
accepted answer of: http://stackoverflow.com/q/26709610
type: Answer
downvote count: 0
score: 1
has body: I could confirm the correct writing under Spring 3.2 is &lt;mvc:annotation-driven enableMatrixVariables="true" &gt; Here is an extract of a working xml file for Spring Framework 3.2.4 &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:c="http://www.springframework.org/schema/c" xmlns:p="http://www.springframework.org/schema/p" 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.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;mvc:annotation-driven enableMatrixVariables="true" &gt; Note the references to 3.2 schemas
answers question: http://stackoverflow.com/q/26709610
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26772716
answers question: http://stackoverflow.com/q/26772466
has body: you could probably do this with a monitoring thread that fired at set intervals, but you would have the issue of mistiming due to thread starvation, resource locking, and other concurrency issues. investigate java.lang.Thread and java.util.Timer
type: Answer
has comment: http://stackoverflow.com/comment/42127124
score: 0

http://stackoverflow.com/comment/41948500
comment on: http://stackoverflow.com/a/26674568
type: AnswerComment
has text: That's funny, why did we all chose 5 as a random size parameter ?
type: Comment
score: 1

http://stackoverflow.com/comment/42008474
comment on: http://stackoverflow.com/q/26707971
type: QuestionComment
score: 0
has text: Hi @Vicky Thakor, I dont want to check for exception. I want to know the complete flow. Can I know the flow without debug point?
type: Comment

http://stackoverflow.com/q/26803592
answer count: 0
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/42240873
score: 0
has body: I am using the JbpmContext for transaction which is implemented in filter. I have servlet controller which is calling service methods and then DAO methods to persist objects. Servlet controller is handling rollback operation if any exception occurs. But in some cases, when exception fires still I want to persist particular field of particular object at service layer. I tried with session.flush(), but it was not working at all. Let me give you an example class servletController { public void doGet(request, response) throws ServletException, IOException{ try { testService.test(object); } catch (Exception e) { // rollback } } } class TestService { public void test(object) throws Exception { try { // Business logic. Here is the codes which throws some exception } catch(Exception e) { object.setFailed(true); // Any how, I want to persist this field session.save(object); session.flush(); throw e; } } } I have one solution like I can do it in seprate transaction but I don't want that. So is there any other way to persist object before transaction ends ? I want to do it only at service layer.
has title: Save object before transaction ends in hibernate
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42180531

http://stackoverflow.com/comment/42222886
score: 0
type: AnswerComment
type: Comment
has text: Are you saying that you have never seen [generics](https://docs.oracle.com/javase/tutorial/java/generics/) before? Hm...
comment on: http://stackoverflow.com/a/26827349

http://stackoverflow.com/q/26759613
tagged with: sum
tagged with: java
has title: show balance in simple atm in java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/42109399
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42100658
has body: This code models a simple ATM machine that can deposit, withdraw, and show the 10 latest transactions in an array of 10 index values. My problem is that I can't get the balance right after 10 deposits, the balance only seems to sum the values in my array, not including the transactions made before those ten. What am I doing wrong? import java.util.Scanner; public class cashier2 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int amount = 0; int choice = 0; int[] transactions = new int[10]; int sum = 0; int balance = 0; while(choice != 4) { choice = menu(); switch(choice) { case 1: System.out.print("deposit"); sum = keyboard.nextInt(); if(sum == 0) { System.out.print("wrong amount"); System.out.println(); System.out.println(); } else { amount = (int) + sum; makeTransactions(amount, transactions); } break; case 2: System.out.print("withdrawal "); sum = keyboard.nextInt(); if(sum == 0) { System.out.print("wrong amount"); System.out.println(); System.out.println(); } else { amount = (int) - sum; makeTransactions(amount, transactions); } break; case 3: showTransactions(transactions, balance); break; case 4: System.out.println("Exit"); break; } } } public static int menu() { Scanner keyboard = new Scanner(System.in); int choice = 0; System.out.println("Simple atm"); System.out.println(); System.out.println("1. deposit"); System.out.println("2. withdrawal"); System.out.println("3. balance"); System.out.println("4. exit"); System.out.println(); System.out.print("your choice: "); choice = keyboard.nextInt(); return choice; } public static void showTransactions(int[] transactions, int balance) { System.out.println(); System.out.println("Tidigare transaktioner: "); System.out.println(); for(int i = 0; i &lt; transactions.length; i++) { if(transactions[i] == 0) { System.out.print(""); } else { System.out.print(transactions[i] + "\n"); balance = balance + transactions[i]; } } System.out.println(); System.out.println("Saldo: " + balance + " k…
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42132763
has comment: http://stackoverflow.com/comment/42131841

http://stackoverflow.com/comment/42077126
score: 0
type: Comment
type: QuestionComment
has text: This looks correct, you might need to clean, build and redeploy.
comment on: http://stackoverflow.com/q/26745831

http://stackoverflow.com/q/26785759
tagged with: types
has answer: http://stackoverflow.com/a/70027247
favorite count: 0
linked to: http://stackoverflow.com/q/8054018
has body: I am experienced in JavaScript, but new to Java. In JavaScript there are "object" data types where a given variable essentially has sub-variables with their own unique values, for example: var car = {type:"Fiat", model:500, color:"white"}; It is almost like an array, but not quite (JavaScript has arrays too). I am wondering if the same type of thing exists in Java? If so, how would I declare the same thing in Java? Based on my searches I can't find an object data type, but thought maybe there was something similar?
has title: JavaScript-like Object data type in Java?
has comment: http://stackoverflow.com/comment/42148238
answer count: 4
has answer: http://stackoverflow.com/a/30436451
upvote count: 34
score: 31
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42148212
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
has answer: http://stackoverflow.com/a/26785904
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/26785801
tagged with: javascript
possible better answer: http://stackoverflow.com/a/26785801
has comment: http://stackoverflow.com/comment/42148493
accepted answer: http://stackoverflow.com/a/26785904

http://stackoverflow.com/q/26796419
tagged with: string
has title: Need to improve performance in file unzipping from DB
favorite count: 0
has body: I am getting zipped blob from db and using that blob in below way, Ex:- byte[] inputBlob = blobfile.getBytes(1, (int) blobfile.length()); After getting the blob, the way i got the zippedStream and passed it into another Class method(unzipper). Ex:- ByteArrayOutputStream zippedStream = null; InputStream byteInputStream = null; IParser parser = null; byte[] buffer = null; try { zippedStream = new ByteArrayOutputStream(); byteInputStream = new ByteArrayInputStream(blob); blob = null; int bytes_read; buffer = new byte[byteInputStream.available()]; while ((bytes_read = byteInputStream.read(buffer)) &gt; 0) { zippedStream.write(buffer, 0, bytes_read); } buffer = null; byteInputStream.close(); byteInputStream = null; }catch(Exception e){ e.printStackTrace(); } unzipper method: Ex:- byte[] buffer = new byte[1024]; try { InputStream decodedInput = new ByteArrayInputStream(zippedStream.toByteArray()); zippedStream.close(); zippedStream = null; GZIPInputStream unzippedStream = new GZIPInputStream(decodedInput); decodedInput.close(); decodedInput = null; int bytes_read; unzippedOutputstream = new ByteArrayOutputStream(); while ((bytes_read = unzippedStream.read(buffer)) &gt; 0) { unzippedOutputstream.write(buffer, 0, bytes_read); } buffer = null; unzippedStream.close(); unzippedStream = null; } catch (Exception ex) { logger.setException(ex); logger.error("unzipper", generateMsg("Exception occurred")); } Using this way my application got stucked some time, and performance was so bad. Is there any optimize way to get the zippedstream file and unzipping that easily?
has comment: http://stackoverflow.com/comment/42167166
has answer: http://stackoverflow.com/a/26797232
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26797232
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/42167025
tagged with: inputstream
downvote count: 1
type: Question
upvote count: 0
tagged with: bufferedinputstream
score: -1
answer count: 1

http://stackoverflow.com/comment/42065832
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26739953
has text: OK I accept this as a valid answer, though one would probably perfer the use of `AtomicInteger` directly.
score: 0

http://stackoverflow.com/a/26773473
has body: As you said 'java.io.IOException: Error making API call: cannot-retrieve:downstream-http-error:404' Exception is caused by the wrong URL argument in function call (ie.URLGetRankedKeywords()) Since the URL is parsed from the EXCEL Document some times the '\r' character might be present at the end of the cell.If present, this will make the URL invalid . What you can do is , Remove all '\r' character from the URL before you pass it to API call. ie , url = url.replaceAll("\r", ""); Document doc = alchemyObj.URLGetRelations(url); This might work.it's worked for me.
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26752287
answers question: http://stackoverflow.com/q/26752287
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42039363
score: 1
comment on: http://stackoverflow.com/q/26724976
has text: It is also usually good to include the stack trace of the error you experience, when asking for help. Not that it is always needed, but when stating that you have an error, one would usually expect the stack trace to be included in the problem description.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42125630
type: Comment
score: 1
has text: Thanks, now I understand the trick for getAndIncrement(). The head/tail are pointing to node with null value in the default constructor. Does it mean that if we serialize/deserialize the blocking queue, we lose the content in the blocking queue?
type: AnswerComment
comment on: http://stackoverflow.com/a/26772508

http://stackoverflow.com/q/26680745
has comment: http://stackoverflow.com/comment/55178104
type: UnansweredQuestion
tagged with: ssh
answer count: 0
has comment: http://stackoverflow.com/comment/41964627
tagged with: java
has comment: http://stackoverflow.com/comment/41964017
type: Question
tagged with: amazon-web-services
has body: I'm trying to connect to an instance of Amazon's EC2 cloud using a Keypair and I've been having a good amount of trouble. Ultimately I want to be able to transfer a file from my local machine to the cloud but I still need to get connected first. Here's what I have now: public static void main(String[] args) throws IOException, ClassNotFoundException, UserAuthException { SSHClient ssh = new SSHClient(); ssh.addHostKeyVerifier("2a:a5:fe:10:51:2c:e0:de:2e:99:cc:a4:7d:43:01:0f"); ssh.connect("address for cloud instance"); try { ssh.authPublickey("ec2-user", "C:\\Users\\Pat\\Desktop\\public_key.pem"); final String src = "C:\\Users\\Pat\\Desktop\\test file.txt"; ssh.newSCPFileTransfer().upload(new FileSystemFile(src), "/home/ec2-user/"); } finally { ssh.disconnect(); } } Before, I have run this without the addHostKeyVerifier line and it gives me an error saying that it couldn't load ssh-rsa key with the fingerprint that is now in that command. The strange thing is that the amazon account shows a different fingerprint for this keypair, could that have anything to do with this? When I run the above code I get this error: [main] INFO net.schmizz.sshj.common.SecurityUtils - BouncyCastle registration succeeded [main] WARN net.schmizz.sshj.DefaultConfig - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy [main] INFO net.schmizz.sshj.transport.TransportImpl - Client identity string: SSH-2.0- SSHJ_0_8_1_SNAPSHOT [main] INFO net.schmizz.sshj.transport.TransportImpl - Server identity string: SSH-2.0- OpenSSH_6.2 [main] INFO net.schmizz.sshj.transport.TransportImpl - Disconnected - BY_APPLICATION Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/openssl/EncryptionException at net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile$Factory.create(PKCS8KeyFile.java:45) at net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile$Factory.create(PKCS8KeyFile.java:40) at net.schmizz.sshj.common.Factory$Named$Util.create(Factory.java:74) at n…
score: 0
tagged with: public-key
has comment: http://stackoverflow.com/comment/41960688
has title: Trying to connect to Amazon EC2 through Java w/ keypair
tagged with: amazon-ec2
has comment: http://stackoverflow.com/comment/41960277

http://stackoverflow.com/comment/42120828
has text: Ah, didn't see that. You're declaring the method inside of a forloop, still within the main method.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26770030

http://stackoverflow.com/comment/42343437
type: Comment
score: 0
has text: Then I don't understand what's your exact problem. Please provide more info about what you're doing, how you're executing the code and how your application is consuming it.
type: QuestionComment
comment on: http://stackoverflow.com/q/26719754

http://stackoverflow.com/q/26714143
has title: JAXB - Composite pattern and @XmlValue
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/26715088
type: Question
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/26715088
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
linked to: http://stackoverflow.com/q/26682591
type: AnsweredQuestion
has body: Following up JAXB and Composite Pattern, I managed to map: foo bar baz But I'd like to map: foo bar baz My JAXB class hierarchy is as follows: @XmlRootElement @XmlSeeAlso({SimplePreconditionQuery.class, CompoundAndPreconditionQuery.class, CompoundOrPreconditionQuery.class}) public abstract class PreconditionQuery { // JAXB does not deal with interfaces by default >:( } With several kinds of queries: @XmlSeeAlso(PreconditionQuery.class) @XmlRootElement(name = "just") public class SimplePreconditionQuery extends PreconditionQuery { private String query; @XmlElement(name = "query") public String getQuery() { return query; } public void setQuery(String query) { this.query = query; } } The compound ones (AND/OR) are very similar: @XmlSeeAlso(PreconditionQuery.class) @XmlRootElement(name = "and") public class CompoundAndPreconditionQuery extends PreconditionQuery { private Collection<PreconditionQuery> preconditionQueries = newArrayList(); @XmlElementRef(name = "query") public Collection<PreconditionQuery> getPreconditionQueries() { return preconditionQueries; } public void setPreconditionQueries(Collection<PreconditionQuery> preconditionQueries) { this.preconditionQueries = preconditionQueries; } } And the enclosing bean: public class Precondition { private PreconditionQuery query; @XmlElementRef(required = true) public PreconditionQuery getQuery() { return query; } public void setQuery(PreconditionQuery query) { this.query = query; } } JAXB won't allow me to just map a @XmlValue on SimplePreconditionQuery. Why and what's the alternative?
tagged with: java

http://stackoverflow.com/q/26705676
answer count: 1
tagged with: accent-insensitive
has comment: http://stackoverflow.com/comment/42033826
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26721089
type: Question
tagged with: hibernate-search
has title: hibernate search query with accent
tagged with: lucene
has comment: http://stackoverflow.com/comment/42010773
score: 0
has body: I use hibernate search 4.2.0 with hibernate 4.2.15 and spring 3.2.10. I have a strange behavior when a use an hibernate search (lucene) query. In the database I've this value for the field content : "méchant". When I make a query with "mechant" it works fine, I get the objet. But when I use "méchant" it doesn't work... The Mapping : @Entity @Indexed @AnalyzerDef(name = "customAnalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = { @TokenFilterDef(factory = LowerCaseFilterFactory.class), @TokenFilterDef(factory = ASCIIFoldingFilterFactory.class), @TokenFilterDef(factory = SnowballPorterFilterFactory.class) }) @Table(name = "MESSAGE") public class Message { ... @Id @DocumentId @GeneratedValue @Column(name = "ID_MESSAGE") public Integer getId() { return id; } @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO) @Analyzer(definition="customAnalyzer") @Column(name = "CONTENT", length = 65535, columnDefinition = "Text") public String getContent() { return content; } ... ] The hibernate config : javassist org.hibernate.dialect.MySQLDialect ${hibernate.showSql} validate filesystem ${indexLucene.path} The query : FullTextSession searchSession = Search.getFullTextSession(getSessionFactory().getCurrentSession()); QueryBuilder qb = searchSession.getSearchFactory().buildQueryBuilder().forEntity(Message.class).get(); BooleanJunction<BooleanJunction> bool = qb.bool(); ... bool.must(qb.keyword().boostedTo(4f) .onFields("content") .matching(messageCriteria.getQuery()) .createQuery()); ... org.apache.lucene.search.Query luceneQuery =bool.createQuery(); FullTextQuery jpaQuery = searchSession.createFullTextQuery(luceneQuery, Message.class); Is that somebody can help me? [EDIT] Thank you all, I solved the problem : It wasn't due to hibernate search but the charset of my http request. I'll check how to fix my charset issue. Sorry for the waste of time...

http://stackoverflow.com/q/26800008
has body: What are the valid SQL queries i can run on hibernate hbm formula tag I want to execute select Now()
score: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
answer count: 1
type: AnsweredQuestion
has title: Formula tag in Hibernate Mapping class SQL queries
type: Question
has answer: http://stackoverflow.com/a/26801061
accepted answer: http://stackoverflow.com/a/26801061

http://stackoverflow.com/q/26807547
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/42197059
tagged with: jar
tagged with: generics
has body: I am using hadoop-2.4.1 examples jar on centos6.5_x64. The job has SUCCEEDED but output has not written to hdfs. /opt/hadoop-2.4.1/bin/hadoop jar hadoop-mapreduce-examples*.jar \ randomtextwriter \ -D mapred.output.compress=false \ -D mapreduce.randomtextwriter.bytespermap=107374182 \ -D mapreduce.randomtextwriter.mapsperhost=2 \ /output If the job is being run without generic options parser then the output is being written to HDFS. /opt/hadoop-2.4.1/bin/hadoop jar \ /opt/hadoop-2.4.1/share/hadoop/mapreduce/hadoop-mapreduce-examples*.jar \ randomtextwriter \ /test Why can't I use generic options?
has comment: http://stackoverflow.com/comment/42189427
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42189164
has title: Hadoop-2.4.1 example jar generic options error

http://stackoverflow.com/q/26790248
tagged with: design-patterns
type: AnsweredQuestion
score: 3
has title: Why would a map helper extending hashmap be useful? Why not just use hashmap?
has answer: http://stackoverflow.com/a/26790441
has comment: http://stackoverflow.com/comment/42156584
upvote count: 3
has comment: http://stackoverflow.com/comment/42157167
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42156547
possible better answer: http://stackoverflow.com/a/26790373
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42156603
linked to: http://stackoverflow.com/q/1195206
has answer: http://stackoverflow.com/a/26790425
has comment: http://stackoverflow.com/comment/42156579
accepted answer: http://stackoverflow.com/a/26790425
favorite count: 0
has body: In a large java code base in my recent job, I see the below code: public class MapHelper extends HashMap&lt;String, Object&gt;{ private static final long serialVersionUID = 1L; public MapHelper() { super(); } public MapHelper(MapHelper mh) { super(mh); } public MapHelper as_dict(String key) { return (MapHelper)this.get(key); } } I'm not sure how this would be useful. Are there examples you have that could shed light on the above MapHelper's usefulness?
has answer: http://stackoverflow.com/a/26790373
tagged with: concurrenthashmap

http://stackoverflow.com/comment/41995249
has text: How do you structure a project with several different applications? Won't Spring Boot scan the other Application(s) anyway? What's the recommended best practice for this scenario...? I think this is common usage, having test configuration somewhat different than application configuration.
type: Comment
comment on: http://stackoverflow.com/a/26699071
score: 3
type: AnswerComment

http://stackoverflow.com/q/26809028
answer count: 6
tagged with: while-loop
has answer: http://stackoverflow.com/a/26809283
favorite count: 0
type: UnansweredQuestion
has body: if i have a while condition in java as follows while(j>=1 &amp;&amp; i&lt;=7) my question is if the first condition fails then the second condition will be examine?? in other word if j=0 the compiler will check if I&lt;=7 or it will ignore it . please help me thank you
has title: if the first condition fails then the second condition will be examine -java
has answer: http://stackoverflow.com/a/26809097
score: 2
tagged with: conditional-statements
linked to: http://stackoverflow.com/q/10164975
has answer: http://stackoverflow.com/a/26809112
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26809108
has comment: http://stackoverflow.com/comment/42190804
duplicate of: http://stackoverflow.com/q/10164975
linked to: http://stackoverflow.com/q/16606021
type: Question
has answer: http://stackoverflow.com/a/26809070
has answer: http://stackoverflow.com/a/26809215
duplicate of: http://stackoverflow.com/q/16606021
upvote count: 5

http://stackoverflow.com/comment/41989218
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26687775
has text: Im sorry but a RFC is too hard, too abstract for me :(
type: Comment

http://stackoverflow.com/q/26824438
accepted answer: http://stackoverflow.com/a/26834635
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42218019
tagged with: java
tagged with: java-web-start
type: Question
tagged with: browser
score: 0
answer count: 1
tagged with: applet
has body: I have a C++ library that I have compiled for OS X, Windows &amp; Unix. For each one I have created a separate project in Eclipse and have exported them with the name convention: library-OS.jar. Each jar basically contains: library-OS.jar | -> library.ext What I was thinking was from my main Jar applet to load them by extracting them to a temp location and using system.loadlibrary. Unfortunately I don't know how to get the resource. I was trying to do it using Extract and load DLL from JAR but it is for relative paths and not online browser applets. So my question is how to load the C library based on the OS of the client. I'm using JNI to talk to it and that one is in a separate JAR as well which loads the library. I was looking into JNLP but I don't know how to get the Jar name if I use JNLP. :/ EDIT: public static void loadJarDll(String name) throws IOException { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); byte[] buffer = new byte[1024]; int read = -1; File temp = new File(new File(System.getProperty("java.io.tmpdir")), name); FileOutputStream fos = new FileOutputStream(temp); while((read = in.read(buffer)) != -1) { fos.write(buffer, 0, read); } fos.close(); in.close(); System.load(temp.getAbsolutePath()); } This is the code I'm currently using. In order to load the library I pass the name variable which MUST contain the extension of the library. What I want to do is just request the library with it's generic name for each OS (like if it's foobar.dll for windows and foobar.so for unix to just call it foobar when loading). I want to load it like this because when I use JNLP I will only have one JAR containing the native library for that specific OS and platform.
tagged with: jnlp
has title: How to load a library from JAR file loaded from browser?
has comment: http://stackoverflow.com/comment/42218078
linked to: http://stackoverflow.com/q/4764347
has comment: http://stackoverflow.com/comment/42218112
has answer: http://stackoverflow.com/a/26834635

http://stackoverflow.com/q/26817224
has answer: http://stackoverflow.com/a/26819848
has comment: http://stackoverflow.com/comment/42205253
type: UnansweredQuestion
tagged with: reverse-engineering
has title: Compile or not to compile .class files
has comment: http://stackoverflow.com/comment/42206716
has comment: http://stackoverflow.com/comment/42205106
tagged with: java
has comment: http://stackoverflow.com/comment/42204892
tagged with: .class-file
type: Question
has comment: http://stackoverflow.com/comment/42204871
tagged with: compilation
has body: There is a web application, that is being ran on Windows, inside a Tomcat browser. Application users number of .jar files as a storage for it's logic. When I open a jar file, that I need to alter a logic of, I see a bunch of .class files. (Java compiled classes, I assume). When I try to open .class file in a text editor, I see a semi-readable gibberish. When I feed this compiled .class to a service like showmycode.com, I can see the actual java code. At this point I alter the code according to my need and want to put the updated .class file for application to use (put it back inside a jar). Is it mandatory that I compile the .class file to a "semi-readable gibberish", or I can put it there as a source code file (probably not, but thought I would ask just in case). If I have to compile the atered code, can I do it without bringing up a project in some Java IDE, and just compile it into .class via command line or something?
score: 0
answer count: 1

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/26674973
tags question: http://stackoverflow.com/q/26693526
type: Tag
tags question: http://stackoverflow.com/q/26701154

http://stackoverflow.com/q/26752103
has answer: http://stackoverflow.com/a/26752581
accepted answer: http://stackoverflow.com/a/26752581
favorite count: 0
has comment: http://stackoverflow.com/comment/42090435
has body: The question on my homework is: Write nested if statements that perform the following test: If amountl is greater than 10 and amount2 is less than 100, display the greater of the two. This is what I have so far: import javax.swing.JOptionPane; public class nestedif { public static void main(String[] args) { int amount1, amount2; amount1 = JOptionPane.showInputDialog("Enter amount 1: "); amount1 = Integer.parseInt(amount1); amount2 = JOptionPane.showInputDialog("Enter amount 2: "); amount2 = Integer.parseInt(amount2); if (amount1&gt;10) if (amount2&lt;100) } }
has comment: http://stackoverflow.com/comment/42087644
has comment: http://stackoverflow.com/comment/42091738
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42087627
has comment: http://stackoverflow.com/comment/42087679
has title: Nested IF statements, trouble completing
type: Question
has answer: http://stackoverflow.com/a/26752211
tagged with: java
has answer: http://stackoverflow.com/a/72596626
score: -1
has comment: http://stackoverflow.com/comment/42087709
possible better answer: http://stackoverflow.com/a/26752211
answer count: 3
has comment: http://stackoverflow.com/comment/42092474
downvote count: 1
tagged with: nested

http://stackoverflow.com/q/26678346
type: UnansweredQuestion
tagged with: java
has title: Different build configurations in Eclipse and .properties file
tagged with: tomcat7
has answer: http://stackoverflow.com/a/26715915
type: Question
has answer: http://stackoverflow.com/a/26724366
has answer: http://stackoverflow.com/a/26823425
has comment: http://stackoverflow.com/comment/42021550
tagged with: eclipse
tagged with: properties-file
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42013668
linked to: http://stackoverflow.com/q/26589018
has comment: http://stackoverflow.com/comment/42224638
has comment: http://stackoverflow.com/comment/42021426
has comment: http://stackoverflow.com/comment/42021744
has comment: http://stackoverflow.com/comment/41997042
tagged with: build
has body: I have an Eclipse project which uses java with struts 1.3.10 framework. I use a .properties file (say configApp.properties) to manage production webapp, demo webapp and development webapp. This .properties file is used in the ServletContextListener and in a PropertyDecoder class which implements IntrospectionUtils.PropertySource (see this question). Now, manually, I change the configApp.properties according to the task I have to accomplish (i.e. build a new production version). How could I automatize this step? As the .properties filename has to be the same for the three types of build, I thought to create three folder each cointaining the configApp.properties (one for production, one for demo and one for development). Is there a better way, for example by passing a parameter to the build (I think it's not possible 'cause the PropertyDecoder class which implements IntrospectionUtils.PropertySource must be compiled and the .class put on the Tomcat lib folder)? If so, how can I parameterize ServletContextListener and the PropertyDecoder class so that they can take in input the right .properties file?

http://stackoverflow.com/q/26777578
favorite count: 0
tagged with: rest
linked to: http://stackoverflow.com/q/2072295
type: UnansweredQuestion
tagged with: intellij-13
has comment: http://stackoverflow.com/comment/42134169
has title: IntelliJ : How to expose API with JAX WS RS and @ApplicationPath
has comment: http://stackoverflow.com/comment/42135773
has body: It's probably a duplicate of How to deploy a JAX-RS application? but the answer doesn't match the intelliJ fact. So here the problem : I have a root class that normally expose n webservices : @ApplicationPath("/api") public class API extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { return getRestResourceClasses(); } /** * Get the Rest resource classes. * @return the rest resource classes */ private Set&lt;Class&lt;?&gt;&gt; getRestResourceClasses() { Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;Class&lt;?&gt;&gt;(); resources.add(com.xxx.services.AuthService.class); ... resources.add(com.xxx.services.SimpleService.class); resources.add(com.xxx.tools.ResponseCorsFilter.class); return resources; } } and a RESTService class like : @Path("/math") @Produces(MediaType.APPLICATION_JSON) public class SimpleService { private static Integer stack; @GET @Path("/add/{a}/{b}") public String add(@PathParam("a") Integer a, @PathParam("b") Integer b) { return Integer.toString(a + b); } @GET @Path("/mult/{a}/{b}") public String mult(@PathParam("a") Integer a, @PathParam("b") Integer b) { return Integer.toString(a * b); } @PUT @Path("/stack") public String put(final Integer toStack) { stack = toStack; return Integer.toString(stack); } } Normally, after adding a glassfish server like : and run the solution with intelliJ, I can access to my webservice like : http://localhost:8080/mediaweb/api/math/add/2/3 but nothing ... glassfish throw a 404. but intelliJ still show me all my webservices in the debugger : How can I debug this ?
has comment: http://stackoverflow.com/comment/42133952
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42133886
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42157524
has comment: http://stackoverflow.com/comment/42135199
downvote count: 0
tagged with: glassfish
has comment: http://stackoverflow.com/comment/52108299
has comment: http://stackoverflow.com/comment/42134450
has comment: http://stackoverflow.com/comment/52296179
tagged with: jax-rs

http://stackoverflow.com/comment/42155718
has text: I have updated My question can you check it again please
comment on: http://stackoverflow.com/a/26788033
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42121694
type: Comment
comment on: http://stackoverflow.com/q/26770586
score: 0
has text: That was it, I should've been using the month and not the day, I feel stupid, thanks mate.
type: QuestionComment

http://stackoverflow.com/a/26688327
downvote count: 0
score: 1
upvote count: 1
has body: final fields can only be assigned to from within the constructor. Therefore, making fields final is enough to make them immutable after construction. Assigning pointers to mutable objects to them is a different story.
has comment: http://stackoverflow.com/comment/41973893
type: Answer
answers question: http://stackoverflow.com/q/26688304
has comment: http://stackoverflow.com/comment/41973883

http://stackoverflow.com/q/26828270
type: Question
has comment: http://stackoverflow.com/comment/42224357
has comment: http://stackoverflow.com/comment/42224066
has title: Persist an implementation which has no properties
tagged with: entity
has comment: http://stackoverflow.com/comment/42224028
score: 0
has answer: http://stackoverflow.com/a/26828962
has comment: http://stackoverflow.com/comment/42224595
tagged with: jpa
answer count: 1
type: UnansweredQuestion
has body: Given the following classes and interface I am wondering how JPa handles it: public interface Operator{ public String getOperator(); } Let's stay I then have two implementations of this class: public class PlusOperation implements Operator, Serializable { public String getOperator(){ return "+"; } } And: public class MinusOperation implements Operator, Serializable { public String getOperator(){ return "-"; } } There exists a class marked as @Entity which has a property Operator: @Entity public class Function { @Id @GeneratedValue private Long id; private Operator operator; // Other methods &amp; properties omitted for clarity } In the Function class therefore, it could hold either a PlusOperation or MinusOperation and neither of these classes have been annotated with @Entity as they don't have any properties that require persisting but they each are different. How does JPA handle this? When persisting a Function object does it automatically (and 'behind the scenes') mark the operator property with the correct Operation implementation?
tagged with: java

http://stackoverflow.com/q/26830410
has comment: http://stackoverflow.com/comment/42263434
tagged with: sockets
tagged with: android
accepted answer: http://stackoverflow.com/a/26830635
has comment: http://stackoverflow.com/comment/42229100
has title: Unable to catch SocketTimeoutException thrown from socket.connect(InetAddress, timeout)
has comment: http://stackoverflow.com/comment/42273129
has answer: http://stackoverflow.com/a/39462609
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42228509
possible better answer: http://stackoverflow.com/a/39462609
has body: I'm developing an app that connects to a server via socket connection to read and write data. I'm using runInBackground() method in AsyncTask to do this. I use my PC as a server and connect my android device to the WiFi to connect to the PC. I want to simulate a case where the server is unavailable so I disconnect my device from the WiFi and run the code. I use the following code: try { socket = new Socket(); socket.connect(new InetSocketAddress("192.168.1.104", 4444), 10000); ... ... } catch (SocketTimeoutException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } A SocketTimeoutException is thrown after 10 seconds as expected but the problem is that none of the catch blocks actually catch the exception. How is that possible? Here's the log: 11-09 17:57:15.286: W/System.err(12050): java.net.SocketTimeoutException: failed to connect to /192.168.1.104 (port 4444) after 10000ms 11-09 17:57:15.301: W/System.err(12050): at libcore.io.IoBridge.connectErrno(IoBridge.java:159) 11-09 17:57:15.301: W/System.err(12050): at libcore.io.IoBridge.connect(IoBridge.java:112) 11-09 17:57:15.301: W/System.err(12050): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 11-09 17:57:15.301: W/System.err(12050): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 11-09 17:57:15.306: W/System.err(12050): at java.net.Socket.connect(Socket.java:842) 11-09 17:57:15.306: W/System.err(12050): at com.elyakimsportal.communication.ContactServer$RetrieveProfilesTask.doInBackground(ContactServer.java:183) 11-09 17:57:15.306: W/System.err(12050): at com.elyakimsportal.communication.ContactServer$RetrieveProfilesTask.doInBackground(ContactServer.java:1) 11-09 17:57:15.311: W/System.err(12050): at android.os.AsyncTask$2.call(AsyncTask.java:287) 11-09 17:57:15.311: W/System.err(12050): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 11…
type: Question
has answer: http://stackoverflow.com/a/26830635
score: 0
answer count: 2

http://stackoverflow.com/q/26777482
answer count: 3
has body: I have a JTable within a JScrollPane which is disabled using enabled(false), however I would still like to change to the hand cursor on rollover. I have tried simply setting the cursor of the table manually: table.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); And I have tried overriding the getCursor() method of JTable: JTable table = new JTable(tableModel){ @Override public Cursor getCursor() { return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); //DOESNT WORK } }; However neither technique works. One approach which I have got to work is to add a mouseMotionListener to the whole table, the problem with this however is that in the actual application pressing a button residing in the table causes a 'JOptionpane' to be shown; if the user proceeds to move the cursor out of the table and close the 'JOptionPane' then bugs can occur. Surely a 'MouseMotionListener' is excessive..? I have also looked into overriding the setEnabled method of JTable (and subsequently Component), however I am struggling to find out which code prevents the hand cursor being displayed. Any help would be much appreciated! code below: import java.awt.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class TableCursorTest { public TableCursorTest(){ JFrame frame = new JFrame(); JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); String[] headers = {"Items"}; Object[][] data = new Object[][]{{"item 1"},{"item 2"}}; DefaultTableModel tableModel = new DefaultTableModel(data, headers); @SuppressWarnings("serial") @Override public Cursor getCursor() { return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); //DOESNT WORK } }; JScrollPane scrollPane = new JScrollPane(table); table.setEnabled(false); table.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); //DOESNT WORK constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 0; constraints.weighty = 0; panel.add(scrollPane, constraints); frame…
has answer: http://stackoverflow.com/a/26783341
tagged with: mouse-cursor
has title: Hand cursor on disabled JTable
type: UnansweredQuestion
tagged with: jcomponent
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26777553
score: 1
tagged with: java
tagged with: jtable
downvote count: 0
has answer: http://stackoverflow.com/a/31202820
favorite count: 0

http://stackoverflow.com/comment/42139519
has text: yes, I am using Eclipse Luna
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26780404
type: QuestionComment

http://stackoverflow.com/a/26794812
has comment: http://stackoverflow.com/comment/42177488
type: Answer
has comment: http://stackoverflow.com/comment/42183111
score: 0
has body: Mildly optimized solution: /* All four digits are different The digit in the thousands place is three times the digit in the tens place The number is odd The sum of the digits is 27 */ // Start at 4 digit numbers, only iterate odd numbers for (int i = 1001; i &lt;= 9999; i += 2) { // break the four digits into seperate variables int num4 = i % 10; int num3 = i / 10 % 10; int num2 = i / 100 % 10; int num1 = i / 1000 % 10; // check that the "first" number is 3x the "third" if (num1 != (num3 * 3)) continue; // make sure all numbers are unique if (num1 != num2 &amp;&amp; num1 != num3 &amp;&amp; num1 != num4 &amp;&amp; num2 != num3 &amp;&amp; num2 != num4 &amp;&amp; num3 != num4) // and they sum to 27 if ((num1 + num2 + num3 + num4) == 27) System.out.println(i); } The answer of course is 9837.
accepted answer of: http://stackoverflow.com/q/26794488
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26794488

http://stackoverflow.com/a/26828717
accepted answer of: http://stackoverflow.com/q/26821562
score: 1
has body: You cannot use value="" in the p:inputText. If you do not want to specify value, you should remove attribute value="". &lt;p:inputText id="a" style="margin:10px;" /&gt;
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26821562

http://stackoverflow.com/a/26818751
has body: This pattern might work for you \?(.*). This regex finds a question mark and selects everything after it.
score: 0
answers question: http://stackoverflow.com/q/26818614
type: Answer

http://stackoverflow.com/q/26723417
has title: sorting multiple integers by ascending order in java
has comment: http://stackoverflow.com/comment/42036503
has answer: http://stackoverflow.com/a/26723506
answer count: 5
tagged with: sorting
type: UnansweredQuestion
has body: So I've been racking my head for the past 6 hours trying to accomplish this task and I've gotten nowhere. I have a bunch of integers that I want to sort in ascending order for a class assignment. However, I cant use anything fancy, IE .sort or anything that I need to important into Java. The only alternative I've been able to come up with is to use if statements and list every possible combination of 8 numbers; but that seems excessive, there's got to be a better way. This is the section of my code I've been dealing with. I basically want to sort d1-d8 in ascending order. I've tried arrays as well, but to no avail. On a side note I'm sure my code is way longer then it needs to be, but I'm pretty new at this and I dont really want to reformat it. else if (a1 &gt;= 1){ int a21 = 0; int a31 = 0; int a41 = 0; int a51 = 0; int a61 = 0; int a71 = 0; int a81 = 0; int a91 = 0; int d1 = 0; int d2 = 0; int d3 = 0; int d4 = 0; int d5 = 0; int d6 = 0; int d7 = 0; int d8 = 0; if ((a2 % a1) == (a2 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a3 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a4 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a5 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a6 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a7 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a8 % a1)) a21 = a21 + 1; if ((a2 % a1) == (a9 % a1)) a21 = a21 + 1; if ((a3 % a1) == (a2 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a3 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a4 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a5 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a6 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a7 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a8 % a1)) a31 = a31 + 1; if ((a3 % a1) == (a9 % a1)) a31 = a31 + 1; if ((a4 % a1) == (a2 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a3 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a4 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a5 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a6 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a7 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a8 % a1)) a41 = a41 + 1; if ((a4 % a1) == (a9 % a1)) a41 =…
upvote count: 0
has comment: http://stackoverflow.com/comment/42036533
favorite count: 0
has answer: http://stackoverflow.com/a/26723940
has answer: http://stackoverflow.com/a/26723548
type: Question
has comment: http://stackoverflow.com/comment/42036514
has answer: http://stackoverflow.com/a/26723508
score: -2
has answer: http://stackoverflow.com/a/26723488
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42036613

http://stackoverflow.com/a/26808574
answers question: http://stackoverflow.com/q/26808557
score: 4
upvote count: 4
downvote count: 0
type: Answer
has body: Your logic in this line is incorrect: if(barCode.charAt(i) !=':' || barCode.charAt(i) != '|') The character is always not ':' or not '|', so valid is always getting set to false. You want "and", with &amp;&amp;. Try if(barCode.charAt(i) !=':' &amp;&amp; barCode.charAt(i) != '|')

http://stackoverflow.com/comment/42109734
type: AnswerComment
comment on: http://stackoverflow.com/a/26748581
score: 0
type: Comment
has text: Sorry, but I'm not seeing any other error description. I presume you can do a comparison with `field.getBytes("UTF-16LE").length` yourself? Alternatively, just catch the exception that happens if you go over the maximum size for RSA PKCS#1 v1.5 padding.

sockets
tags question: http://stackoverflow.com/q/26813698
tags question: http://stackoverflow.com/q/26804502
tags question: http://stackoverflow.com/q/26749889
tags question: http://stackoverflow.com/q/26756550
tags question: http://stackoverflow.com/q/26691654
tags question: http://stackoverflow.com/q/26704383
tags question: http://stackoverflow.com/q/26683898
tags question: http://stackoverflow.com/q/26724917
tags question: http://stackoverflow.com/q/26724442
tags question: http://stackoverflow.com/q/26791667
tags question: http://stackoverflow.com/q/26813023
tags question: http://stackoverflow.com/q/26722626
tags question: http://stackoverflow.com/q/26693470
tags question: http://stackoverflow.com/q/26778807
tags question: http://stackoverflow.com/q/26793222
tags question: http://stackoverflow.com/q/26832359
tags question: http://stackoverflow.com/q/26679209
tags question: http://stackoverflow.com/q/26694855
tags question: http://stackoverflow.com/q/26763277
tags question: http://stackoverflow.com/q/26781406
tags question: http://stackoverflow.com/q/26823437
tags question: http://stackoverflow.com/q/26761966
tags question: http://stackoverflow.com/q/26722387
tags question: http://stackoverflow.com/q/26756057
tags question: http://stackoverflow.com/q/26806249
type: Tag
tags question: http://stackoverflow.com/q/26769687
tags question: http://stackoverflow.com/q/26733148
tags question: http://stackoverflow.com/q/26815129
tags question: http://stackoverflow.com/q/26830233
tags question: http://stackoverflow.com/q/26706216
tags question: http://stackoverflow.com/q/26696342
tags question: http://stackoverflow.com/q/26815995
tags question: http://stackoverflow.com/q/26753754
tags question: http://stackoverflow.com/q/26746082
tags question: http://stackoverflow.com/q/26778859
tags question: http://stackoverflow.com/q/26820271
tags question: http://stackoverflow.com/q/26737897
tag name: sockets
tags question: http://stackoverflow.com/q/26768899
tags question: http://stackoverflow.com/q/26826670
tags question: http://stackoverflow.com/q/26789754
tags question: http://stackoverflow.com/q/26820980
tags question: http://stackoverflow.com/q/26823755
tags question: http://stackoverflow.com/q/26827070
tags question: http://stackoverflow.com/q/26830410
tags question: http://stackoverflow.com/q/26824825
tags question: http://stackoverflow.com/q/26795236
tags question: http://stackoverflow.com/q/26764252
tags question: http://stackoverflow.com/q/26820144

http://stackoverflow.com/a/26874448
type: AcceptedAnswer
type: Answer
has body: This is answered in a couple of questions like here - URL hash is persisting between redirects. I ended up doing a client-side redirect to avoid the issue.
accepted answer of: http://stackoverflow.com/q/26807629
has comment: http://stackoverflow.com/comment/53061159
score: 0
answers question: http://stackoverflow.com/q/26807629

http://stackoverflow.com/q/26814315
has comment: http://stackoverflow.com/comment/42200159
has answer: http://stackoverflow.com/a/26814488
linked to: http://stackoverflow.com/q/4385623
upvote count: 1
has answer: http://stackoverflow.com/a/26814415
possible better answer: http://stackoverflow.com/a/26814488
downvote count: 1
type: AnsweredQuestion
has title: Generate random string of 300 bytes in Java?
tagged with: java
has answer: http://stackoverflow.com/a/26814362
type: Question
score: 0
answer count: 3
tagged with: string
has body: I always gets confused when people ask me to generate random string which is of 300 bytes or some predefined bytes. I am not sure what does they mean in general? Are they asking that string should be of 300 length? I am working on a project in which people have asked me to generate random String of approximately 300 bytes. Is it possible to do? I am confuse how we can generate random string of 300 bytes? I know how to generate random string like this - private static final Random random = new Random(); private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; public static String generateString(int length) { StringBuilder sb = new StringBuilder(length); for (int i = 0; i &lt; length; i++) { sb.append(CHARACTERS.charAt(random.nextInt(CHARACTERS.length()))); } return sb.toString(); } Can anyone explain me what does it mean when we need to generate random string of approx 300 bytes?
favorite count: 0
tagged with: byte
accepted answer: http://stackoverflow.com/a/26814362
has comment: http://stackoverflow.com/comment/42200146

http://stackoverflow.com/q/26701424
has body: Ive created a game of Craps which is a dice based game. Ive created my game logic but am trying to implement a GUI. Ive created my Dice and Dice Component for both dice. If i add my Dice to the frame one at a time they both work, but as soon as i try and add both to the frame at the same time and run my Craps game, the frame is empty. CrapsGame code: package crapsgame; import java.awt.FlowLayout; import javax.swing.*; public class CrapsGameTester { /** * @param args the command line arguments */ public static void main(String[] args) { JFrame frame = new JFrame("Craps-Game"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); final int FRAME_WIDTH = 400; final int FRAME_HEIGHT = 600; frame.setSize(FRAME_HEIGHT, FRAME_WIDTH); CrapsGame game = new CrapsGame(); JPanel panel = new JPanel(new FlowLayout()); frame.add(panel); Dice1Component dice1 = new Dice1Component(6); Dice2Component dice2 = new Dice2Component(6); panel.add(dice1); panel.add(dice2); String message = game.doFirstRoll(); System.out.println(message); while(!game.isOver()) { message = game.rollAgain(); System.out.println(message); } if(game.isWon()) System.out.println("You win, big man!"); else System.out.println("Loser ..."); frame.setVisible(true); } } Dice1 code: package crapsgame; import java.awt.*; public class Dice1 { int sides; int xCoord = 150; int yCoord = 130; public Dice1(int s) { sides = s; } /** * * @param g2 Graphics2D object used by draw method */ public void draw(Graphics2D g2) { g2.setColor(Color.BLACK); g2.fillRect(xCoord, yCoord, 100, 100); g2.setColor(Color.WHITE); switch (sides) { case 1: g2.fillOval(xCoord + 40, yCoord + 40, 20, 20); break; case 2: g2.fillOval(xCoord + 15, yCoord + 15, 20, 20); g2.fillOval(xCoord + 65, yCoord + 65, 20, 20); break; case 3: g2.fillOval(xCoord + 15, yCoord + 15, 20, 20); g2.fillOval(xCoord + 40, yCoord + 40, 20, 20); g2.fillOval(xCoord + 65, yCoord + 65, 20, 20); break; case 4: g2.fillOval(xCoord + 15, yCoord + 15, 20, 20); g…
has answer: http://stackoverflow.com/a/26701773
has comment: http://stackoverflow.com/comment/41996621
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41996867
has title: Add multiple swing/awt shapes to frame
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: awt

http://stackoverflow.com/q/26822812
tagged with: url
has answer: http://stackoverflow.com/a/26827245
type: AnsweredQuestion
has title: Open url with relative path
tagged with: java
tagged with: web-crawler
type: Question
accepted answer: http://stackoverflow.com/a/26827245
tagged with: jsoup
has body: I am using Jsoup to extract links from a website: String domain_url = "http://www.example.com"; Document doc; doc = Jsoup.connect(domain_url) .userAgent("Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)") .timeout(5000) .get(); Elements links = doc.select("a[href]"); for (Element link : links) { String link_href = link.attr("href"); System.out.println(link_href); } When an absolute url appears: http://www.example.com/blog There is no problem to call this url. But how to open a relative link? /blog
score: 0
answer count: 1

http://stackoverflow.com/comment/42090260
type: Comment
comment on: http://stackoverflow.com/a/26746776
has text: oh wow, can't believe I had a mistake like that one, thank you for spotting it EJP, although after fixed I still get the handshake fail Here's my code @EDIT I am experimenting on Hello world application
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42189369
score: 0
type: AnswerComment
has text: Just add an update to the question with the new code in it, on the bottom. we could use chat but you don't have enough rep yet.
type: Comment
comment on: http://stackoverflow.com/a/26805731

http://stackoverflow.com/comment/42231104
type: QuestionComment
has text: Use a debugger. What is the value of `junctionCounter` when this occurs?
comment on: http://stackoverflow.com/q/26832270
score: 0
type: Comment

http://stackoverflow.com/q/26805013
has body: If I compile this, I get 'cannot find symbol' errors with the distance and ratio variables used inside the while loop. My problem is I don't understand why. public static void moveSomeSlugs(Point[]slugs, double d, PrintStream output){ for (int i = 0; i&lt;(slugs.length); i++){ double distance = Math.sqrt((Math.pow((slugs[(i+1)%4].x-slugs[i].x), 2))+(Math.pow((slugs[(i+1)%4].y-slugs[i].y), 2))); double ratio = d/distance; } while (d &lt; distance){ for (int i = 0; i&lt;(slugs.length); i++){ double xmoveDist = (slugs[(i+1)%4].x-slugs[i].x)*ratio; double ymoveDist = (slugs[(i+1)%4].y-slugs[i].y)*ratio; output.print (slugs[i].x + " " + slugs[i].y + " "); slugs[i].x += xmoveDist; slugs[i].y += ymoveDist; output.println (slugs[i].x + " " + slugs[i].y); distance = Math.sqrt((Math.pow((slugs[(i+1)%4].x-slugs[i].x), 2))+(Math.pow((slugs[(i+1)%4].y-slugs[i].y), 2))); ratio = d/distance;
has answer: http://stackoverflow.com/a/26805086
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25706216
has title: Cannot Find Symbol error problems
tagged with: java
downvote count: 3
type: Question
answer count: 2
score: -1
has answer: http://stackoverflow.com/a/26805118
duplicate of: http://stackoverflow.com/q/25706216
favorite count: 0

http://stackoverflow.com/a/26796510
type: Answer
has comment: http://stackoverflow.com/comment/42168049
has comment: http://stackoverflow.com/comment/42167427
has comment: http://stackoverflow.com/comment/42167718
answers question: http://stackoverflow.com/q/26796491
has comment: http://stackoverflow.com/comment/42167507
score: 0
has comment: http://stackoverflow.com/comment/42167525
has body: Change number[inputNumber] = inputNumber; to number[counter] = inputNumber; You want to add each new number to the counter position of the array. As for finding the minimum, maximum. The same loop that reads the inputs into the array can do that. Initialize largestNumber to Integer.MIN_VALUE and smallestNumber to Integer.MAX_VALUE. Then, each time you get a new number, compare it to both largestNumber and smallestNumber, and update them if the new number is higher/lower respectively.

rational-team-concert
type: Tag
tag name: rational-team-concert
tags question: http://stackoverflow.com/q/26797296

http://stackoverflow.com/q/26735170
has title: Reading File Direction/Path Java
has body: I want to read the path of a file. All I've found is about the class file, how to read the file or how to save the file in this direction. But what I want is a method that shows me the path like this: C:/Users/Administrator/Documents/NetBeansProjects/HashmapDemo/HeaderTemplate So that i can save this direction in a XML file. I hope it is understandable what I mean, I tend to write things nobody can understand. I've tried: public static String getCleanPath() { ClassLoader classLoader = XmlLoader.class.getClassLoader(); File classpathRoot = new File(classLoader.getResource("").getPath()); return classpathRoot.getPath(); } So far but like I said, it doesn't give me the information I need.
has answer: http://stackoverflow.com/a/26735225
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/320542
tagged with: logging
type: Question
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26735225

http://stackoverflow.com/q/26760851
has body: For most of my integration test I don't need any security checks. I just want to have shiro out of my way. Beeing a shiro noob I'm wondering whether there's a better way than the one I found. In my ShiroFilter class, if authentication fails I added this code: try { currentUser.login(token); return CONTINUE; } catch (AuthenticationException e1) { // if everything failed, we might actualy have the integration test configuration, let's try UsernamePasswordToken testToken = new UsernamePasswordToken("testUser", "testPassword", true, host); try { currentUser.login(testToken); return CONTINUE; } catch (AuthenticationException e2) { LOGGER.info("Unable to login", e2); } } And this is the shiro.ini for the integration tests: [users] testUser = testPassword, administrator [roles] administrator = *
upvote count: 1
has title: shiro configuration for integration testsing
type: Question
score: 1
has answer: http://stackoverflow.com/a/39579837
tagged with: java
tagged with: shiro
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42103514
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26774039
type: Answer
answers question: http://stackoverflow.com/q/26754402
has comment: http://stackoverflow.com/comment/42127892
has comment: http://stackoverflow.com/comment/42128842
score: 0
has body: As @TheBear said, I also didn't find any element with id 'lst-ib'. You can change the code to the below one to make it work: driver.findElement(By.id("gbqfq")).sendKeys("selenium"); As 'gbqfq' is in fact the id of the search box, this works correctly for me in IE and FF.

http://stackoverflow.com/comment/41953872
comment on: http://stackoverflow.com/a/26674792
type: Comment
has text: nb I assume you don't mean "high-level languages" but "interpreted languages" per se - and, even then, the difference in favour of regex is from interpreting overhead, not from wrong algorithmic approach. In AOT-compiled languages, regex always incurs a performance penalty, the same way it's faster to have own, custom-tailored parser, than to use scanf with format string to parse the data, it's faster to use a native array for random-access data than to use a high-level data abstraction etc.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42006369
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26704219
has text: Also, if you're using a loop, I'm pretty sure you want to increment the number of items with `+=`, not overwrite it.
type: AnswerComment

http://stackoverflow.com/comment/42543435
comment on: http://stackoverflow.com/a/27006016
type: Comment
has text: I really appreciate you taking the time. However, I believe your explanation and code uses the device's magnetometer and accelerometer. I am using a separate device (Sensortag cc2541). I have to get the magnetic field and acc from that device. And the device has the following. In both magnetometer AND Accelerometer, I can get an `x` `y` and `z`. Your code has functions and methods that my Sensor library probably doesn't have. **I have updated the question and added the methods and functions I have for Magnetometer and accelerometer**
type: AnswerComment
score: 0

http://stackoverflow.com/a/47440623
answers question: http://stackoverflow.com/q/26813935
score: 0
type: Answer
has body: number.matches("\\d+"); will return true if all the characters are digits; an empty string will return false

http://stackoverflow.com/q/26818231
has title: Printing a frame within frame
has comment: http://stackoverflow.com/comment/42206750
upvote count: 4
tagged with: integer
has comment: http://stackoverflow.com/comment/42206760
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42206804
has comment: http://stackoverflow.com/comment/42206823
downvote count: 0
has comment: http://stackoverflow.com/comment/42207054
has comment: http://stackoverflow.com/comment/42206870
tagged with: java
has comment: http://stackoverflow.com/comment/42206613
type: Question
tagged with: console-application
tagged with: cartesian-coordinates
has comment: http://stackoverflow.com/comment/42206956
score: 4
has comment: http://stackoverflow.com/comment/42206692
has comment: http://stackoverflow.com/comment/42207091
has answer: http://stackoverflow.com/a/26818733
accepted answer: http://stackoverflow.com/a/26818733
answer count: 1
has comment: http://stackoverflow.com/comment/42206867
has comment: http://stackoverflow.com/comment/42206679
has comment: http://stackoverflow.com/comment/42207001
tagged with: console
has comment: http://stackoverflow.com/comment/42206840
favorite count: 0
has comment: http://stackoverflow.com/comment/42206800
has body: I got this assignment in Java and I don't have a single clue on how to do it. The task is to receive an integer n > 0, and to print n number of frames constructed by * inside each other, while the inner frame will have the letter "X" constructed by 4n+1 *. I can't use arrays or strings. For example: n=1 will print: ******* * * * * * * * * * * * * * * * ******* n=2 will print: ************* * * * ********* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ********* * * * ************* This is what I have so far: Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int size = n * 6 + 1; int x = 1; int y = 1; for (int i = 0; i &lt; n; i = i + 1) { for (int i3 = 0; i3 &lt; size; i3 = i3 + 1) { System.out.print("*"); } System.out.println(""); y = y + 1; for (int i1 = 0; i1 &lt; size - 2; i1 = i1 + 1) { System.out.print("*"); for (int i2 = 0; i2 &lt; size - 2; i2 = i2 + 1) { System.out.print(" "); } System.out.println("*"); y = y + 1; } for (int i4 = 0; i4 &lt; size; i4 = i4 + 1) { System.out.print("*"); } }

http://stackoverflow.com/a/26689680
has comment: http://stackoverflow.com/comment/41976199
score: 0
has comment: http://stackoverflow.com/comment/41976225
answers question: http://stackoverflow.com/q/26689567
has comment: http://stackoverflow.com/comment/41976175
has body: If you want to do said process every single time you instantiate something you can simply put it into said object's constructor. public final TestObject() { process(this); // &lt;- this sends this instance of the object into process } this assumes that process is a public or private method within this class.
has comment: http://stackoverflow.com/comment/41976191
type: Answer
has comment: http://stackoverflow.com/comment/41976249

http://stackoverflow.com/q/26684654
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2745265
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26684765
possible better answer: http://stackoverflow.com/a/26684761
upvote count: 1
has answer: http://stackoverflow.com/a/26684761
type: Question
has answer: http://stackoverflow.com/a/26684768
tagged with: spring-java-config
has title: Class type injection in Spring xml vs java config
answer count: 3
has body: Class X{ Class&lt;B&gt; object; public setObject( Class&lt;B&gt; a ){....} } Interface B{} Interface C extends B {} I instantiate X like this, X x = new X(); x.setObject( C.class ); When i build the code it complains required Class&lt;B&gt; found Class&lt;C&gt;. Since C extends B, can i not use C.class? If so can some one explain why? I i do the same thing using Spring`s XML based bean creating it works just fine. The bean definition would be &lt;bean id="dummy" class="X"&gt; &lt;property name"object" value="C"&gt; &lt;/bean&gt; This works just fine. Im not getting why instantiating in java would fail.
downvote count: 0
favorite count: 0
tagged with: spring-ioc
accepted answer: http://stackoverflow.com/a/26684768
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42113805
type: QuestionComment
has text: What type of video card does your computer use? NVidia?
score: 0
comment on: http://stackoverflow.com/q/26766476
type: Comment

http://stackoverflow.com/q/26705531
has comment: http://stackoverflow.com/comment/42003998
has title: List all constants of specified class
answer count: 3
has comment: http://stackoverflow.com/comment/42004574
has comment: http://stackoverflow.com/comment/42004017
has body: My question is: how to create a list of all constants of specified class? Is this possible in an easy way? Or I just need to write my own (somewhat simple) solution for this? Let me present some code: public class StateOfSomeProcess { private final static String STATE_A = "State A"; private final static String STATE_B = "State B"; private final static String STATE_C = "State C"; private final static String STATE_D = "State D"; public StateOfSomeProcess() {...} public List&lt;String&gt; getListOfAllStates() { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); ... //I wish there was a method like this: //list = this.getAllConstantsFromClass(); ... return list; } } I know about enums, but it does not seem to fit my needs. Please feel free to let me know if my question is unclear or needs improvement.
accepted answer: http://stackoverflow.com/a/26957849
favorite count: 0
has comment: http://stackoverflow.com/comment/42003955
has comment: http://stackoverflow.com/comment/42018486
upvote count: 6
tagged with: constants
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/26705664
has answer: http://stackoverflow.com/a/67078510
has answer: http://stackoverflow.com/a/26705664
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26957849
linked to: http://stackoverflow.com/q/6144227
score: 5
tagged with: java

http://stackoverflow.com/q/26752613
answer count: 1
accepted answer: http://stackoverflow.com/a/26752675
type: AnsweredQuestion
tagged with: cookies
tagged with: java
type: Question
has title: Client resources in different machine than backend issues
tagged with: ajax
score: 0
has body: We have a production web application that consists front end and back end web application. For a year now we developed a new backend project in order to replace the old backend webapp. So we tried to replace the URL called by the front end components (mainly ajax) instead of the original old backend URL to the new backend URL. We immediately confronted a problem when trying to use a new cookie for the new backend domain (which is different). the browser wont allow us to do so. Is it possible to achieve this?
has comment: http://stackoverflow.com/comment/42088544
has answer: http://stackoverflow.com/a/26752675

http://stackoverflow.com/comment/42124469
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26771632
type: Comment
has text: Below about JakeWharton's project would be helpful, about indicating the viewed pages, you can informing the page index to your PagerIndicator when ViewPager scroll state been idle.

http://stackoverflow.com/comment/41997456
type: QuestionComment
has text: `element.get(i).getAttribute("memberId")` is most likely null
comment on: http://stackoverflow.com/q/26701829
score: 0
type: Comment

loops
tags question: http://stackoverflow.com/q/26723504
tags question: http://stackoverflow.com/q/26760349
tags question: http://stackoverflow.com/q/26739083
tags question: http://stackoverflow.com/q/26750985
tags question: http://stackoverflow.com/q/26748908
tags question: http://stackoverflow.com/q/26817808
tags question: http://stackoverflow.com/q/26734013
tags question: http://stackoverflow.com/q/26736448
tags question: http://stackoverflow.com/q/26720071
tags question: http://stackoverflow.com/q/26748668
tags question: http://stackoverflow.com/q/26762148
tags question: http://stackoverflow.com/q/26813249
tags question: http://stackoverflow.com/q/26747405
tags question: http://stackoverflow.com/q/26743618
type: Tag
tags question: http://stackoverflow.com/q/26825826
tags question: http://stackoverflow.com/q/26808858
tags question: http://stackoverflow.com/q/26685303
tags question: http://stackoverflow.com/q/26740716
tags question: http://stackoverflow.com/q/26771787
tags question: http://stackoverflow.com/q/26822900
tags question: http://stackoverflow.com/q/26783263
tags question: http://stackoverflow.com/q/26768195
tags question: http://stackoverflow.com/q/26823855
tags question: http://stackoverflow.com/q/26768947
tags question: http://stackoverflow.com/q/26780824
tags question: http://stackoverflow.com/q/26761518
tags question: http://stackoverflow.com/q/26815920
tags question: http://stackoverflow.com/q/26817976
tags question: http://stackoverflow.com/q/26683136
tags question: http://stackoverflow.com/q/26816687
tags question: http://stackoverflow.com/q/26831895
tag name: loops
tags question: http://stackoverflow.com/q/26808062
tags question: http://stackoverflow.com/q/26810691
tags question: http://stackoverflow.com/q/26826455
tags question: http://stackoverflow.com/q/26695433
tags question: http://stackoverflow.com/q/26720379
tags question: http://stackoverflow.com/q/26827368
tags question: http://stackoverflow.com/q/26807352
tags question: http://stackoverflow.com/q/26753386
tags question: http://stackoverflow.com/q/26808084
tags question: http://stackoverflow.com/q/26718580
tags question: http://stackoverflow.com/q/26831087
tags question: http://stackoverflow.com/q/26770419
tags question: http://stackoverflow.com/q/26738056
tags question: http://stackoverflow.com/q/26794488
tags question: http://stackoverflow.com/q/26803484
tags question: http://stackoverflow.com/q/26795053
tags question: http://stackoverflow.com/q/26742867
tags question: http://stackoverflow.com/q/26792717
tags question: http://stackoverflow.com/q/26748026
tags question: http://stackoverflow.com/q/26800059
tags question: http://stackoverflow.com/q/26831097
tags question: http://stackoverflow.com/q/26773403
tags question: http://stackoverflow.com/q/26721911

http://stackoverflow.com/q/26686581
has title: How to Handle fetch and add Integer value from nested ArrayList to List
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26687798
accepted answer: http://stackoverflow.com/a/26687798
has answer: http://stackoverflow.com/a/26686647
type: Question
has body: Im getting following message java.util.ArrayList cannot be cast to java.lang.Integer While trying to fetch the values from nested arraylist&lt;Object&gt; listsALL and add the value in to list&lt;Integer&gt; listPriceFinal listPriceFinal.add(Integer.valueOf((Integer)listsALL.get(2))); listsALL contains Integer, String Values example : listsALL------------- [[0, 1, 5, 4, 6], [250, 260], [230], [Item 1, Item 2, Item 6], [Item 5, Item 7]] While trying with String value I didn’t get any issues. Like sItems100.add(String.valueOf(listsALL.get(4))); How to resolve or how to handle for Integer, Please any one help in this…..
tagged with: arraylist
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26686628
possible better answer: http://stackoverflow.com/a/26686647

http://stackoverflow.com/q/26788304
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has title: Windows 7 Look and Feel for JFileChooser
tagged with: swing
has comment: http://stackoverflow.com/comment/42154271
has body: I am not able to get my JFileChooser to look like the Windows 7 file chooser dialog. I'm using Java 7. What I want: What I get: My app sets the look and feel in the main method before opening any Swing windows: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); I tried manually assigning a Windows look and feel class to the JFileChooser with no success: JFileChooser fileChooser = new JFileChooser(); WindowsFileChooserUI wui = new WindowsFileChooserUI(fileChooser); wui.installUI(fileChooser); I've also tried setting the look and feel via a system property at the command line, but that didn't help either. -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel Any ideas? Thanks.
duplicate of: http://stackoverflow.com/q/5703825
downvote count: 0
answer count: 0
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5703825

http://stackoverflow.com/a/26746604
has comment: http://stackoverflow.com/comment/42078630
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42078546
has comment: http://stackoverflow.com/comment/42078696
accepted answer of: http://stackoverflow.com/q/26746435
score: 0
answers question: http://stackoverflow.com/q/26746435
type: Answer
has comment: http://stackoverflow.com/comment/42078614
has body: I have tried this solution, and it works. i honestrly don't see any problem in your code except some Compilation Error but i think is cause you have simplified the code public static JTextField txt1; final JButton submit; public MainWindw() { JFrame panel = new JFrame(); txt1 = new JTextField(); submit = new JButton("Submit"); panel.setLayout(new FlowLayout()); panel.add(txt1); panel.add(submit); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Submit button pressed" + txt1.getText()); } }); panel.setSize(300, 300); panel.setVisible(true); }
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42047197
comment on: http://stackoverflow.com/a/26729599
has text: do you mean I should rearrange the value of my some_string_param value? I mean, I should parse this value and replcae all apostrophes in it?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42005710
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26706439
score: 0
has text: You could also use Regular Expressions (http://www.vogella.com/tutorials/JavaRegularExpressions/article.html#introduction) to hide all characters within the answer that haven't yet been found.

http://stackoverflow.com/comment/42046952
comment on: http://stackoverflow.com/q/26729447
type: Comment
type: QuestionComment
score: 2
has text: You could use a `CountDownLatch` or `CyclicBarrier`

http://stackoverflow.com/q/26726366
possible better answer: http://stackoverflow.com/a/26726451
has answer: http://stackoverflow.com/a/26726451
score: 18
has answer: http://stackoverflow.com/a/59118334
answer count: 3
favorite count: 0
tagged with: nested-lists
tagged with: multidimensional-array
has body: I'm trying to convert a nested list into a 2d array. List&lt;List&lt;String&gt;&gt; list = new ArrayList&lt;&gt;(); list.add(Arrays.asList("a", "b", "c")); list.add(Arrays.asList("dd")); list.add(Arrays.asList("eee", "fff")); I want to make this a String[][]. I've tried the following: String[][] array = (String[][]) list.toArray(); // ClassCastException String[][] array = list.toArray(new String[3][3]); // ArrayStoreException String[][] array = (String[][]) list.stream() // ClassCastException .map(sublist -&gt; (String[]) sublist.toArray()).toArray(); Is there a way that works? Note that I won't know the size of the list until runtime, and it may be jagged.
upvote count: 18
has title: Convert nested list to 2d array
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42041777
type: Question
has answer: http://stackoverflow.com/a/26726443
accepted answer: http://stackoverflow.com/a/26726443

http://stackoverflow.com/a/26722435
has comment: http://stackoverflow.com/comment/42036955
type: Answer
has comment: http://stackoverflow.com/comment/42035531
has body: In you application you can protect links checking roles (pseudo code, some frameworks have already custom tags for it): if(request.isUserInRole("roleX")) { // render menu item for roleX } By default, if user is already logged in and tries to access page that is restricted for him, he will receive 403 Not authorized, you can provide error page for that code via web.xml configuration. In the server.xml via Application binding element you provide only mapping from your application roles to groups defined in the registry. Depending on the registry type you will be able to add/remove users to the given group granting or rejecting them right for example via server.xml or LDAP management tool in case of LDAP registry.
answers question: http://stackoverflow.com/q/26720572
score: 0

http://stackoverflow.com/comment/42083657
type: AnswerComment
score: 0
has text: Okay so those calls to repaint in the main thread are not actually displayed on the panel while the event thread is held up. How does that actually work? It seems as they are just passed over because the faster I click the play button, the close the ball appears to its last position. From this I take it the main thread is definitely updating its position just not displaying it even though calls the the repaint method are being made on the main thread.
type: Comment
comment on: http://stackoverflow.com/a/26749272

http://stackoverflow.com/comment/42108788
type: QuestionComment
comment on: http://stackoverflow.com/q/26763689
has text: I added the code I am using that does not work as expected.
score: 0
type: Comment

http://stackoverflow.com/q/26756571
favorite count: 0
has comment: http://stackoverflow.com/comment/42095642
has comment: http://stackoverflow.com/comment/42097004
upvote count: 1
has comment: http://stackoverflow.com/comment/42095710
linked to: http://stackoverflow.com/q/26427333
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
has title: mysqldump does not work in java
has body: I am using this command line argument to clone a database :- "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump" -u root -ppass -d oldDB | mysql -u root -ppass -DnewDB This piece works fine when directly pasted into command line. But, when I tried running this argument using java, it did not work. My java code is :- String serverLoc = "C:\\Program Files\\MySQL\\MySQL Server 5.6\\"; String a = "\"" + serverLoc + "bin\\mysqldump\" " ; String cmd = a + "-u root -ppass -d oldDB | mysql -u root -ppass -DnewDB"; Process runtimeProcess = Runtime.getRuntime().exec(executeCmd); int processComplete = runtimeProcess.waitFor(); if (processComplete == 0) { System.out.println("SUCCESS"); } else { System.out.println("ERROR"); } //OUTPUT : ERROR Exception handling not shown as no stack trace is printed. When I print cmd, the above desired string is printed which works when pasted into command line. Please help me solve this dilemma.
type: Question
has answer: http://stackoverflow.com/a/26756860
accepted answer: http://stackoverflow.com/a/26756860
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42095347

http://stackoverflow.com/q/26829296
upvote count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/2444005
has title: Server to send messages to clients
favorite count: 0
accepted answer: http://stackoverflow.com/a/26831056
answer count: 1
tagged with: javafx-2
has answer: http://stackoverflow.com/a/26831056
tagged with: multithreading
has body: I'm relatively new to Java and I'm having problems creating a multi-client/server chat. I need to implement the server to where it can receive multiple messages from one or more clients and it will send all of those messages to all of the clients. So, say there are two clients and client1 sends the message "hi" to the server. The server will send that message to client1 and client2 (it does a send back to all possible clients which are connected to the server). Also, how do I associate the client's username with their message? If client1 sent "hi", I'd want the TextAreas in Client1 and Client2 that display the messages to say "client1: hi". The implementations are done in JavaFX. Server code: package server; import java.io.*; import java.net.*; import java.util.*; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TextArea; public class ServerFormController implements Initializable{ @FXML public TextArea svrLog; private int clientNo = 0; ArrayList&lt;HandleAClient&gt; clients = new ArrayList&lt;&gt;(); //@Override // public void run() // { // } @Override public void initialize(URL url, ResourceBundle rb) { new Thread( () -&gt; { try{ ServerSocket serverSocket = new ServerSocket(8000); svrLog.appendText("Server started at " + new Date() + '\n'); while (true) { Socket socket = serverSocket.accept(); svrLog.appendText("Worked \n"); clientNo++; //svrLog.appendText("Starting thread for client " + clientNo + "at" // + new Date() + '\n'); // InetAddress inetAddress = socket.getInetAddress(); //svrLog.appendText("Client " + clientNo + "'s host name is " //+ inetAddress.getHostName() + "\n"); // svrLog.appendText("Client " + clientNo + "'s IP Address is " // + inetAddress.getHostAddress() + "\n"); new Thread(new HandleAClient(socket)).start(); } } catch (IOException ex) { svrLog.appendText("Couldn't create ServerSocket! \n"); } }).start(); } /** Creates individual client socket*/ class HandleAClient impl…
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
type: Question
tagged with: client-server

http://stackoverflow.com/comment/42064691
comment on: http://stackoverflow.com/q/26738862
type: QuestionComment
has text: i have made an answer with possible solutions. plz have a check if ny of them helps
type: Comment
score: 0

http://stackoverflow.com/comment/42009793
type: Comment
has text: where did u get the idea for the CSS ? from the code I can not see any relation between it with CSS . and the tutorial did not say anything about the CSS either.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26708554

http://stackoverflow.com/q/26762195
tagged with: jackson
downvote count: 0
answer count: 1
score: 1
has body: Using many enum classes for my rest application. Things likes STATUS, CURRENCY etc are covered using enums. Right now I have to validate every request at the Rest Controller level against it's corresponding enum value. Is there a way to catch this error at the marshaling level and handle it via Exception Mapper? Webservice supports both XML and JSON formats. Xml is taken care by JAXB and Json is implemented using Jackson api.
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has title: Jersey: Exception Mapper to validate enum values while marshaling request payload
has answer: http://stackoverflow.com/a/31068567
tagged with: java
linked to: http://stackoverflow.com/q/17531920
tagged with: jaxb
upvote count: 1
type: Question
tagged with: jersey

http://stackoverflow.com/comment/42155595
score: 0
comment on: http://stackoverflow.com/q/26787697
type: Comment
type: QuestionComment
has text: Out of interest, what'd be your use case for this?

http://stackoverflow.com/comment/42106735
score: 0
type: Comment
has text: Now, how come it is not running in an infinite loop? obviously if it can't get to 64 with only the moves I provided,but it should at least try to move around the board. Instead everytime I run it, it randomizes a move, and terminates.
type: AnswerComment
comment on: http://stackoverflow.com/a/26762536

http://stackoverflow.com/comment/42053635
type: Comment
comment on: http://stackoverflow.com/a/26731867
type: AnswerComment
has text: @Leo: It's justified because it doesn't cause the traditional problems associated with multiple inheritance. You're extending the contract for an interface, not inheriting behaviour from a class.
score: 0

http://stackoverflow.com/comment/42199997
type: Comment
comment on: http://stackoverflow.com/q/26814119
has text: http://stackoverflow.com/a/7181792/1318946
score: 0
type: QuestionComment

http://stackoverflow.com/q/26810114
type: Question
has title: Java: How do I make a loop which creates arrays?
upvote count: 5
tagged with: arrays
has answer: http://stackoverflow.com/a/26810287
has comment: http://stackoverflow.com/comment/42192797
has answer: http://stackoverflow.com/a/26810193
possible better answer: http://stackoverflow.com/a/26810287
has comment: http://stackoverflow.com/comment/42192806
favorite count: 0
has answer: http://stackoverflow.com/a/26810146
has comment: http://stackoverflow.com/comment/42192840
answer count: 5
has answer: http://stackoverflow.com/a/26810157
has answer: http://stackoverflow.com/a/26810353
downvote count: 2
has body: I need a large series of arrays, right now I am creating them manually: int[] row1 = new int[3]; int[] row2 = new int[3]; int[] row3 = new int[3]; I would like to create these in an array, something like this: public final int SIZE = 3; for (int i = 1;i &lt;= 3;i++) int[] row[i] = new int[3]; But I am not sure how to generate arrays in a loop. How do I do this? Specifically, how do I generate dynamic identifiers on each iteration?
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42192850
accepted answer: http://stackoverflow.com/a/26810146

http://stackoverflow.com/a/26707086
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26706134
type: AcceptedAnswer
downvote count: 0
has body: The variables have been explained, but if you are still having trouble understanding what a game loop does in a general sense (I don't know how much he explained in the tutorial), hopefully I can shed some light from what I have learned: Basically, the game loop, well, runs (renders, updates, etc.) the game of course, but it also sets a constant, controlled speed at which the game operates. For example, imagine you wanted to make a 2D RPG game, and you want a mob (character) to move across the screen at, say, 200 pixels per second. You can do this with a loop, but the thing is, different computers will cause the character to move faster or slower at different times because the computer will just execute the code in the loop over and over as fast as it can. This is why you implement code to control how fast the code is executed, and thus, how fast the game updates. You can do this by using the real world time (using methods that get time in nanoseconds). You limit the game to only updating the frame 60 times per second. Using the if statement in the while (running) loop, you make the game update only when the program goes through the loop and the time since the last time the if statement executed is atleast 1/60 of a second. Hopefully that makes sense. Sorry for the long response. If you have more questions feel free to ask!
accepted answer of: http://stackoverflow.com/q/26706134

http://stackoverflow.com/q/26712025
tagged with: eclipse
has title: Java eclipse resources?
answer count: 2
upvote count: 0
favorite count: 0
has body: I need som help with using resources in java eclipse. At the moment i am working on a tower defense but i can't load it when i export the runnable jar. since my level file where my map is created can't be loaded as a getFile, how can i change this code. public Level getLevel(String fileName){ try{ file = new FileInputStream("level/" + fileName + ".level"); reader = new InputStreamReader(file); scanner = new Scanner(reader); level.map = new int[22][18]; I am new at devolping and i never really knew about the resource and i can't find a good way to change it now so that it works with resource URL something like that :)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26712065
downvote count: 1
tagged with: resources
type: Question
has answer: http://stackoverflow.com/a/26712132
tagged with: java
score: -1

infinite-loop
tags question: http://stackoverflow.com/q/26684729
tags question: http://stackoverflow.com/q/26808993
type: Tag
tag name: infinite-loop
tags question: http://stackoverflow.com/q/26759737

http://stackoverflow.com/a/27517794
answers question: http://stackoverflow.com/q/26830987
has comment: http://stackoverflow.com/comment/43465871
score: 0
has body: Create an virtual host and then change hosts file. Following link explains it. http://en.kioskea.net/faq/8485-configuring-apache-and-windows-to-create-a-virtual-host
type: Answer

http://stackoverflow.com/comment/42224785
score: 0
type: AnswerComment
type: Comment
has text: Idea is Great let me try and if its work i'll obviously add vote for you Thanks almas
comment on: http://stackoverflow.com/a/26828727

http://stackoverflow.com/a/26708687
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26708077
has body: ior is null, which implies that oir.txt is empty, which is caused by failing to close the file when you wrote it. Add a close() after the println().
answers question: http://stackoverflow.com/q/26708077
upvote count: 1

return
tags question: http://stackoverflow.com/q/26702947
tags question: http://stackoverflow.com/q/26820668
tags question: http://stackoverflow.com/q/26814399
type: Tag
tags question: http://stackoverflow.com/q/26767216
tags question: http://stackoverflow.com/q/26801798
tags question: http://stackoverflow.com/q/26717583
tag name: return
tags question: http://stackoverflow.com/q/26764423
tags question: http://stackoverflow.com/q/26799504
tags question: http://stackoverflow.com/q/26743826
tags question: http://stackoverflow.com/q/26721094
tags question: http://stackoverflow.com/q/26800059
tags question: http://stackoverflow.com/q/26826455
tags question: http://stackoverflow.com/q/26813159
tags question: http://stackoverflow.com/q/26686361
tags question: http://stackoverflow.com/q/26793670

http://stackoverflow.com/q/26786625
has answer: http://stackoverflow.com/a/26786982
downvote count: 0
answer count: 1
tagged with: string
has body: I have a String text "Welcome!to java@"; I know how to convert it to receive array [Welcome, to, java] String[] aaa = text.split("[\\p{IsPunctuation}\\p{IsWhite_Space}]"); System.out.println(Arrays.toString(aaa)); //priinting But I need to include punctuation. I need to receive [Welcome, !, to, java, @] Anybody know who to receive it ? The reason why I need to do it, because i have a randomise(char[] cw) method, which is tweaking words for me. However that method is going crazy when punctuation is included public void randomise(char[] cw) { for (int i = 1; i &lt; cw.length-1; i++) { //my range int range= (int)(Math.random() * (cw.length - i - 1)); //swap index int index=i+range; //swap char temp = cw[i]; cw[i] = cw[index]; cw[index] = temp; } System.out.println(cw); } Thanks for reply
duplicate of: http://stackoverflow.com/q/275768
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42150620
score: 1
tagged with: java
has title: String conversion to char array including punctuation
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42150697
has comment: http://stackoverflow.com/comment/42150293
linked to: http://stackoverflow.com/q/2206378
has comment: http://stackoverflow.com/comment/42149885
linked to: http://stackoverflow.com/q/275768

http://stackoverflow.com/a/27044295
upvote count: 3
has comment: http://stackoverflow.com/comment/47785999
score: 3
has comment: http://stackoverflow.com/comment/47880803
has body: Sure. You can do it in any class public final static String FINAL_STRING = BuildConfig.DEBUG ? "debug" : "release";
has comment: http://stackoverflow.com/comment/47823012
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26800733
answers question: http://stackoverflow.com/q/26800733

http://stackoverflow.com/a/26815565
has comment: http://stackoverflow.com/comment/42202372
has comment: http://stackoverflow.com/comment/42202478
type: AcceptedAnswer
score: 30
upvote count: 30
has comment: http://stackoverflow.com/comment/42202340
has comment: http://stackoverflow.com/comment/42202672
has comment: http://stackoverflow.com/comment/42206326
has comment: http://stackoverflow.com/comment/42202465
type: Answer
has body: The issue is most likely that you're not compiling the C version with optimization enabled. If you enable aggressive optimization, the binary produced by gcc should win. The JVM's JIT is good, but the simple fact is that the JVM has to load and then apply JIT at runtime; gcc can optimize the binary at compile-time. Leaving off all gcc flags gives me a binary that performs fairly slowly, like yours. Using -O2 gives me a binary that just barely loses out to the Java version. Using -O3 gives me one that easily beats the Java version. (This is on my Linux Mint 16 64-bit machine with gcc 4.8.1 and Java 1.8.0_20 [e.g., Java 8 Update 20].) larsmans examined the disassembly of the -O3 version and assures me that the compiler isn't precomputing the result (my C and assembly fu is very weak these days; many thanks to larsmans for double-checking that). Interestingly, though, thanks to investigation by Mat, it looks like that's actually a byproduct of my using gcc 4.8.1; earlier and later versions of gcc seem to be willing to precompute the result. Happy accident for us, though. Here's my pure C version [I've also updated it to account for Ajay's comment about your using a constant in the Java version, but the variable N in the C version (didn't make any real difference, but...)]: sum.c: #include &lt;stdio.h&gt; int main(){ long sum=0; long i; for( i=0; i&lt;1000000000; i++ ) sum+= i; printf("%ld\n",sum); } My Java version is unchanged from yours other than that I lost track of the zeroes too easily: sum.java: public class sum { public static void main(String[] args) { long sum=0; for(long i = 0; i &lt; 1000000000; i++) sum += i; System.out.println(sum); } } Results: C binary run (compiled via gcc sum.c): $ time ./a.out 499999999500000000 real 0m2.436s user 0m2.429s sys 0m0.004s Java run (compiled with no special flags, run with no special runtime flags): $ time java sum 499999999500000000 real 0m0.691s user 0m0.684s sys 0m0.020s Java run (compiled with no special flags, run w…
has comment: http://stackoverflow.com/comment/42205084
has comment: http://stackoverflow.com/comment/42202592
has comment: http://stackoverflow.com/comment/42202104
has comment: http://stackoverflow.com/comment/42202511
answers question: http://stackoverflow.com/q/26815471
has comment: http://stackoverflow.com/comment/42202555
has comment: http://stackoverflow.com/comment/42202156
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26815471
has comment: http://stackoverflow.com/comment/44434435
has comment: http://stackoverflow.com/comment/42202429

gson
tags question: http://stackoverflow.com/q/26826442
tags question: http://stackoverflow.com/q/26792489
tags question: http://stackoverflow.com/q/26791752
tags question: http://stackoverflow.com/q/26824467
tags question: http://stackoverflow.com/q/26718649
tags question: http://stackoverflow.com/q/26741073
tags question: http://stackoverflow.com/q/26723883
tags question: http://stackoverflow.com/q/26830035
tags question: http://stackoverflow.com/q/26781680
tags question: http://stackoverflow.com/q/26756627
tags question: http://stackoverflow.com/q/26741358
tag name: gson
tags question: http://stackoverflow.com/q/26793136
tags question: http://stackoverflow.com/q/26684009
tags question: http://stackoverflow.com/q/26680656
tags question: http://stackoverflow.com/q/26684665
type: Tag
tags question: http://stackoverflow.com/q/26768052

http://stackoverflow.com/q/26717257
has title: How do I construct a inverse join for a unidirectional relationship?
type: Question
has body: I guess this is easy, but I can't figure it out. If I have entities Foo and Bar: @Entity class Foo{ @OneToMany List&lt;Bar&gt; bars; } @Entity class Bar{ @Column int data; } and if I want to create a Join (javax.persistence.criteria.Join&lt;Foo, Bar&gt;) object, I can do it like this: Root&lt;Foo&gt; root = ...; Join&lt;Foo,Bar&gt; join = root.join(Foo_.bars); But how can I make an inverse join Join&lt;Bar,Foo&gt; inverseJoin = barRoot.join....()...? since I don't have a java field in the class Bar that points to it's Foo parent, it is unidirectional relation?
has comment: http://stackoverflow.com/comment/42028303
score: 10
has comment: http://stackoverflow.com/comment/58711689
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/42026563
tagged with: jpa
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/39075289
type: UnansweredQuestion
upvote count: 10
has comment: http://stackoverflow.com/comment/42024909
linked to: http://stackoverflow.com/q/27939173
downvote count: 0
tagged with: join
tagged with: java
tagged with: criteria-api

http://stackoverflow.com/comment/42010880
comment on: http://stackoverflow.com/a/26709000
score: 0
type: AnswerComment
type: Comment
has text: can you give me a clear solution.. like an example code in which I can test

http://stackoverflow.com/comment/42230607
type: Comment
comment on: http://stackoverflow.com/a/26831912
has text: Thank you! Are there any third party APIs that I can use for this or even a screen reader?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26692308
has comment: http://stackoverflow.com/comment/41980486
score: 0
has body: Do you have main method? Try Run - Run Configurations - Java Application and create new launch configuration.
has comment: http://stackoverflow.com/comment/41980462
type: Answer
answers question: http://stackoverflow.com/q/26692214

http://stackoverflow.com/comment/42053494
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26732679
has text: Unrelated to the question directly, but it might help to simplify things a little. Consider using a list of lists that you generate as needed rather than writing in each list, i.e. ArrayList<ArrayList<Integer>> with a for loop that adds N lists where N is number of rows. That will allow a lot of your logic later on to be minimised down considerably (for instance all those ifs can go) and as you want to scale up it will be a lot easier.
score: 0

http://stackoverflow.com/comment/42232984
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26832286
type: AnswerComment
has text: Honestly not sure. I used this type of mapping alot with aggregations and when there is no hsql function mapping there is no replacement. So try using `createQuery` instead.

http://stackoverflow.com/comment/41977711
comment on: http://stackoverflow.com/q/26689123
has text: ECB mode is not safe for strings. With regards to the string, you should encode as base 64 instead. How do you know if the amount of digits in the output is 2 or 3 for each character?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42204442
type: AnswerComment
has text: Be aware that nothing blocks in your scenario. first .acquire() is ok since the Semaphore count is 1, it gets to 0 and continues. Then you release the other Sem. Fine, the count is now 2. Then your Teller starts, it actions the withdrawal sem, the count is 1. Finally it releases the other sem, its count is back to 1
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26816830

http://stackoverflow.com/comment/49046841
score: 0
type: AnswerComment
type: Comment
has text: yeah, by default SpringBoot does not take into account Jackson2ObjectMapperBuilder Bean. If you take a look on how the default WebMvcConfigurerAdapter is initialized you will note that it uses Jackson2ObjectMapperBuilder.json() static method instead of Bean injection
comment on: http://stackoverflow.com/a/30482806

http://stackoverflow.com/comment/42211164
type: Comment
has text: You probably need to zoom in in your image viewer software. Did you check the pixel size of the image?
score: 3
comment on: http://stackoverflow.com/a/26820777
type: AnswerComment

isometric
tags question: http://stackoverflow.com/q/26677286
tag name: isometric
type: Tag

http://stackoverflow.com/comment/42073888
comment on: http://stackoverflow.com/q/26743820
score: 0
type: Comment
type: QuestionComment
has text: @njzk2 I'm not sure that my deserialize method called, because in the debugging mode any of their rows hadn't called before error.

http://stackoverflow.com/a/26793123
has comment: http://stackoverflow.com/comment/42162734
has body: You need to create a new run configuration. Eclipse doesn't know how to run your web app for you hence why its greyed out. Check out this for starters: http://wiki.openkm.com/index.php/Configure_Tomcat_server_in_Eclipse http://www.codejava.net/frameworks/spring/spring-mvc-beginner-tutorial-with-spring-tool-suite-ide Once you configure a server you can then select project to deploy to server and run. Here is another good link to help you out run: http://www.deepakgaikwad.net/index.php/2009/02/08/spring-mvc-tutorial-with-eclipse-and-tomcat.html
score: 0
has comment: http://stackoverflow.com/comment/42162258
type: Answer
answers question: http://stackoverflow.com/q/26792824

design-patterns
tags question: http://stackoverflow.com/q/26685242
tags question: http://stackoverflow.com/q/26816586
tags question: http://stackoverflow.com/q/26706792
tags question: http://stackoverflow.com/q/26746658
tags question: http://stackoverflow.com/q/26776872
tag name: design-patterns
tags question: http://stackoverflow.com/q/26790248
tags question: http://stackoverflow.com/q/26777650
tags question: http://stackoverflow.com/q/26694376
tags question: http://stackoverflow.com/q/26829801
type: Tag
tags question: http://stackoverflow.com/q/26684990
tags question: http://stackoverflow.com/q/26774472
tags question: http://stackoverflow.com/q/26707037
tags question: http://stackoverflow.com/q/26764903
tags question: http://stackoverflow.com/q/26702120
tags question: http://stackoverflow.com/q/26801326
tags question: http://stackoverflow.com/q/26705550
tags question: http://stackoverflow.com/q/26782535
tags question: http://stackoverflow.com/q/26719981
tags question: http://stackoverflow.com/q/26723820
tags question: http://stackoverflow.com/q/26788608
tags question: http://stackoverflow.com/q/26770041
tags question: http://stackoverflow.com/q/26697347
tags question: http://stackoverflow.com/q/26803236

http://stackoverflow.com/a/26730109
upvote count: 10
answers question: http://stackoverflow.com/q/26729799
downvote count: 0
type: Answer
score: 10
has body: That line in the CSV file contains an invalid character between one of your cells and either the end of line, end of file, or the next cell. A very common cause for this is a failure to escape your encapsulating character (the character that is used to "wrap" each cell, so CSV knows where a cell (token) starts and ends.

android-intent
tags question: http://stackoverflow.com/q/26817448
tags question: http://stackoverflow.com/q/26702179
tags question: http://stackoverflow.com/q/26718775
tags question: http://stackoverflow.com/q/26724632
tags question: http://stackoverflow.com/q/26740648
tags question: http://stackoverflow.com/q/26722555
tags question: http://stackoverflow.com/q/26805817
tags question: http://stackoverflow.com/q/26704917
tags question: http://stackoverflow.com/q/26820900
tags question: http://stackoverflow.com/q/26698888
tags question: http://stackoverflow.com/q/26748474
type: Tag
tags question: http://stackoverflow.com/q/26735752
tag name: android-intent
tags question: http://stackoverflow.com/q/26787509
tags question: http://stackoverflow.com/q/26746103
tags question: http://stackoverflow.com/q/26810254
tags question: http://stackoverflow.com/q/26711220
tags question: http://stackoverflow.com/q/26755421
tags question: http://stackoverflow.com/q/26735084
tags question: http://stackoverflow.com/q/26685069
tags question: http://stackoverflow.com/q/26702301

http://stackoverflow.com/comment/42177108
comment on: http://stackoverflow.com/a/26801830
type: Comment
score: 1
has text: Clearly this is a homework, please consider on pointing out where the OP is wrong, not just do the homework for him. What he learns this way?
type: AnswerComment

http://stackoverflow.com/q/26757749
has title: Netty does not handle multiple messages at once
type: Question
has comment: http://stackoverflow.com/comment/42169996
has comment: http://stackoverflow.com/comment/42160498
has comment: http://stackoverflow.com/comment/42201172
has body: During the tests on your server "nety" I was faced with an unpleasant problem. I emulate the situation where communication is very poor, and two packets arrived simultaneously. The server must process the packets as follows: income binary packet | transcription packet into my POJO Message class object (objects if few messages in one packet found) | filtering unexpected messages | do Logic on every message But when two messages are found in one income packet, only first is processed. Decoder that transcripts income bytes to Message type public class InboundDecryptor extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List&lt;Object&gt; out) throws Exception { // identified =false; ArrayList&lt;Message&gt; results = new ArrayList&lt;&gt;(); byte[] byteinput = new byte[in.readableBytes()]; in.readBytes(byteinput); Message lastIncome = ctx.channel().attr(Server.getLastIncomeKey()).get(); LOG.debug("RawIncome: " + Message.bytesToHex(byteinput) + "\nlength: " + byteinput.length); ArrayList&lt;byte[]&gt; packets = PacketGet.getBytePackets(byteinput); if (packets != null &amp; !packets.isEmpty()) { //send packets to decryption for (byte[] packet : packets) { byte[] decrypted; decrypted = ctx.channel().attr(Server.cypherattrkey).get().decrypt(packet); LOG.debug(("bytesIn:" + Message.bytesToHex(decrypted))); Message message = PacketGet.toMessage(decrypted); if (message != null) { LOG.debug(message.toString()); if (checkNumber(message, ctx, out)) { out.add((Object) message); //send packets to further managing } else { skipDC = true; } } } } if (out.isEmpty() &amp;&amp; !skipDC) { skipDC = false; LOG.debug("Nothing was parsed"); ctx.close(); } } The next is filter that process messages and throw away unexpected. public class ResponseHandler extends MessageToMessageCodec&lt;Message, Message&gt; { @Override protected void decode(ChannelHandlerContext ctx, Message msg, List&lt;Object&gt; out) throws Exception { //throw away unexpec…
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42148576
has comment: http://stackoverflow.com/comment/42160568
type: UnansweredQuestion
tagged with: netty
has comment: http://stackoverflow.com/comment/42120739
answer count: 0
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/26713453
has comment: http://stackoverflow.com/comment/42041841
upvote count: 10
has comment: http://stackoverflow.com/comment/79395722
type: Answer
has comment: http://stackoverflow.com/comment/42033192
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26705602
has body: you can use inline css for style your table .you can't use css separatly since most email services don't support it ..try to change your email String building code to following code. email.append(" " + " "); update.setString(1, "Outstanding"); ResultSet results = update.executeQuery(); while (results.next()) { System.out.println("in results..."); email.append(" "); email.append(" "); long period = results.getLong("period_to"); email.append(DateConvert.fromEpoch(period)); email.append(" "); email.append(" "); email.append(results.getString("type")); email.append(" "); email.append(" "); email.append(results.getString("amt")); email.append(" "); email.append(" "); email.append(results.getString("status")); email.append(" "); email.append(" "); } email.append(" "); sm.populateMailMessage(email.toString()); sm.sendMail();
answers question: http://stackoverflow.com/q/26705602
type: AcceptedAnswer
score: 10
has comment: http://stackoverflow.com/comment/42041324

http://stackoverflow.com/q/26774309
answer count: 1
accepted answer: http://stackoverflow.com/a/26774346
score: 0
has answer: http://stackoverflow.com/a/26774346
has title: When I attach a controller to my fxml file, I get a constructLoadException
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
has body: I'm using SceneBuilder to building a Java GUI Application. I tried to attach a Controller to my fxml file, so I could have actual functionality in my application. I should mention that it was running with no errors prior to this. When I attached the controller, I got this: at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source) at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at t9.htmleditor.MainApp.showMainGUI(MainApp.java:54) at t9.htmleditor.MainApp.start(MainApp.java:24) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(Unknown Source) at com.sun.javafx.application.LauncherImpl$$Lambda$51/1730989841.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$45/1051754451.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$47/50177904.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$46/1775282465.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source) at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: Can not set java.awt.Button field t9.htmleditor.view.ToolContoller.PageTitle to javafx.scene.control.Button at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) at sun.reflect.UnsafeObjectFiel…

http://stackoverflow.com/comment/42006102
type: Comment
type: QuestionComment
has text: A shark is an ocean?
comment on: http://stackoverflow.com/q/26706651
score: 3

http://stackoverflow.com/q/26719260
has title: trouble making background image for a Panel
has comment: http://stackoverflow.com/comment/42029374
has body: I am trying to add a background image to a JPanel. The paint Component doesn't seem to paint the image imported for the background . Could anyone point out why? I have imported all the necessary libraries. public class ImagePanel extends JPanel { public static BufferedImage image; public ImagePanel() { try { image = ImageIO.read(new File("cards/background.png")); System.out.println("Image Import Succesful"); } catch (IOException ex) { System.out.println("IMAGE IMPORT ERROR"); } ImageIcon icon = new ImageIcon(image); icon.setImage(image); JLabel imageLabel = new JLabel(icon); add(imageLabel); } @Override protected void paintComponent(Graphics g) { System.out.println("painted"); super.paintComponent(g); g.drawImage(image, 100, 100, this); } }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42029091
tagged with: jpanel
tagged with: image
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42037333
has comment: http://stackoverflow.com/comment/42078600
has answer: http://stackoverflow.com/a/26744481
answer count: 1
has comment: http://stackoverflow.com/comment/42035064
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/19209650

http://stackoverflow.com/a/26722283
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26721749
accepted answer of: http://stackoverflow.com/q/26721749
has body: Java JDK 1.6 is not installed on your computer. You probably installed Java JDK 1.7 or 1.8 before the Yosemite update. If you don't want to install JRE6 at all and simply use JRE7 or JRE8 without symlinking it to the JRE6 either you can do the following solution as described by Nikolas Grottendieck here.
upvote count: 5
score: 5

http://stackoverflow.com/a/26724099
downvote count: 0
score: 1
upvote count: 1
has body: Iterate over the array from (length-1) to 0. Array [length] is resulting in the IndexOutOfBoundsException. Example code: for (int i = 0; i &lt; len; i++){ txt[i] = input.charAt(i); } for (int j = len-1; j &gt;= 0; j--){ System.out.print(txt[j]); }
type: Answer
answers question: http://stackoverflow.com/q/26724051

http://stackoverflow.com/q/26806596
has title: Extract a sub string from a string using regular expression
type: Question
has comment: http://stackoverflow.com/comment/42186227
has answer: http://stackoverflow.com/a/26806738
has comment: http://stackoverflow.com/comment/42186205
has comment: http://stackoverflow.com/comment/42186294
has comment: http://stackoverflow.com/comment/42186404
has comment: http://stackoverflow.com/comment/42186425
score: 0
has comment: http://stackoverflow.com/comment/42187037
answer count: 1
has comment: http://stackoverflow.com/comment/42186255
accepted answer: http://stackoverflow.com/a/26806738
has comment: http://stackoverflow.com/comment/42186235
has comment: http://stackoverflow.com/comment/42187147
tagged with: regex
type: AnsweredQuestion
has body: Given the following Java codes: String test = "'abc,ab,123',,,'123,aa,abc',,,"; Pattern p = Pattern.compile("('\\w\\S+\')"); Matcher m = p.matcher(test); boolean s = m.matches(); System.out.println(s); I want to extract all the content in '', for example I want 'abc,ab,123' and '123,aa,abc'. Why the outout is: false My regular expression is like: "find a ',followed by a number or a letter, followed by several non-space characters,followed by another '". It should have a match, what's wrong?
tagged with: java

http://stackoverflow.com/a/26752120
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/42087693
has comment: http://stackoverflow.com/comment/42088535
upvote count: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42088460
accepted answer of: http://stackoverflow.com/q/26752058
answers question: http://stackoverflow.com/q/26752058
has comment: http://stackoverflow.com/comment/42087642
has body: Add the directory where log4j.properties is located to your classpath.

http://stackoverflow.com/comment/42127135
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26733028
has text: Can't really tell because I am fairly new to Java Beans and/or JAXB. I am "simply" looking for a way to add code to the JAX-bindings which allows me to listen for changes on some of the nodes (which would allow me to use the JAXB-generated classes as data structures in my program. Otherwise, it would probably just be container for parsing and serializing which I would need to "translate" into a custom data structure in my program, leading to a lot of code duplication and basically render the advantage of `xjc`void).
score: 0

http://stackoverflow.com/comment/52573979
score: 1
has text: I guess you are asking about something similar to Hibernate FilterDef and Filter functionality. Unfortunately I don't know the easy way to use anything similar in spring data jpa. FYI: http://stackoverflow.com/questions/11619174/hibernate-filter-children
type: QuestionComment
comment on: http://stackoverflow.com/q/26684361
type: Comment

http://stackoverflow.com/comment/42007888
has text: @hfontanez **My program is supposed to print all the percentage of a set**. First line. But to be more explicit it take a given number and it gives you all the percentage of the set(It's kinda hard to explain as my native language is not english). I edited my question to be more specific.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26707639
type: Comment

http://stackoverflow.com/comment/41950898
has text: This isn't going to work as OP has defined a and b as long variable.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26675827
type: Comment

http://stackoverflow.com/comment/42008686
score: 0
comment on: http://stackoverflow.com/q/26708166
has text: I think error due to appcompat_v7 have you add appcompat_v7 in your workspace ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42094311
score: 0
has text: @Stefan: not really, it´s simply referenced in the project to allow the use of the types declared in it. Are you telling me that TomCat will need them during runtime to resolve the references to those types?
type: QuestionComment
comment on: http://stackoverflow.com/q/26755460
type: Comment

http://stackoverflow.com/q/26825502
has comment: http://stackoverflow.com/comment/42236299
has comment: http://stackoverflow.com/comment/42236264
has body: I had a Spring MVC project developed in Spring MVC 3.2 and running in Tomcat 7, I just had migrated it to Spring MVC 4.1 and Tomcat 8 to support newer business requirement. As we have some package reorganised such include domain object layer have to change to other package name such from com.longz.ozssc.mac.generated.domain to com.longz.ozssc.mac.generated.domain.nb. After I changed the package, I found my spring form submission not work, as the form object is still link to previous domain object. I tried to update my MVC controller to set the model to newer package object by following code: @RequestMapping("/newFirm") public ModelAndView newFirm(@ModelAttribute("firm") Firm firm, BindingResult result, Model model) throws Exception { ModelAndView mav = new ModelAndView("firm/editFirm.jsp","firm",new com.longz.ozssc.mac.generated.domain.nb.Firm()); mav.addObject("newFlag", true); return mav; } When I tried to retrieve my model class from JSP, <form:form action="${pageContext.request.contextPath}/saveFirm" method="POST" modelAttribute="firm"> <% System.out.println("ModelAttribute = |" + pageContext.findAttribute("firm")+'|'); %> JSP print out as: ModelAttribute = |com.longz.ozssc.mac.generated.domain.Firm[ firmAbn=null ]| Seems when Tomcat 8 server do the JSP compiling is still refer to my previous Model Object, and not refer to my new ModelAndView was defined in my controller. This issue will cause seriously result, as all fields' value (in spring form) will bind to wrong model object (com.longz.ozssc.mac.generated.domain.Firm), and that object is not accessible anymore. Any one has idea about this issue please advise. Appreciate! Edit More details about the model set and POST process in form: Set up and check from JSP. <form:form action="${pageContext.request.contextPath}/saveFirm" method="POST" modelAttribute="firm"> <% System.out.println("ModelAttribute = |" + pageContext.findAttribute("firm")+'|'); %> Submit form by standardised spring-dojo: <input class="savebut…
upvote count: 1
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42234658
has comment: http://stackoverflow.com/comment/42235785
has comment: http://stackoverflow.com/comment/42235701
has comment: http://stackoverflow.com/comment/42236327
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42225357
has comment: http://stackoverflow.com/comment/42234954
has comment: http://stackoverflow.com/comment/42235880
has comment: http://stackoverflow.com/comment/42237724
answer count: 0
downvote count: 0
tagged with: jsp
score: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42236313
tagged with: model
has title: Spring MVC 4.1 ModelAndView constructor not working well
type: Question

http://stackoverflow.com/q/26763985
has answer: http://stackoverflow.com/a/26764122
has answer: http://stackoverflow.com/a/26764105
has comment: http://stackoverflow.com/comment/42110754
linked to: http://stackoverflow.com/q/9237384
has answer: http://stackoverflow.com/a/26764231
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42109170
has answer: http://stackoverflow.com/a/26764178
has comment: http://stackoverflow.com/comment/42108980
has comment: http://stackoverflow.com/comment/42109094
tagged with: java
has answer: http://stackoverflow.com/a/26764113
has title: Concatenating elements of ArrayList while iterating
type: Question
has answer: http://stackoverflow.com/a/26764208
has comment: http://stackoverflow.com/comment/42109032
has answer: http://stackoverflow.com/a/26764707
score: 0
has body: I am interested in concatenating a string to elements of an arraylist while iterating.When I run the below code,I am getting a ConcurrentModificationException.My code is: ArrayList&lt;String&gt; list=new ArrayList&lt;String&gt;(); list.add("000); list.add("00"); list.add("0"); for(String s:list) { if(s.length()==1) { String s2="000" + s; list.add(s2); } if(s.length()==2) { String s2="00" + s; } if(s.length()==3) { String s2="0" + s; } } My question is how to add the concatenated strings back to list without using StringBuilder as when I use a StringBuilder,it is causing other parts of my program to malfunction? So just need some guidance.
answer count: 7
has comment: http://stackoverflow.com/comment/42109519

http://stackoverflow.com/comment/42179566
type: AnswerComment
type: Comment
score: 0
has text: True that! It is getting really complex. I will try using a library . thanks for the example.
comment on: http://stackoverflow.com/a/26779564

http://stackoverflow.com/comment/42218510
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26824827
score: 1
has text: `cursor.getParent();` is probably returning null hence NPE.

http://stackoverflow.com/comment/41994670
has text: @Much better, there ya go
score: 0
comment on: http://stackoverflow.com/a/26700183
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42014077
type: AnswerComment
has text: did you check your pattern?
comment on: http://stackoverflow.com/a/26711164
score: 0
type: Comment

http://stackoverflow.com/a/26736420
upvote count: 1
answers question: http://stackoverflow.com/q/26731670
accepted answer of: http://stackoverflow.com/q/26731670
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/42059018
has body: The Attributes parameter does not contain the child elements of the node, only the attributes assigned to the node (if any). Hence, attributes.getValue("coordinates") is not doing what you expect.

http://stackoverflow.com/a/26781304
upvote count: 2
has comment: http://stackoverflow.com/comment/42180862
accepted answer of: http://stackoverflow.com/q/26781154
has body: Your insertion logic seems strange. If you wish to add a new employee at the end of the array (meaning at the first unoccupied spot in the array), you don't need the second loop. All you need is to check that the Employee is not already in the array (your first loop), and then add the employee at the index position (which would be identical to employCount). public int add(Employee employ) { int index; for (index = 0; index &lt; employCount; index++){ int result = employeeArray[index].getName().compareTo(employ.getName()); if(result == 0){ throw new RuntimeException ("Employee Not New"); } } if (employeeArray.length == employCount){ expand(); } employeeArray[index] = employ; employCount++; return index; } EDIT : You have a much larger problem than what I mentioned above : String line = reader.nextLine(); String Employee[] = new String[7]; You have a line from the file, but do nothing with it. Then you create a String array and start to access its values, even though they are all null. Therefore, method calls such as Employee[0].equals("S") would cause a NullPointerException. What you should do is : String line = reader.nextLine(); String Employee[] = line.split(" "); // assuming " " is the separator // between tokens in each line Now your Employee array (which you should rally call employee, if you don't want to confuse it with the Employee class) would contain the columns of the line and you can access them in the remainder of your loop.
answers question: http://stackoverflow.com/q/26781154
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/41956859
has text: I can't help with the first bit (subscribing to the dispatcher messages), as I don't know how you subscribe to recieve messages in your application/framework. I assume you do though :). But I'll provide a wrapper example, give me a sec.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26678858
type: Comment

http://stackoverflow.com/comment/41979063
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26685340
has text: @bcoughlan It does. I did, same thing. Have you haver persisted a Lookup instance?

http://stackoverflow.com/comment/42107629
has text: In the project properties, I´ve set UTF-8 to the project. I´m using Terminal and iTerm with encoding UTF-8. The font I use is Ubuntu mono, I dont know what would make this kind of errors...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26762897

http://stackoverflow.com/a/26803194
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: [...]the problem is, that I want to have different selectionBackgrounds dependent of the node. [...] I thought there is maybe a more elegant way by using the swingx-renderer. You can certainly use a SwingX renderer (aka: DefaultTreeRenderer) and override getCellRendererComponent(...) in order to set the background color depending on the node as you wish. For example: IconValue iconValue = new IconValue() { @Override public Icon getIcon(Object value) { return UIManager.getIcon("FileView.directoryIcon"); } }; DefaultTreeRenderer treeCellRenderer = new DefaultTreeRenderer(iconValue) { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (selected &amp;&amp; leaf) { c.setBackground(Color.RED); } else { setBackground(tree.getBackground()); } return c; } }; In this snippet if a leaf (not root nor parent) node is selected then the label's background color will be red. Otherwise the label's background color will be the default.
accepted answer of: http://stackoverflow.com/q/26778912
answers question: http://stackoverflow.com/q/26778912
upvote count: 2
has comment: http://stackoverflow.com/comment/42241077

http://stackoverflow.com/comment/42112731
comment on: http://stackoverflow.com/a/26765310
type: Comment
score: 0
type: AnswerComment
has text: You have a right to your opinion, I suppose. There are no other modern 6-bit schemes, however.

http://stackoverflow.com/q/26807867
score: 4
accepted answer: http://stackoverflow.com/a/26810297
downvote count: 0
possible better answer: http://stackoverflow.com/a/62736276
tagged with: spring-security
has answer: http://stackoverflow.com/a/62736276
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has title: Spring Security Role - user can change only own data?
tagged with: java
tagged with: hibernate
has body: I start to use Spring Security. For now I seting that user must login if they wont create table. Or, for example, in the ControllerClass I configured to only user with role ROLE_USER can delete a table. My question is, in which way I can set that, when user login and he create some table and create teamPlayers , that the table or players can only edit or delete user who did create the table and the players. for example , I have in Controller method for delete table ... @RestController @RequestMapping(value="/api/tables") public class ApiTableController { @Autowired TableService tableService; @Autowired TableConverter tableConverter; @PreAuthorize("hasRole('ROLE_USER')") @RequestMapping(value="/{id}", method=RequestMethod.DELETE) public ResponseEntity&lt;TableDTO&gt; deleteTable(@PathVariable Long id) { Table table = tableService.findOne(id); if (table != null) { TableDTO tableDTO = tableConverter.table2TableDTO(table); tableService.remove(id); return new ResponseEntity&lt;&gt;(tableDTO, HttpStatus.OK); } else { return new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND); } } In this case, all users with role ROLE_USER can delete all table , but I wont to can delete table only user how created table ... Is there any rule how it works or standard code? Like a profil on StackOwerflow . Everyone can see what we write ,Everyone can create profil and only I can edit my profil or my quastions which I wrote on the site. How I can do somthing like that with Spring security? this is class User @Entity @Table(name = "users") public class User { @Id @GeneratedValue @NotNull @Column(name = "user_id") private Long id; @Column(name = "username") private String name; @Column(name = "password") private String password; @Column(name = "email") private String email; @Column(name = "country") private String country; @Column(name = "city") private String city; @Column(name = "dateCreated") private Date dateCreated; @Column(name = "enabled") private boolean active; @JoinTable(name = "user_se…
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26810297
answer count: 2

http://stackoverflow.com/comment/42063796
comment on: http://stackoverflow.com/q/26733103
has text: @Springrbua I'm moving object without rotation.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41980104
type: AnswerComment
score: 0
type: Comment
has text: 4. I was trying to call those two in the constructor, I was just guessing because I wasn't sure if I was calling them correctly. Thanks for help on 3. and 5. though I will try those as soon as I get back to my project.
comment on: http://stackoverflow.com/a/26692032

http://stackoverflow.com/comment/41967179
has text: @RolfSmit sry but i cant understand what u need. what information may i provide to you?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26684034

http://stackoverflow.com/q/26703332
answer count: 3
tagged with: regex
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42000240
has title: Extract substring from a long string using starting string and ending string?
upvote count: 1
has answer: http://stackoverflow.com/a/26703987
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42000008
tagged with: java
has answer: http://stackoverflow.com/a/26703928
has comment: http://stackoverflow.com/comment/42000254
has comment: http://stackoverflow.com/comment/42000064
tagged with: substring
type: Question
has answer: http://stackoverflow.com/a/26703422
accepted answer: http://stackoverflow.com/a/26703928
has comment: http://stackoverflow.com/comment/42000034
has comment: http://stackoverflow.com/comment/42000046
downvote count: 0
has comment: http://stackoverflow.com/comment/42000066
tagged with: string
has comment: http://stackoverflow.com/comment/42000038
possible better answer: http://stackoverflow.com/a/26703422
has body: I have this long string (its a one, long, continuous string): Home address H.NO- 12 SECTOR- 12 GAUTAM BUDH NAGAR NOIDA- 121212, UTTAR PRADESH INDIA +911112121212 Last Updated: 12-JUN-12 Semester/Term-time Accommodation Type: Hall of residence (private provider) Semester/Term-time address A121A SOME APPARTMENT SOME LANE CITY COUNTY OX3 7FJ +91 1212121212 Last Updated: 12-SEP-12 Mobile Telephone Number : 01212121212 If you look at the string above, the following pattern can be produced: &lt;home_address_text&gt;&lt;space&gt;&lt;the_address&gt;&lt;space&gt;&lt;last_updated_text&gt;&lt;last_updated_date&gt;&lt;space&gt;&lt;accomodation_t‌​ype_text&gt;&lt;accomodation_type&gt;&lt;space&gt;&lt;semester_time_address_text&gt;&lt;semester_time_address&gt;&lt;space&gt;last_updated_text&gt;&lt;last_updated_date&gt;&lt;space&gt;&lt;mobile_number_text&gt;&lt;mobile_number&gt; I want to extract specific parts of this string, like: 1. H.NO- 12 SECTOR- 12 GAUTAM BUDH NAGAR NOIDA- 121212, UTTAR PRADESH INDIA 2. Hall of residence (private provider) 3. A121A SOME APARTMENT SOMELANE CITY COUNTY OX3 7FJ 4. 01212121212 This information is variable, so it differs from person to person, so I can't just compute the length and use substring to extract it, because the length of the whole string &amp; the part I want to extract is variable. How can I extract specific parts of the string, as explained above, using Java? I've been looking for ways since a long time but couldn't find a way. Any help would be very much appreciated

http://stackoverflow.com/comment/42157559
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26786697
type: Comment
has text: oh, not my intention, just a careless example. thank s for pointing out, it's now corrected.

http://stackoverflow.com/a/26811518
has body: Can I say if the value of b read by T2 is 1, then the value of a read by T2 must be 1? Yes. It's guaranteed. An operation can move into a synchronized block, but not out from it. See Jeremy Mansons blog post Roach Motels and The Java Memory Model. This means that, while read a can move up before unlock, (and up above read b due to instruction reordering) it can never move up above the lock instruction of T2. Same reasoning applies for a = 1: It can move down into the synchronized block (and below b = 1 due to instruction reordering) but not passed the unlock instruction. However, if we swap the instructions like that, they are both covered by the lock, which means that if T2 reads a 1 from b, then T1 will already have written a 1 to b.
downvote count: 0
answers question: http://stackoverflow.com/q/26811382
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/43267870
score: 0
comment on: http://stackoverflow.com/q/26760993
type: Comment
type: QuestionComment
has text: This is has been fixed recently.

http://stackoverflow.com/comment/42143046
type: AnswerComment
comment on: http://stackoverflow.com/a/26782471
type: Comment
has text: Could you explain the difference between the file types? My problem has commonly been since I don't use Maven I'm having problems with Tomcat/Jetty. Not to mention all of the guides show you how to set it up through maven and nothing else.
score: 0

http://stackoverflow.com/a/26798040
has comment: http://stackoverflow.com/comment/42170196
score: 0
answers question: http://stackoverflow.com/q/26798003
type: Answer
has body: Call the setUpMarker() int latest asynctask's onPost method Example when you have 3 async : 1st async run run the 2nd async inside 1st async onPost run the 3rd async inside 2nd async onPost We need to call it in the onPost to make sure the 1st asyncTask is finished before calling other asyncTask, to avoid race condition.
has comment: http://stackoverflow.com/comment/42170243

http://stackoverflow.com/comment/42186379
type: Comment
score: 0
has text: Yes thanks! I used the screen capture to look at the page but all I saw was the empty field. I guess I would have to do find on the element ID to look for duplicates the next time. Thanks again for your help!!!
comment on: http://stackoverflow.com/a/26742321
type: AnswerComment

http://stackoverflow.com/comment/42051799
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26732277
has text: Then will the program be able to check if there is correct closing parenthesis for a particular opening one?
type: Comment

http://stackoverflow.com/a/48596998
type: Answer
downvote count: 0
has body: Remove append="false" from RollingFile.
score: 3
answers question: http://stackoverflow.com/q/26754008
upvote count: 3

http://stackoverflow.com/q/26826365
accepted answer: http://stackoverflow.com/a/26828479
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/42221131
answer count: 2
has comment: http://stackoverflow.com/comment/42221160
has comment: http://stackoverflow.com/comment/42221229
has comment: http://stackoverflow.com/comment/42224601
score: 4
has comment: http://stackoverflow.com/comment/42221181
has comment: http://stackoverflow.com/comment/42224391
has comment: http://stackoverflow.com/comment/42221373
has title: Why setting setPreferredSize() on JFrame is bad?
downvote count: 1
possible better answer: http://stackoverflow.com/a/26826459
has comment: http://stackoverflow.com/comment/42221164
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/42221209
has body: Is setting preferred size of JFrame using setPreferredSize() considered bad? If it is bad, what is good way to change JFrame window size to dimension I need. I know laying components in way to reflect final JFrame dimension that I need. But if I use shortcut to change preferred size using call setPreferredSize() just before call to pack() to change final JFrame size is bad? If so why? For example I have sample form: This is displayed without setting preferred size. Now I can resize form with call to setPreferredSize() before call to pack(). This is displayed with call: setPreferredSize(new Dimension(500, 300)); I can have similar effect with setting components size while laying it out. But what is disadvantage of setting frame size with just call to setPreferredSize(). I can think setting preferred size as resizing displayed window manually with mouse after it has been displayed. Isn't it? Code: import java.awt.Dimension; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class MyFrame extends JFrame { private static final long serialVersionUID = 1L; private JTextField fullNameTextField = new JTextField(); private JTextField emailIDTextField = new JTextField(); private JTextArea addressTextArea = new JTextArea(); private JButton submitButton = new JButton("Submit"); private JButton cancelButton = new JButton("Cancel"); public MyFrame(){ super("MyFrame"); layoutComponents(); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationByPlatform(true); setPreferredSize(new Dimension(500, 300)); pack(); } private void layoutComponents(){ GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); JLabel fullNameLabel = new JLabel("Full Name:"); JLabel emailIDLabel = new JLabel("Email ID:"); JLabel addressLabel = new JLabel("Address:"); JScrollPane add…
tagged with: swing
linked to: http://stackoverflow.com/q/1783793
has comment: http://stackoverflow.com/comment/42221240
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42221141
has comment: http://stackoverflow.com/comment/42220987
tagged with: java
has answer: http://stackoverflow.com/a/26826459
has comment: http://stackoverflow.com/comment/42224085
has comment: http://stackoverflow.com/comment/42221320
has comment: http://stackoverflow.com/comment/42220938
type: Question
has answer: http://stackoverflow.com/a/26828479

http://stackoverflow.com/comment/41967418
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26682013
has text: Since there are not dialogs yet until 8u40, I take that what you call a dialog is just a regular scene. If you have only a list there (no buttons to close the so called dialog?), my guess is when the scene gains the focus, as the only focusable node is the list, its first item gets selected. Adding some OK/Cancel buttons may help since they can gain the focus instead. Maybe you could add a [MCVE](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/comment/49904647
type: QuestionComment
comment on: http://stackoverflow.com/q/26747076
score: 0
has text: @fracz do you have more than one test case?
type: Comment

http://stackoverflow.com/a/26770067
has comment: http://stackoverflow.com/comment/42120611
has comment: http://stackoverflow.com/comment/42120451
has comment: http://stackoverflow.com/comment/42120527
type: Answer
has comment: http://stackoverflow.com/comment/42120576
has body: Your helper-method is missing a final return-statement, which is probably messing up the syntax-check, ending in this strange error-message. private List&lt;K&gt; someMethod(K k, List&lt;K&gt; L, int n) { if (this.k.compareTo(k) == 0) { L.add(this.k); return list; } if (this.k.compareTo(k) &lt; 0) { right.someMethod(k, L, n); //error here L.add(this.k); } if (this.k.compareTo(k) &gt; 0) { left.someMethod(k, L, n); //error here L.add(this.k); } return L; // change here, errors should be gone now }
has comment: http://stackoverflow.com/comment/42120563
upvote count: 1
answers question: http://stackoverflow.com/q/26769969
downvote count: 1
score: 0

http://stackoverflow.com/q/26779962
tagged with: mongo-java
type: UnansweredQuestion
tagged with: aggregation-framework
has comment: http://stackoverflow.com/comment/42142088
has title: MongoDB aggregation $let expression to Java Driver
answer count: 0
has body: I have following $let expression : { "$let": { "vars": { "h": { "$hour": "$Date" } }, "in": { "$cond": { "if": { "$lt": [ "$$h", 6 ] }, "then": "Night", "else": { "$cond": { "if": { "$lt": [ "$$h", 12 ] }, "then": "Morning", "else": { "$cond": { "if": { "$lt": [ "$$h", 18 ] }, "then": "Afternoon", "else": "Evening" } } } } } } } } I am unable to figure out any way to convert this shell operation to Java driver version. I tried MongoDB java driver docs and even Google but unable to find any way for it. Any help on what could be the JAVA implementation for the same. Thank you in advance!!!
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42163801
type: Question
has comment: http://stackoverflow.com/comment/42137656
tagged with: mongodb
has comment: http://stackoverflow.com/comment/42143272
linked to: http://stackoverflow.com/q/26736928
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26764441
tagged with: eclipse
tagged with: playframework
downvote count: 0
has comment: http://stackoverflow.com/comment/48719295
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/48737715
tagged with: typesafe-activator
type: Question
has comment: http://stackoverflow.com/comment/48535465
has title: Typesafe activator(Play with Java) eclipse command can't load Jars in Eclipse IDE
has answer: http://stackoverflow.com/a/27040646
has body: I've been playing around with Play 2.0 since last few weeks. I used "play eclipsify" &amp; imported the project to Eclipse. Everything went perfect. All the jars were loaded into IDE as "Refrenced Libraries" from Repository folder. Now i've installed typesafe activator &amp; using Play 2.3. I again used "activator eclipse" command. But now it doesn't load jars from the project. No refrenced libraries in IDE. It picks up all the jars, but from /root/.ivy2/cache/further_path_for_each_jar. This leads to all the jars missing. Apart from manually giving path of each of those libraries, What's the solution? Sorry if re-post. I didn't find my solution anywhere. Thanks &amp; Regards. :)
tagged with: java
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/32880273
type: UnansweredQuestion

http://stackoverflow.com/q/26791667
tagged with: bufferedwriter
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Sockets,BufferedWriter.flush() not sending the data
downvote count: 0
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/26791874
has body: The following code works ,the server gets the com string and then the connection closes,if I uncomment the bw.flush() and its next line ,The server doesn't get the com string anymore and it just waits on the br.readLine() for a response(which will not get since the server didn't got the com string),if I move the bw.close() and put it in the bw.flush() position the br.readLine() will throw a Socket closed exception. public static void setupClient(String[] args) throws UnknownHostException, IOException{ Socket client = new Socket(InetAddress.getLocalHost().getHostName(), Server.DEFAULT_COMMAND_PORT); BufferedWriter bw =new BufferedWriter(new OutputStreamWriter(client.getOutputStream())); BufferedReader br =new BufferedReader(new InputStreamReader(client.getInputStream())); String com=args[0]+(args.length==2?args[1]:""); bw.write(com); // bw.flush(); // System.out.println("response:"+br.readLine()); bw.close(); client.close(); }
linked to: http://stackoverflow.com/q/19489320
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/19489320
tagged with: serversocket
tagged with: sockets
accepted answer: http://stackoverflow.com/a/26791874
type: AnsweredQuestion

http://stackoverflow.com/comment/42220537
has text: If you know how many entries there'll be on each line, you could make an `int[]` for the sums. Then after you read each row, split it, parse it, and increment each individual sum.
comment on: http://stackoverflow.com/q/26826151
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42224755
comment on: http://stackoverflow.com/a/26828538
type: AnswerComment
type: Comment
has text: Thanks so much, the first response you had made sense to me, but I couldn't quite figure out how to correctly create the graphics image, like you showed in the code above, Works perfectly now!
score: 0

http://stackoverflow.com/comment/42131158
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26776312
has text: you want to do `br.flush()` before closing it? Also, your code is slightly incomplete for us to understand what happened before finally block (i.e. try/catch bits).

http://stackoverflow.com/comment/42132118
has text: Are these logs from application or from tests? If from tests, are you running them from surefire/failsafe? I had exactly the same problem because of parallel execution tests in application, changing surefire/failsafe configuration helped.
comment on: http://stackoverflow.com/q/26676331
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42117498
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26768150
type: AnswerComment
has text: ok thank you. I'll follow your tips and trying to get it more efficient

http://stackoverflow.com/comment/41952612
score: 0
type: QuestionComment
type: Comment
has text: Also, neither on the JCache API nor on its EHcache implementation (i.e. `JCacheManager`) there is a method called `getEhCache()` !!
comment on: http://stackoverflow.com/q/26673958

http://stackoverflow.com/comment/42185839
type: Comment
comment on: http://stackoverflow.com/q/26805760
score: 0
has text: You might have more success with reflection if you follow normal coding rules for methods. Try renaming your methods with lowercase letters as first letter eg getBookWithTitle instead of GetBookWithTitle.
type: QuestionComment

http://stackoverflow.com/comment/41992990
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/26699543
has text: How about showing us your code? My bet is that, as in 99.999% of the cases, the problem is in your code, and not in the standard library that millions of people use every day.
type: Comment

http://stackoverflow.com/comment/41999734
has text: That's due to getView, which get call multi time other item background changes. You need to make custom adapter and you can change background color from getView. Even though you have to store background color and set accordingly in list with respect to position.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26703135

http://stackoverflow.com/a/26785820
has comment: http://stackoverflow.com/comment/42180788
has body: Try the next: private void JFileChooserOpen(java.awt.event.ActionEvent evt) { fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Select a directory"); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setAcceptAllFileFilterUsed(false); boolean valid = false; do { fileChooser.setCurrentDirectory(new java.io.File(".")); if (fileChooser.showOpenDialog(fileChooser) == JFileChooser.APPROVE_OPTION) { valid = checkTheDir(fileChooser.getSelectedFile()); if (valid) { thePath.setText(fileChooser.getSelectedFile().toString()); } else { JOptionPane.showMessageDialog(null, "File GuiRap not found!", "Controlla meglio", JOptionPane.WARNING_MESSAGE); } } else { rbnParams.setSelected(true); valid = true; } } while(!valid); }
score: 0
answers question: http://stackoverflow.com/q/26785614
type: Answer
has comment: http://stackoverflow.com/comment/42181803

http://stackoverflow.com/q/26740970
has comment: http://stackoverflow.com/comment/42068341
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42068455
upvote count: 0
has body: Im trying to automate a login using java, and have used this example: http://www.mkyong.com/java/how-to-automate-login-a-website-java-example/ to help me do it with another website. The code is below, and so is the output. My question is, what does the error mean, and how do I fix it? public class testing { private List&lt;String&gt; cookies; private HttpsURLConnection conn; private final String USER_AGENT = "Mozilla/5.0"; public static void main(String[] args) throws Exception { String url = "https://www.studentinvestor.org/secure/login.php?dest=http://www.studentinvestor.org/stock-list.php"; String companies = "http://www.studentinvestor.org/stock-list.php"; testing http = new testing(); // make sure cookies is turn on CookieHandler.setDefault(new CookieManager()); // 1. Send a "GET" request, so that you can extract the form's data. String page = http.GetPageContent(url); String postParams = http.getFormParams(page, "username", ",password"); // 2. Construct above post's content and then send a POST request for // authentication http.sendPost(url, postParams); // 3. success then go to gmail. String result = http.GetPageContent(companies); System.out.println(result); } private void sendPost(String url, String postParams) throws Exception { URL obj = new URL(url); conn = (HttpsURLConnection) obj.openConnection(); // Acts like a browser conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Host", "www.studentinvestor.org"); conn.setRequestProperty("User-Agent", USER_AGENT); conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); conn.setRequestProperty("Accept-Language", "en-GB,en-US;q=0.8,en;q=0.6"); for (String cookie : this.cookies) { conn.addRequestProperty("Cookie", cookie.split(";", 1)[0]); } conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Content-Type", "text/html"); conn.setDoOutput(true); conn.setDoInput(true); // Send post request DataOutputStream wr = new…
score: -1
has comment: http://stackoverflow.com/comment/42067938
has answer: http://stackoverflow.com/a/26741784
has comment: http://stackoverflow.com/comment/42067957
has comment: http://stackoverflow.com/comment/42068387
has comment: http://stackoverflow.com/comment/42068696
has comment: http://stackoverflow.com/comment/42068119
favorite count: 0
has comment: http://stackoverflow.com/comment/42068244
has comment: http://stackoverflow.com/comment/42068087
tagged with: apache-httpclient-4.x
linked to: http://stackoverflow.com/q/3038026
has comment: http://stackoverflow.com/comment/42068331
has comment: http://stackoverflow.com/comment/42067886
type: UnansweredQuestion
has title: Java Login 'Exception Error'- what does it mean?
has comment: http://stackoverflow.com/comment/42068275
has comment: http://stackoverflow.com/comment/42067891
has comment: http://stackoverflow.com/comment/42068168
has comment: http://stackoverflow.com/comment/42067963
has comment: http://stackoverflow.com/comment/42067980
has comment: http://stackoverflow.com/comment/42068810
has comment: http://stackoverflow.com/comment/42067993
has comment: http://stackoverflow.com/comment/42068623
has answer: http://stackoverflow.com/a/26741738
tagged with: java
has comment: http://stackoverflow.com/comment/42068137
has comment: http://stackoverflow.com/comment/42068285
downvote count: 1

http://stackoverflow.com/comment/42057215
has text: @rafalopez79 Okay, thanks for that :D I made it so that I only use ObjectStreams for everything, but it didn't fix the problem though..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26722387
score: 0

http://stackoverflow.com/comment/42222628
type: QuestionComment
comment on: http://stackoverflow.com/q/26819978
score: 0
type: Comment
has text: Well I can give you the way how to do it! You just need to make as much inputs as you want and put those in an array in Java . then you can do the for loop on Java code which uploads the file....

http://stackoverflow.com/a/26724740
has comment: http://stackoverflow.com/comment/42050465
has comment: http://stackoverflow.com/comment/42049360
accepted answer of: http://stackoverflow.com/q/26724576
answers question: http://stackoverflow.com/q/26724576
has body: You Can Try This: public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Testing Scanner, write something: "); String testi = scan.nextLine(); char[] ascii1 = testi.toCharArray(); for(char ch:ascii1){ System.out.println((int)ch+" "); } System.out.println("Testing Scanner, write something: "); String testi2 = scan.nextLine(); char[] ascii2 = testi2.toCharArray(); for(char ch:ascii2){ System.out.println((int)ch+" "); } scan.close(); }
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/43010377
type: QuestionComment
comment on: http://stackoverflow.com/q/26781406
score: 0
has text: As there is no working code (without setting up a small test our selfes) to reproduce your problem. Here is a guess: This `int packetSize = packetSizeReadBuffer.getInt();` might be a problem when at this place `bytesRead = channel.read(packetSizeReadBuffer);` you read less then four bytes.
type: Comment

http://stackoverflow.com/q/26732116
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/26732638
tagged with: controller
score: 0
accepted answer: http://stackoverflow.com/a/26732638
answer count: 1
tagged with: fxml
has body: I'm creating my first JavaFX application, and I'm doing OK so far. I'm just encountering one problem. For displaying and loading FXML files I'm using a VistaNavigator class found on StackOverflow: public static void loadVista(String fxml) { try { mainController.setVista( FXMLLoader.load( VistaNavigator.class.getResource( fxml ) ) ); } catch (IOException e) { e.printStackTrace(); } } I have a ScanController, which receives input from the keyboard and checks a ticket ID based on this input. When the ticket is OK, it loads "scan-success.fxml", otherwise it loads "scan-failure.xml", each of these FXML-files have an own controller. I'm loading the success FXML like this: VistaNavigator.loadVista(VistaNavigator.VISTA_SCAN_SUCCESS); This is working great. The Success-FXML page is showing and the ScanSuccessController is loading. In the initialize() method of ScanSuccessController.java I have the following code snippet: try { Thread.sleep(2000); //1000 milliseconds is one second. VistaNavigator.loadVista(VistaNavigator.VISTA_SCAN_HOME); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } So I would like to show the success-page for about 2 seconds, and then head back to the home screen (scan-home.fxml with controller ScanHomeController.java) to scan some more tickets. However, when executing this code, just 'nothing' happens, no exception and no change of FXML-file. When I try to load a new vista after clicking a button (in an EventHandler) it works great. I can imagine that JavaFX is not able to load a new FXML-file before the controller has been fully initialised, but cannot figure out where to put this line of code.. I hope someone can help me out with this.
type: AnsweredQuestion
has title: Load FXML in initialize()

http://stackoverflow.com/comment/42097429
type: Comment
comment on: http://stackoverflow.com/a/26757741
score: 0
type: AnswerComment
has text: `execute` method can have more than one parameter, as many as you need. Dots `...` in function declaration represents that. So when function is called you receive `params` array and you are accessing them as any other `array` in Java.

http://stackoverflow.com/comment/42145776
comment on: http://stackoverflow.com/q/26784291
score: 1
has text: duplicate of this: http://stackoverflow.com/questions/4922145/non-static-method-cannot-be-referenced-from-a-static-context-error In the future, google your error messages first. This is one of the most common ones you'll ever find.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26796066
has comment: http://stackoverflow.com/comment/42166362
tagged with: c++
has comment: http://stackoverflow.com/comment/42166428
upvote count: 2
downvote count: 8
has title: print the string by removing the PRIME ASCII CHARACTERS
has comment: http://stackoverflow.com/comment/42167061
has comment: http://stackoverflow.com/comment/42166562
tagged with: c#
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26796172
has comment: http://stackoverflow.com/comment/42166297
has comment: http://stackoverflow.com/comment/42166318
has comment: http://stackoverflow.com/comment/42166631
tagged with: java
has answer: http://stackoverflow.com/a/26796172
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/42166333
type: Question
answer count: 2
has body: I don't understand this question pls help, How to show prime ascii character, I've one question in java that I've to show prime ascii charater, Now how to get prime ascii character? can you please help me regarding this question. How is it possible? For e.g, let's understand this: Input 4 MEHTA Mehta HELLO hello Output MEHTA Mht HELL hllo I don;t understand here in this example why e is removed from mehta? Please tell me what's happening here? EDITED Why from MEHTA E and A is not removed??
has answer: http://stackoverflow.com/a/26796256
favorite count: 0
accepted answer: http://stackoverflow.com/a/26796256
score: -6

http://stackoverflow.com/q/26790102
type: AnsweredQuestion
tagged with: android-fragments
has title: NullPointerException when switching between fragments containing RecyclerView
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/28889536
answer count: 1
upvote count: 6
favorite count: 0
tagged with: android-support-library
has answer: http://stackoverflow.com/a/28889536
has body: I'm having a real hard time trying to figure this out. I'm getting a NullPointerException when switching between Fragments with RecyclerView but only in certain order. Code and Exception is below. First an explanation: I have a fragment with this tabbed layout as seen here: 3 of these tabs use the same Fragment containing a RecyclerView: Schedule, History and Test. Any of them will work if I select them first. Now the problem is when I go to one of the other aforementioned tabs to the right of the first one I selected! If I go to the left of the first one I selected, though, that will load just fine. If I select Test then go to History and then to Schedule everything will work fine If I select Test then Schedule those two will work, but then going to History will cause the exception. If I select Schedule then History the exception will happen. If I select History then Schedule those two will work, but then going to Test the exception will happen If I select History then Test the exception will happen I extended the RecycleView and put a break in the onMeasure to see if I could figure out what was going on and I noticed that the mAdapter of the RecyclerView was null. I checked inside the setAdapter() of the RecyclerView and it was always passed a valid adapter. So it seems like the mAdapter is getting cleared at some point. I just can't figure out why it only happens when I open the tabs going from left to right and not right to left... Any help would be appreciated as I am reaching my wits end with this one! Here is the NullPointerException: Link to Exception trace (Had to put it here to avoid character limit) EDIT: After catching the NullPointerException an IllegalStateException pops up too. Looks to be from the LayoutManager. Here is a link to that output Here is the Fragment for tabbed view: public class FKitViewer extends Fragment implements OnTabChangeListener { public static final String TAB_INFO = "Info"; public static final String TAB_SCHEDULE = "Schedule"; …
tagged with: android
has comment: http://stackoverflow.com/comment/42156406
downvote count: 0
has comment: http://stackoverflow.com/comment/42156629
score: 6

http://stackoverflow.com/q/26798368
has title: Java NIO: OP_CONNECT never triggered in client, even though connection is accepted by the server
has answer: http://stackoverflow.com/a/70934579
score: 1
upvote count: 1
type: AnsweredQuestion
tagged with: network-programming
has answer: http://stackoverflow.com/a/26815374
tagged with: java
tagged with: nio
type: Question
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26815374
has body: I am learning Java NIO and trying to write a simple client/server application using selectors. So far I've got a PwpConnectionManager class that acts as both a server listening for incoming connections and also as a client making connections to remote peers. The remote peers to connect to are added through connectTo() method. While detecting and accepting incoming connections seems to work, I am unable to trigger OP_CONNECT events when trying to connect to remote peers. I would expect a selection key and selectedKey.isConnectable() to be true after a successfull remote connection has been made. This never happens. In order to illustrate the problem, I wrote a fairly simple test in the main() method. It starts two instances of PwpConnectionManager, one acting as a server and the other as a client. The client tries to connect to the server and the connection is successfully established at the server side (OP_ACCEPT triggered). However, I expect the OP_CONNECT to be triggered in the client but it never does. I've read that using localhost as the address to connect to can lead to an instant connection success resulting in channel.connect() returning true and thus never triggering a OP_CONNECT afterwards. However, as you can see in the log output below, isConnected() in processPendingConnections() returns false, so I am expecting OP_CONNECT to eventually be selected by the selector. Here is the output log after a run of main() (I've run it multiple times with same results): CLIENT: Waiting for selection events... SERVER: Waiting for selection events... CLIENT: Connected to remote peer? false CLIENT: Waiting for selection events... SERVER: Accepted remote connection SERVER: Waiting for selection events... Main thread done! CLIENT: A shutdown request was issued, trying to shutdown... SERVER: A shutdown request was issued, trying to shutdown... CLIENT: Connection manager was shutdown! SERVER: Connection manager was shutdown! Here are my questions: Why is OP_CONNECT never tr…
possible better answer: http://stackoverflow.com/a/70934579

http://stackoverflow.com/q/26694426
has comment: http://stackoverflow.com/comment/41986228
tagged with: swing
tagged with: mouselistener
tagged with: java
has comment: http://stackoverflow.com/comment/41986146
type: Question
has comment: http://stackoverflow.com/comment/41985531
tagged with: jpanel
score: -1
has title: Keeping track of strings drawn on JPanel using Paint in Swing
has body: So, I have this simple program that paints a string on JPanel using g2.drawString("Hello world", 40, 120). Basically, I want to be able to keep track of many strings on the JPanel at once. I'm not sure how to do this. For example, I would want to have an ArrayList of objects that keep track of these strings. I want to be able to click-and-drag these strings so I will need to know there locations, etc. Right now, using g2.drawString, it only draws the string. I want something like gw.draw(myStringObject). Not sure if this is a dumb request but this is what I am looking for. Thanks! import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JFrame; import javax.swing.JPanel; public class DrawSimpleText extends JPanel { public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font font = new Font("Serif", Font.PLAIN, 96); g2.setFont(font); g2.drawString("Hello world", 40, 120); } public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new DrawSimpleText()); f.setSize(300, 200); f.setVisible(true); } }
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41986093
favorite count: 0
has answer: http://stackoverflow.com/a/26694749
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41986269
has comment: http://stackoverflow.com/comment/41986106

http://stackoverflow.com/a/26731184
has comment: http://stackoverflow.com/comment/42050458
has comment: http://stackoverflow.com/comment/42050402
has comment: http://stackoverflow.com/comment/42053284
has comment: http://stackoverflow.com/comment/42051453
accepted answer of: http://stackoverflow.com/q/26731091
has comment: http://stackoverflow.com/comment/42087538
has comment: http://stackoverflow.com/comment/42073192
answers question: http://stackoverflow.com/q/26731091
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42049863
has comment: http://stackoverflow.com/comment/42051534
has comment: http://stackoverflow.com/comment/42052964
has comment: http://stackoverflow.com/comment/42051575
has comment: http://stackoverflow.com/comment/42053151
has body: You add MouseListeners but you do not remove them. Every time you choose something in the combobox, a new listener is added. So when you draw something every listener is applied and weird stuff will happen. You should remove the previous MouseListener before adding a new one. You might have to remember it in an instance variable. Alternatively, you can add all listeners at the start, but check the value of the combobox inside the listener. If the value does not correspond to what the listener is for, it should do nothing. EDIT: Here is how you can remove all listeners for (MouseListener listener : this.getMouseListeners()) { this.removeMouseListener(listener); } for (MouseMotionListener listener : this.getMouseMotionListeners()) { this.removeMouseMotionListener(listener); } Put this code in before you add the new listeners in the actionPerformed() method
type: Answer
has comment: http://stackoverflow.com/comment/42052510
score: 2
has comment: http://stackoverflow.com/comment/42052660
upvote count: 2

http://stackoverflow.com/q/26720572
type: UnansweredQuestion
has title: Application server role-based access controll
tagged with: java
has answer: http://stackoverflow.com/a/26722435
type: Question
answer count: 1
tagged with: websphere-8
score: 0
has body: I'm working on implementing a role-based authorization service under WS Liberty. There are two main goals: if the user without the correct user group tries to open a restricted url, show an error page the user should see a menu, listing all pages available for him My question is: are there best practices to implement this behaviour? Should I create the first part in server.xml AND the second part in the appropriate view? (this way the "logic" will be stored in two different parts of the code, and for example if I have to add a new URL, I have to insert it into two different places) So is there a way to store this role-URL mapping in one place? Thanks, krisy
tagged with: application-server

http://stackoverflow.com/comment/42076215
comment on: http://stackoverflow.com/a/26737886
score: 0
type: AnswerComment
has text: Yeah,I noticed that too, and corrected myself. But hey! Thanks!
type: Comment

http://stackoverflow.com/comment/42084873
score: 0
has text: I have to use the ciruclar linked list because that's what I'm studying right now
type: Comment
comment on: http://stackoverflow.com/q/26750427
type: QuestionComment

http://stackoverflow.com/comment/42120574
comment on: http://stackoverflow.com/q/26769419
has text: I believe your application nothing know about xxx.xxxxx.local, try to use ip address or add ip address-hostname pair to hosts file (WINDOWS)
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/42038086
type: Comment
has text: Or is there a way to iterate over every JsonElement like a tree?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26724050

http://stackoverflow.com/comment/42167141
type: QuestionComment
has text: call the singleton from your `doget` if it is created it will not get created again.
comment on: http://stackoverflow.com/q/26796457
score: 0
type: Comment

http://stackoverflow.com/comment/42217658
comment on: http://stackoverflow.com/a/26824330
has text: You don't even have to manually convert. I can't imagine any such `int`-based code that would require any changes to work with `Integer` instead.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42132540
score: 0
type: AnswerComment
type: Comment
has text: @mykola Well it seems that the only way you can do it is to analyze the code. If you want to do it in one step and not in runtime then above approach might be workable. If you want to do it in runtime, then you might want to look in to [aspectj](http://www.eclipse.org/aspectj/) and intercept method call to methods annotated with the above annotations, onece you have them you can proceed just like in approach above too.
comment on: http://stackoverflow.com/a/26754663

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/26807395
tags question: http://stackoverflow.com/q/26790324
tags question: http://stackoverflow.com/q/26689006
tags question: http://stackoverflow.com/q/26769406
tags question: http://stackoverflow.com/q/26689896
tags question: http://stackoverflow.com/q/26826394

http://stackoverflow.com/q/26729035
tagged with: android
type: UnansweredQuestion
tagged with: checkbox
has comment: http://stackoverflow.com/comment/42046204
tagged with: object
tagged with: java
has body: Lets say you have an object like this and you want to have the program go through each dynamically created Checkbox to see if it has not been checked. If has not been checked, then the program should create a notification alerting the user that one or more of these objects has not been checked. What is the best way to have the program identify whether the checkbox is checked or not? Each time I run the program, it only applies to the last created Checkbox regardless of how many checked or unchecked checkboxes proceed it. Thank you for your time. View ObjectView; CheckBox check; //A whole bunch of code here. public void onClick(View arg0) { if (check==null){ } else if (check==null || check.isChecked()){ } else { ObjectView.getId(); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getActivity()) .setSmallIcon(android.R.drawable.stat_notify_more) .setContentTitle("Items missing") .setContentText("One or more items are missing"); int ID_Notify = 01; getActivity(); NotificationManager managenote = (NotificationManager)getActivity().getSystemService(Context.NOTIFICATION_SERVICE); managenote.notify(ID_Notify, mBuilder.build());
has comment: http://stackoverflow.com/comment/42046193
has title: How do you iterate through dynamically created objects?
has answer: http://stackoverflow.com/a/26729137
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42046238
score: 0

http://stackoverflow.com/comment/42137365
type: AnswerComment
comment on: http://stackoverflow.com/a/26722488
type: Comment
score: 1
has text: @David: I respectfully disagree. I think OP learned something about arrays here, which should be helpful in the future.

http://stackoverflow.com/comment/42192355
comment on: http://stackoverflow.com/q/26809876
has text: And you what do you think?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42164134
type: Comment
comment on: http://stackoverflow.com/q/26793828
has text: Check your condition. A number is prime if it is divisible by only itself and one. change (j%i >= 0) to (j%i == 0)
score: 0
type: QuestionComment

http://stackoverflow.com/a/27160611
upvote count: 1
has body: Okay, So for some reason Java 1.7 and 1.8 don't want to play nice no matter how much encouragement I gave it. What I had to do is download Java 1.6 and use that. The thing with this though you can't get this from the Java Download site. Instead, you have to get it from Apple. You can get this here http://support.apple.com/kb/DL1572 This is the same version of Java which was included in OSX 2013-005. Once you have downloaded this you will now have multiple versions of Java. The Java 1.6 version from Apple doesn't get placed in the same spot as the ones from Oracle. The Apple one get's placed in the System Library. This means you have to change the JAVA_HOME var to this system one. Once I did that it was done. So this is how I set my path: export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home export PATH=$PATH:$JAVA_HOME export PATH=$PATH:$JAVA_HOME/bin I have no idea why I couldn't get Java 1.7 and 1.8 working, but this is the only thing which fixed it for me.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26801562

http://stackoverflow.com/a/26766333
has body: Change your statement to if(timeSlot[i] &lt; 1 || timeSlot[i] &gt; 6).
has comment: http://stackoverflow.com/comment/42113465
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26766265
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42067980
score: 0
type: Comment
type: QuestionComment
has text: Okay, so why is there an error in changing its type?
comment on: http://stackoverflow.com/q/26740970

http://stackoverflow.com/q/26769641
type: AnsweredQuestion
has title: Error instantiating servlet class
tagged with: java
has answer: http://stackoverflow.com/a/26769897
accepted answer: http://stackoverflow.com/a/26769897
tagged with: servlets
has body: This is my index.html This is my web.xml ` submitForm student.StudentSurveyFormSubmit submitForm /submitForm ` And my servlet class package student; @WebServlet("/StudentSurveyFormSubmit") public class StudentSurveyFormSubmit extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(" " + "Hi, "+request.getParameter("firstName") +" I am here" + " "); }} Whenever I deploy my war file and click sumbot button I get an exception as : The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Error instantiating servlet class student.StudentSurveyFormSubmit org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) java.lang.Thread.run(Unknown Source) Where am I going wrong?
type: Question
answer count: 1
score: 0
tagged with: web.xml
has comment: http://stackoverflow.com/comment/42119740

http://stackoverflow.com/comment/42204699
type: QuestionComment
comment on: http://stackoverflow.com/q/26816734
type: Comment
has text: What are you using to "print" the response? Please share the code you are using to find and print the result.
score: 0

http://stackoverflow.com/comment/42075843
comment on: http://stackoverflow.com/a/26744748
has text: Yes, but since you've not provided any code that shows that it's difficult to know what to suggest or even what the problem is. See the second paragraph for what you will need to do to ensure you don't violate the single thread rules of Swing
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/93762284
comment on: http://stackoverflow.com/a/42447211
score: 0
type: AnswerComment
type: Comment
has text: @Ekaterina, that's the pointer of working with `Optional`s, if the `getter`s return `Optional`s, then now `NullPointerException` will be thrown.

http://stackoverflow.com/a/26881799
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42319489
answers question: http://stackoverflow.com/q/26687211
has comment: http://stackoverflow.com/comment/42321298
upvote count: 1
has body: as you know when connecting to the Wifi the sifi manager app displays a hint message under the Wifi name that is connecting, like connecting, authenticating, obtaining IP ... etc so i tried to search how can detect those stages of connecting to a Wifi network i came to an answer showing how is this done, it was done using the a receiver to SUPPLICANT_STATE_CHANGED_ACTION and i tried to implement it adding the code to just disconnect ... and that was success as the Wifi never got connected, the icon did not appear on the notification bar and the logs keep repeating the steps, though some how it say's connected (at logs) but nothing actually appears on the device itself, so maybe it got connected for like (10 MS) anyhow , below is the code i used: public class MyNetworkMonitor extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // EXTRA_BSSID // SUPPLICANT_STATE_CHANGED_ACTION // EXTRA_NEW_STATE // Log.i("YAZAN", intent.getAction() + " " + // intent.getStringExtra(WifiManager.EXTRA_BSSID)); // Log.i("YAZAN", intent.getAction() + " " // +intent.getStringExtra(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)); // Log.i("YAZAN", intent.getAction() + " " // +intent.getStringExtra(WifiManager.EXTRA_NEW_STATE)); //Log.i("YAZAN", intent.getAction() + " " + intent.getStringExtra(WifiManager.EXTRA_BSSID)); String action = intent.getAction(); if(action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)){ WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Log.d("YAZAN", "&gt;&gt;&gt;&gt;SUPPLICANT_STATE_CHANGED_ACTION&lt;&lt;&lt;&lt;&lt;&lt;"); SupplicantState supl_state=((SupplicantState)intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE)); switch(supl_state){ case ASSOCIATED:Log.i("YAZAN", "ASSOCIATED"); break; case ASSOCIATING: Log.i("YAZAN", "ASSOCIATING"); wifi.disconnect(); Log.i("YAZAN", "disconnect()"); break; case AUTHENTICATING:Log.i("YAZAN", "Authenticating..."); wifi.disconnect(); Log.i("YAZAN", …

http://stackoverflow.com/comment/42084089
type: Comment
type: QuestionComment
has text: one possibilities is to parse that char into the integer and try to compare.
comment on: http://stackoverflow.com/q/26749777
score: 0

http://stackoverflow.com/a/38947571
has comment: http://stackoverflow.com/comment/97414203
has comment: http://stackoverflow.com/comment/118714333
has body: The accepted answer is wrong. If you look at the implementation of String.equalsIgnoreCase() you will discover that you need to compare both lowercase and uppercase versions of the Strings before you can conclusively return false. Here is my own version, based on http://www.java2s.com/Code/Java/Data-Type/CaseinsensitivecheckifaStringstartswithaspecifiedprefix.htm: /** * String helper functions. * * @author Gili Tzabari */ public final class Strings { /** * @param str a String * @param prefix a prefix * @return true if {@code start} starts with {@code prefix}, disregarding case sensitivity */ public static boolean startsWithIgnoreCase(String str, String prefix) { return str.regionMatches(true, 0, prefix, 0, prefix.length()); } public static boolean endsWithIgnoreCase(String str, String suffix) { int suffixLength = suffix.length(); return str.regionMatches(true, str.length() - suffixLength, suffix, 0, suffixLength); } /** * Prevent construction. */ private Strings() { } }
score: 53
has comment: http://stackoverflow.com/comment/118735314
has comment: http://stackoverflow.com/comment/131758830
upvote count: 55
has comment: http://stackoverflow.com/comment/118687095
has comment: http://stackoverflow.com/comment/118751892
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/118764048
has comment: http://stackoverflow.com/comment/93919988
answers question: http://stackoverflow.com/q/26794275
has comment: http://stackoverflow.com/comment/65250586
has comment: http://stackoverflow.com/comment/65251105
has comment: http://stackoverflow.com/comment/77679807

http://stackoverflow.com/a/26796074
type: Answer
has comment: http://stackoverflow.com/comment/42215747
accepted answer of: http://stackoverflow.com/q/26795727
has body: As mentioned in Firebase API docs, the Firebase should be initialized before any Firebase reference is created or used. You should use setAndroidContext method in Application's onCreate() method. So you should create your own application class like this: public class FirebaseApplication extends android.app.Application { @Override public void onCreate() { super.onCreate(); Firebase.setAndroidContext(this); } } Then add it as name of your application tag in AndroidManifest: &lt;application android:name="your.package.name.FirebaseApplication" //android:icon, android:label, android:theme, etc. ... &gt; ... &lt;/application&gt; And then you can use Firebase in your activities: protected Firebase ref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String firebaseUrl = getResources().getString(R.string.firebase_url); ref = new Firebase(firebaseUrl); } EDIT: So I don't know what's your problem, cause I was able to successfully build the project with Firebase, as in example. But I found one thing, that may be helpful for you. Try to add next lines to the proguard-rules.pro: # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
has comment: http://stackoverflow.com/comment/42221122
upvote count: 5
has comment: http://stackoverflow.com/comment/42190589
answers question: http://stackoverflow.com/q/26795727
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42189495
has comment: http://stackoverflow.com/comment/42190702
has comment: http://stackoverflow.com/comment/42193081
has comment: http://stackoverflow.com/comment/42199615

http://stackoverflow.com/comment/42150362
type: Comment
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/26786806
has text: This is _not_ okay, though. It breaks the contract of `equals`, which includes symmetry (`a.equals(b) == b.equals(a)`). There's no way you can get `Integer.equals` to agree with your definition, so your definition will be broken.

http://stackoverflow.com/comment/42204417
has text: Though in this case I can relax the requirement of `MinMaxVerifyer` being fixed if adding method generic parameters will solve something.
type: QuestionComment
comment on: http://stackoverflow.com/q/26816402
score: 0
type: Comment

http://stackoverflow.com/comment/42091972
has text: when i'm comparing string, it should be comparing from all multiple list, not the specific one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26754532
type: Comment

http://stackoverflow.com/comment/41946876
score: 0
type: QuestionComment
type: Comment
has text: `I need a main class. The rest of the code should stay the same.` Sorry but no. You should develop the GUI using whatever framework you wish. If you have properly designed your program, you will be able to reuse your data model and business logic, but the GUI will need to be redone.
comment on: http://stackoverflow.com/q/26673072

task
type: Tag
tags question: http://stackoverflow.com/q/26804982
tag name: task
tags question: http://stackoverflow.com/q/26673704

http://stackoverflow.com/comment/42040750
type: Comment
comment on: http://stackoverflow.com/a/26725815
score: 0
type: AnswerComment
has text: it's something strange: $Proxy1

http://stackoverflow.com/comment/42127058
type: Comment
has text: Thank you. That was the first part of the solution. Second part we "casted" the configured queue in web.xml to com.ibm.mq.jms.MQQueue. We changed it java.jms.Queue and now it runs.
comment on: http://stackoverflow.com/a/26758273
score: 0
type: AnswerComment

http://stackoverflow.com/q/26718468
tagged with: serialization
has answer: http://stackoverflow.com/a/26718666
type: UnansweredQuestion
has title: Method isCellEditable and @SuppressWarnings("serial")
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26718680
linked to: http://stackoverflow.com/q/5576047
tagged with: suppress-warnings
has body: Why if i use this code inside a method: DefaultTableModel model = new DefaultTableModel(null, vett){ public boolean isCellEditable(int row, int col) { return false; } }; I get a warning and i have to use "@SuppressWarnings("serial")" before the beginning of the method?
tagged with: jtable
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26718576
favorite count: 0

http://stackoverflow.com/q/26736595
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/42059545
has answer: http://stackoverflow.com/a/26736792
favorite count: 0
has answer: http://stackoverflow.com/a/26736881
linked to: http://stackoverflow.com/q/1320476
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I have a project who's structure cannot be changed. What i have to do is that I have a main jar file that have directores /classes /lib /main /manifest I have to call a Test1 class when i execute the main jar file. so in the manifest file i gave the path of the Main-Class : path.to.file. I have another jar file inside the main folder that contains the actual application. What can i do to execute the jar in main folder and execute its Test2 class mentioned in the Manifest file. Please give me a solution or any direction to work on. Any help appreciated.
tagged with: java
has title: How to execute a jar file within a jar file
has comment: http://stackoverflow.com/comment/42059776
type: Question
possible better answer: http://stackoverflow.com/a/26736881
accepted answer: http://stackoverflow.com/a/26736792
answer count: 2

http://stackoverflow.com/q/26792004
downvote count: 1
has comment: http://stackoverflow.com/comment/42159800
has comment: http://stackoverflow.com/comment/42159811
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42159574
has comment: http://stackoverflow.com/comment/42159823
has comment: http://stackoverflow.com/comment/42160017
tagged with: java
has comment: http://stackoverflow.com/comment/42159910
has comment: http://stackoverflow.com/comment/42159792
type: Question
has comment: http://stackoverflow.com/comment/42159721
score: 0
accepted answer: http://stackoverflow.com/a/26792265
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42159953
tagged with: batch-file
has comment: http://stackoverflow.com/comment/42160008
has comment: http://stackoverflow.com/comment/42159763
has comment: http://stackoverflow.com/comment/42159630
has comment: http://stackoverflow.com/comment/42160356
has body: I want to programmatically run a .exe program if it is not running yet. For the moment i use a process builder to launch a .bat from java. The batch file runs the .exe after checking if it is running. The problem is that java won't move on until the user closes the .exe program. How can I solve this? Java code : try { ProcessBuilder builder = new ProcessBuilder("open.bat"); final Process process = builder.start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); while ((br.readLine()) != null) { } System.out.println("command line terminated"); } catch (Exception err) { err.printStackTrace(); System.out.println("error "); } Batch code : (open.bat) tasklist | find "illustrator.exe" if errorlevel 1 start "" "C:\Program Files (x86)\Adobe\Adobe Illustrator CS6\Support Files\Contents\Windows\illustrator.exe"
has comment: http://stackoverflow.com/comment/42159790
has title: Run a .exe from java and move on
has comment: http://stackoverflow.com/comment/42159565
has comment: http://stackoverflow.com/comment/42159991
tagged with: processbuilder
has answer: http://stackoverflow.com/a/26792265
upvote count: 1

http://stackoverflow.com/comment/42206649
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26818308
has text: This is nice comment. I agree that partitionBy sounds like a good option for satisfying conditions. It is also nice to see someone agrees that working with maps can be a bit frustrating in the Streams API. I find myself getting the entry set or the values often and then converting to a stream etc.. It gets verbose. At the same time, I'm liking Streams API more than C# Linq which is completely opaque.
type: Comment

http://stackoverflow.com/q/26736503
favorite count: 0
has body: I have a popup in which you have to select components for you pc. Each component contains a label and a drop down list with all the selected components in the database. Next to the list there is an 'add' button, when clicked it give another popup, which is used when the user does not find what he wants in the list. The add function calls a method which checks the input of the user for already existing inputs and adds if there is none. MY PROBLEM: is that I can not find a solution for refreshing the list which was updated. I am trying to use &lt;p:ajax /&gt; but I keep getting Cannot find component errors. ---HTML CODE---- &lt;form id="dialog"&gt; &lt;h:outputText value="Computer: " styleClass="dialog-labels" /&gt; &lt;ul style="list-style-type: none"&gt; &lt;li&gt; &lt;div class="dialog-container"&gt; &lt;h:outputLabel value="Processor: " style="float:left;" /&gt; &lt;p:selectOneMenu id="procs" filterFunction="true" filterMatchMode="true" styleClass="dialog-dropdown-list" style="width:15em;"&gt; &lt;f:selectItem itemLabel="Select Processor" itemValue="" noSelectionOption="true" /&gt; &lt;f:selectItems id="list" value="#{javaHTMLConnection.procList}" /&gt; &lt;/p:selectOneMenu&gt; &lt;p:commandButton value="Add" id="addProc" styleClass="dialog-buttons" onclick="PF('addProcBox').show();" style="font-size: 10px;" /&gt; &lt;h:form id="popUp"&gt; &lt;p:dialog header="Add Processor" widgetVar="addProcBox" height="200" width="180" draggable="false" resizable="false" style="font-size:13px;"&gt; &lt;h:outputLabel value="Processor: " style="float:left;" /&gt; &lt;p:inputText id="procInput" value="#{components.procID}"/&gt; &lt;p:growl id="growl" life="10000" /&gt; &lt;p:commandButton value="Save" styleClass="dialog-bottom-buttons" action="#{components.addProcessor()}" update="growl" onclick="PF('addProcBox').hide();" style="font-size: 10px;" /&gt; &lt;p:ajax listener="#{javaHTMLConnection.onAdd()}" update=":dialog:list" /&gt; &lt;p:commandButton value="Cancel" id="CancelAddPr…
linked to: http://stackoverflow.com/q/7371903
tagged with: http://stackoverflow.com/tag/html
possible better answer: http://stackoverflow.com/a/26736851
has title: Primefaces-Refreshing drop down list
downvote count: 2
accepted answer: http://stackoverflow.com/a/26736941
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java
tagged with: mysql
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/379610
upvote count: 0
score: -2
linked to: http://stackoverflow.com/q/13499642
has answer: http://stackoverflow.com/a/26736941
has answer: http://stackoverflow.com/a/26736851

http://stackoverflow.com/q/26815942
has body: I am developing a java application which can send video to a php server. I had done it on android and the code below is working perfect on android but now when I tried this code in pure java(not android) I got exception. This is my java desktop code that uploads a video to php try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://b....vedioup.php"); FileBody filebodyVideo = new FileBody(new File(Path)); StringBody title = new StringBody("Filename: " + Path); StringBody description = new StringBody( "This is a description of the video"); MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("videoFile", filebodyVideo); reqEntity.addPart("title", title); reqEntity.addPart("description", description); httppost.setEntity(reqEntity); // DEBUG System.out .println("executing request " + httppost.getRequestLine()); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); // DEBUG System.out.println(response.getStatusLine()); if (resEntity != null) { System.out.println(EntityUtils.toString(resEntity)); } // end if if (resEntity != null) { resEntity.consumeContent(); } // end if httpclient.getConnectionManager().shutdown(); } and this is the output in console. Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.http.impl.client.AbstractHttpClient.&lt;init&gt;(AbstractHttpClient.java:187) at org.apache.http.impl.client.DefaultHttpClient.&lt;init&gt;(DefaultHttpClient.java:146) at BlankFoem.uploadFile(BlankFoem.java:351) It is clear that its an exception of class not found but how can I fix it. Thanks
type: AnsweredQuestion
has title: Error in uploading video from java to php server
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26816152
has answer: http://stackoverflow.com/a/27102111
possible better answer: http://stackoverflow.com/a/26929432
has answer: http://stackoverflow.com/a/26929432
tagged with: java
answer count: 3
upvote count: 1
tagged with: http
has comment: http://stackoverflow.com/comment/42203077
downvote count: 0
has answer: http://stackoverflow.com/a/26816152

http://stackoverflow.com/q/26778150
has title: boost some words in lucene
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9829161
type: Question
tagged with: java
has body: How to boost some particular words in lucene index? For e.g. I have a list of items: "lucene in action" "solr in action" "solr in action book" "building search applications" "building search applications book" I consider the word "book" as not important and would like to down vote it. I would not like to use filter to remove the word completely from search results as it is still might be useful. Some book might have a word book in it's name (for e.g. "book of mormon"). Currently, I use new StandardAnalyzer(version) and store fields as new TextField("name", name, Field.Store.YES) Ideally, I would like to have a dictionary with a list of terms to boost and to provide it to lucene. I know that I can boost on search if I break the request to terms (like "lucene" AND "book"^0.5), but it's not what I want.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/108800577
tagged with: lucene
has answer: http://stackoverflow.com/a/26805623
has comment: http://stackoverflow.com/comment/108437507

http://stackoverflow.com/q/26703286
tagged with: checkbox
score: 0
tagged with: java
tagged with: mysql
tagged with: swing
answer count: 1
type: UnansweredQuestion
has body: I am working on a Java Frame. I have created a questionnaire in which I use a number of ckeck boxes. The check boxes are labelled 1-15. I wish to collect the information on which checkboxes are selected and transfer them to a Db in MySQL. For radiobuton, I manage this very easily because I can create a buttongroup and then : int marital = 0 ; if (jRadioButton3.isSelected() == true) marital = 1; if (jRadioButton4.isSelected() == true) marital = 2; and then on the sql side, a column will have a value 1 or 2 depending on which radio box is chosen. However, with multiple checkboxes there is a possibility of multiple choices. Each checkbox has its own method. My question is this: How should I collect the information on which check boxes are selected. Should I transfer a vector or 15 single values? On the SQL side, should I have 15 columns or 1 column which can take a vector? Thank you for your precise information.
has title: How to transfer checkbox values to MySQL?
has answer: http://stackoverflow.com/a/26707453
linked to: http://stackoverflow.com/q/13348601
type: Question
has comment: http://stackoverflow.com/comment/42008001

http://stackoverflow.com/comment/42217690
comment on: http://stackoverflow.com/q/26820922
score: 0
type: Comment
type: QuestionComment
has text: No, you added a *link* to the stacktrace. Please post the actual text of the StackTrace **here** and again, please indicate for us which line throws the stacktrace.

http://stackoverflow.com/a/26815536
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42202829
has comment: http://stackoverflow.com/comment/42202796
has comment: http://stackoverflow.com/comment/42202096
has comment: http://stackoverflow.com/comment/42282517
has body: The problem is you are initializing the client first and then server. as.setUpClient(); as.setUpServer(); And what I believe you are doing it to have the code run twice. First you get Connection refused and when u run it the second time you get BindException. Without closing the previous console. Also check if any other process is binding on the same port. If you are on windows run nestat -ano If you see port 8003 refer that pid and kill it using task manager. Since you have already tried other ports I guess your problem is as stated first point. Even if you were to reverse it the order in your code as.setUpServer(); as.setUpClient(); And since your Socket sock = serverSocket.accept(); is blocking api. Your client code i.e as.setUpClient(); will not be called. Split it as two file client and server. Run the server first then client. It will work. Do some thing like this: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class AdviceServer { String[] adviceList = { "Take smaller bites", "Go for the tight jeans. No they do NOT" + "make you look fat.", "One word: inappropriate", "Just for today, be honest. Tell your" + "boss what you *really* think", "You might want to rethink that haircut." }; public void setUpServer() { ServerSocket serverSocket = null; try { if (serverSocket == null) serverSocket = new ServerSocket(8003); int i = 2; // Keep looping till we have clients. while (true) { Socket sock = serverSocket.accept(); PrintWriter pw = new PrintWriter(sock.getOutputStream()); pw.write(getRandomAdvice()); pw.close(); System.out.println(getRandomAdvice()); } // serverSocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (serverSocket != null) { try { serverSocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public String getR…
has comment: http://stackoverflow.com/comment/42202218
has comment: http://stackoverflow.com/comment/42202290
has comment: http://stackoverflow.com/comment/42202268
answers question: http://stackoverflow.com/q/26815129
has comment: http://stackoverflow.com/comment/42202134
score: 0
has comment: http://stackoverflow.com/comment/42202079
upvote count: 1
has comment: http://stackoverflow.com/comment/42202178

http://stackoverflow.com/a/26729612
has body: In hibernate.cfg.xml configuration file you can set a property called hbm2ddl.auto that tells hibernate to create a table for you: create When you run your application for the first time then you can set the property to create and later you can change it to update. Follow this link for more details: Hibernate hbm2ddl.auto possible values and what they do?
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26725011

http://stackoverflow.com/comment/42111152
comment on: http://stackoverflow.com/q/26758972
type: Comment
type: QuestionComment
has text: you can refer http://stackoverflow.com/questions/26739636/mybatis-mapping-for-fetching-list-of-custom-record-types-in-oracle/26765161#26765161 added a complete example
score: 0

http://stackoverflow.com/a/26741704
has body: What you are currently doing is putting the return value of the function in the queue. So the function executes and then the value that it produces is put into the queue. Instead you could have a queue of Runnables and then call the run() method on them: PriorityQueue&lt;Runnable&gt; queue = new PriorityQueue&lt;Runnable&gt;(); queue.offer( new Runnable() { public void run() { login(); } ); queue.remove().run(); Or, if using Java 8: PriorityQueue&lt;Runnable&gt; queue = new PriorityQueue&lt;&gt;(); queue.offer(() -&gt; login(););
has comment: http://stackoverflow.com/comment/42071719
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/42069164
has comment: http://stackoverflow.com/comment/42069436
answers question: http://stackoverflow.com/q/26741520
has comment: http://stackoverflow.com/comment/42069445
score: -1
accepted answer of: http://stackoverflow.com/q/26741520
has comment: http://stackoverflow.com/comment/42070987

http://stackoverflow.com/a/26721089
has comment: http://stackoverflow.com/comment/42033856
answers question: http://stackoverflow.com/q/26705676
score: 0
has body: In your example you are just using SnowballPorterFilterFactory without specifying the language parameter. This defaults to English, which is probably not what you want. Have you tried changing this to the language you are targeting?
type: Answer

http://stackoverflow.com/a/26766180
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26766079
type: Answer
answers question: http://stackoverflow.com/q/26766079
has body: Please try the following for 2 decimal point precision String inputLine = "12.10654"; String regex = "\\d+(\\.\\d{1,2})?"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(inputLine); if(m.find()) System.out.println(m.group()); and the output is 12.10
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42113281
has comment: http://stackoverflow.com/comment/42113401

http://stackoverflow.com/a/26741902
answers question: http://stackoverflow.com/q/26741883
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42069605
has comment: http://stackoverflow.com/comment/42069569
upvote count: 2
has body: Chit: restaurant rest= new restaurant(null, null, null); You're not passing in the Waiters that you've created but rather are only passing in nulls, so what do you expect will happen? The restaurant instance will only hold null references and will not magically be able to use the waiter objects. You have to pass them in -- If you want restaurant to use the Waiter references, pass them in via the constructor. waiters wt1 = new waiters (19 , 0 ); waiters wt2 = new waiters(20 , 0 ); waiters wt3 = new waiters (21 , 0); restaurant rest= new restaurant(wt1, wt2, wt3); System.out.println(rest.calculateSalary());
has comment: http://stackoverflow.com/comment/42069654
type: Answer

http://stackoverflow.com/q/26702426
answer count: 1
downvote count: 0
tagged with: struts2
tagged with: rest
has body: My problem concerns the creation of a custom method within an action. I'm using Struts2 and REST Plugin in order to implement a RESTful WebService. My action class is the following: public class SampleController implements ModelDriven<Object> { private Sample sample = new Sample(); private Collection<Sample> list; private int id; public HttpHeaders create() { sdao.save(sample); return new DefaultHttpHeaders("create"); } public HttpHeaders destroy() { return new DefaultHttpHeaders("destroy"); } public HttpHeaders show() { return new DefaultHttpHeaders("show").disableCaching(); } public HttpHeaders update() { sdao.save(sample); return new DefaultHttpHeaders("update"); } public HttpHeaders index() { list = sdao.findAll(); return new DefaultHttpHeaders("index").disableCaching(); } public Object getModel() { return (list != null ? list : sample); } public int getId() { return id; } public void setId(Integer id) { if (id != null) { this.sample = (Sample) sdao.findById(id); } this.id = id; } } I can access to a resource via a GET HTTP method correctly. In order to use a custom method, called by passing a parameter to search resources i.e public searchBySenderName(String senderName) { list.addAll(sdao.findBySenderName(senderName)) } What is the correct procedures? How can I call it via GET following URL?
tagged with: model-driven
has answer: http://stackoverflow.com/a/26703495
favorite count: 0
tagged with: struts2-rest-plugin
has title: How to create custom methods using Struts2 REST plugin
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/26868441
has body: The created class does “know” about its defining ClassLoader and the JVM will resolve its references using the defining class loader. However, as you can see from your stack trace, its the clojure.lang.RT.load which tries to resolve resources in an incompatible way. By looking at its code, it boils down to the following method: static public ClassLoader baseLoader(){ if(Compiler.LOADER.isBound()) return (ClassLoader) Compiler.LOADER.deref(); else if(booleanCast(USE_CONTEXT_CLASSLOADER.deref())) return Thread.currentThread().getContextClassLoader(); return Compiler.class.getClassLoader(); } From this code you can derive solutions to your problem: You may set the value of Compiler.LOADER to your custom class loader. If Compiler.LOADER remains unbound and RT.USE_CONTEXT_CLASSLOADER evaluates to true, you can set the context loader of your thread to your custom class loader. last but not least, if you enforce your class loader to be the defining class loader of the entire clojure code, Compiler.class.getClassLoader() will return your custom class loader.
type: Answer
answers question: http://stackoverflow.com/q/26807346
score: 0

http://stackoverflow.com/a/26696456
answers question: http://stackoverflow.com/q/26690283
type: Answer
score: 2
upvote count: 2
has body: I put a brief example in this question: Can generate .thrift files from existing java/scala interfaces and data types? Both the Thrift website and the Swift github repo have separate examples, and my example from that question can be used to glue them together. Basically, on the Thrift side you generate code as per the Thrift documentation. Same thing on the Swift side. However, on the Swift side instead of using the built in 'Nifty' server (you could if you want to, but your question sounds like you are trying to interop with the Thrift libraries) you can create a ThriftServiceProcessor as per my example and then convert it using NiftyProcessorAdapter to a normal TProcessor that can be passed into the standard Thrift Java library. Hope that helps.
downvote count: 0

http://stackoverflow.com/comment/42209110
comment on: http://stackoverflow.com/q/26817902
type: Comment
type: QuestionComment
has text: Because I need to create a flexible way to orchestrate several EMF tools (ATL, ATL/EMTF, Acceleo, XText). I planed to create a task type for each so I could just orchestrate them by using Gradle`s build-in depenendcy graph (i.e. Task.dependsOn). This works for most,but MoDisco needs a IJavaProject, which I only get inside Eclipse. Again, my task is to create a EMF orchestration language and I hoped to (mis-)use Gradle for that.
score: 0

http://stackoverflow.com/q/26697559
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/26697633
has title: Searching for numerical values in java structures
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26697640
has answer: http://stackoverflow.com/a/26697640
downvote count: 0
has answer: http://stackoverflow.com/a/26697633
tagged with: data-structures
has body: I have a homework to do, which is really interesting and I found that I've no idea how to implement data structure that should be search-able and relatively fast. There is given a database, with 3 fields - x,y,z. They are in fact values of some unknown function, that represents 3d coordinates. I have to find plain areas in the set of data. I wonder, what is the best way to temporarily store these co-ordinates in my program. I would prefer to make a class called "Point", with the appropriate fields and store them in one of collection types (HashMap? ArrayList? LinkedList?) That could allow me to implement some methods inside file like "search for neighbours with same height". But i believe that there should be much faster data structure which stores the co-ordinates directly instead of packaging the co-ordinates into an object. But other side... damn, I'm learning OOP :) What is best structure to keep data in this case? Thanks Smok.

http://stackoverflow.com/a/26805906
answers question: http://stackoverflow.com/q/26793136
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: In pseudocode: mainArray = new JsonArray(); firstObject = new JsonObject(); firstObject.add("op", "replace"); firstObject.add("path", "/path1"); firstObject.add("value", "val1"); mainArray.add(firstObject); secondObject = new JsonObject(); secondObject.add("op", "replace"); secondObject.add("path", "/path2"); innerArray = new JsonArray(); innerObject = new JsonObject(); innerObject.add("name", "val2"); innerArray.add(innerObject); secondObject.add("value", innerArray); mainArray.add(secondObject); jsonString = mainArray.toJsonString();

http://stackoverflow.com/a/27121579
has body: Have you overwritten the TOP attribute of the dialog box by percentage? If not please overwrite the css of the dialog box div. #dialogBoxId{ top: 50% !important; left:50% !important; }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26740262
answers question: http://stackoverflow.com/q/26740262
score: 1
has comment: http://stackoverflow.com/comment/42827629

http://stackoverflow.com/q/26759649
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/42100969
has comment: http://stackoverflow.com/comment/42100953
type: Question
has comment: http://stackoverflow.com/comment/42100692
has comment: http://stackoverflow.com/comment/42100626
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/42100580
has title: Adding permissions to jar, results in class not found exception
has comment: http://stackoverflow.com/comment/42202536
tagged with: permissions
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: In Oracle forms 11gR2 when connecting to the server through web browser - i.e. chrome - to run Oracle Forms it runs the following jar file frmall.jar After updating Java instead of opening ,I got the following message. Your Security settings have blocked an application from running due to missing a "Permissions" manifest attribute in the main jar. I looked around and found that to add the missing attribute "Permission: all-permissions", I have to execute the following code in a cmd jar -ufm frmall.jar mf.txt where mf.txt contains "Permission: all-permissions". Running the application again after restarting code the following error. I kept looking and didn't find an answer. How to solve it ?.

http://stackoverflow.com/comment/42016707
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26712932
has text: update your adt bundal
score: 0

http://stackoverflow.com/a/26725005
has comment: http://stackoverflow.com/comment/42039628
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42040728
accepted answer of: http://stackoverflow.com/q/26724895
has body: Couple of things: What makes you believe that shutting down the main thread will interrupt the game thread? You never call interrupt() anywhere so I'm not sure why you expect an InterruptedException to occur when the main thread ends. This does not happen. Non-daemon threads will continue running; the JVM will not shut down if there are still non-daemon threads. Set your new thread to be a daemon if this is not the behavior you desire. You may want to consider using a Timer or a ScheduledExecutorService for your updates instead of creating a new Thread as it will generally be easier to manage. The more common way to terminate a thread, in its most basic form, would be something like: volatile boolean stopMyThread = false; public void run() { while (!stopMyThread) { } } Then when you'd want to stop it: stopMyThread = true; And optionally join on the thread to wait for it to stop. However, with a Timer or, even better, a ScheduledExecutorServices, you can simplify your code a bit.
answers question: http://stackoverflow.com/q/26724895
type: AcceptedAnswer

http://stackoverflow.com/comment/42169900
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26784148
has text: May be I'm wrong but I thougt that the amount of memory used by the JVM is visible as the Commited memory. I my case commited memory is low. I suppose java has other memory regions, and the huge amount of unvisible memory is in one of those regions, but I don't know how I can diagnose it !

http://stackoverflow.com/a/26759257
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/42099983
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26759174
score: 5
answers question: http://stackoverflow.com/q/26759174
type: AcceptedAnswer
has body: Your if condition must be '>='. Try: if (x &gt;= board.length) { // This tests to make sure the knight does not move off the row System.out.println("Cannot move off board on x axis"); x -= 1; } else if (y &gt;= board.length) { // This tests to make sure the knight does not move off the column System.out.println("Cannot move off board on y axis"); y -= 2; }

http://stackoverflow.com/comment/42059674
comment on: http://stackoverflow.com/q/26735746
has text: You'll have to post the code that does it then.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41949235
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26674806
has text: Hm... from a quick look your maven configuration seems to be o.k. and the dependency should be packed into your .jar. Is this the case? The only thing i currently dont know is on how your resources definition will behave
score: 0

http://stackoverflow.com/comment/124759848
comment on: http://stackoverflow.com/a/62720545
type: Comment
score: 0
type: AnswerComment
has text: as far as I understand the question, it was explicitly asked for a solution for non-entities. In my case, I need to extract DTOs from an SQL view for example, that has no entity.

http://stackoverflow.com/q/26676730
tagged with: jface
tagged with: checkbox
has body: I use a CheckBoxTreeViewer and I want to hide a checked checkbox. I dont' know how to do that : when a check box is hidden, it's uncheckd too... Anyone have a solution ? Thx
tagged with: treeviewer
has comment: http://stackoverflow.com/comment/41952548
score: 2
has title: CheckboxTreeViewer : hide a checked box
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41964441
tagged with: java
has comment: http://stackoverflow.com/comment/41964987
has comment: http://stackoverflow.com/comment/41972013
type: Question
downvote count: 0
favorite count: 0
type: UnansweredQuestion

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/26741167
tags question: http://stackoverflow.com/q/26742521
type: Tag

http://stackoverflow.com/q/26714801
has answer: http://stackoverflow.com/a/26714883
has title: How can I draw a chart with percentages using SmartXLS?
tagged with: smartxls
tagged with: excel
type: Question
tagged with: java
answer count: 1
score: 0
has body: I am trying to draw a chart in an xlsx file using Java. I found SmartXLS and decided to give it a try. So far, I managed to draw the charts correctly, but I can't seem to be able to display percentages on the chart. Any ideas how to do that? EDIT: I realized my question may not have been detailed enough. I am trying to draw a Pie chart, where the percentages are added on the chart itself. Thanks to Michael, I know how to do it in cells, but I do not know how to do it on the chart. EDIT 2: There is no mention of the problem in the SmartXLS documentation, which is why I am requesting help. I do not need anyone writing code for me, just which function can do what I need.
type: UnansweredQuestion

http://stackoverflow.com/q/26760527
possible better answer: http://stackoverflow.com/a/26760808
tagged with: java
has answer: http://stackoverflow.com/a/26760808
tagged with: methods
type: Question
tagged with: arrays
score: -1
accepted answer: http://stackoverflow.com/a/26760544
downvote count: 2
answer count: 3
has body: I am getting an error while compiling this programe: class ArraysInMethods { public static void main(String[] args) { int array[]={1,6,2,5,3,8,9,0,5}; Add5(array); for(int y : array){ System.out.println(y); } } public void Add5(int x[]){ for(int counter=0; counter &lt; x.length; counter++){ x[counter]+=5; } } } I am getting the following ERROR Exception in thread "main" java.lang.Error: Unresolved compilation problem: Cannot make a static reference to the non-static method Add5(int[]) from the type ArraysInMethods at ArraysInMethods.main(ArraysInMethods.java:6)
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26760544
has answer: http://stackoverflow.com/a/26760593
has title: Why this basic java programme is not compiling
type: AnsweredQuestion

http://stackoverflow.com/q/26767073
tagged with: mysql
has comment: http://stackoverflow.com/comment/42151359
type: Question
linked to: http://stackoverflow.com/q/8345133
has title: Connecting Mysql database with Java
has comment: http://stackoverflow.com/comment/42115237
has comment: http://stackoverflow.com/comment/42115017
has comment: http://stackoverflow.com/comment/42150814
has answer: http://stackoverflow.com/a/26767345
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42150630
linked to: http://stackoverflow.com/q/2983248
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42151395
has comment: http://stackoverflow.com/comment/42151473
has comment: http://stackoverflow.com/comment/42153440
has body: --CODE UPDATED-- I'm trying to connect a MySQL database using JDBC but I'm not able to get the connection to work. I'm not sure if the way I've constructed the connection string is right. Here's the code and the error: Code: Connection conn; String userName = "root"; String serverName = "127.0.0.1"; String portNumber = "3306"; String password = "password"; String dbName = "myDB"; /** * Establishes connection with the sql database * @throws SQLException */ public SQLConnector() throws SQLException { setConnection(); } private void setConnection() throws SQLException { Properties connectionProps = new Properties(); connectionProps.put("user", this.userName); connectionProps.put("password", this.password); String connectionString = "jdbc:mysql://" + this.serverName + ":" + this.portNumber + "/" + this.dbName; System.out.println(connectionString); this.conn = DriverManager.getConnection(connectionString, connectionProps); } Error: 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:377) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:627) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1013) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2234) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:790) at com.mysql.jdbc.JDBC4Con…
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42177469
type: QuestionComment
has text: Ya Ianm getting errror as Null pointer exception and setOncheckedChangeListener() but what type of error it is???
score: 0
comment on: http://stackoverflow.com/q/26800380
type: Comment

http://stackoverflow.com/q/26784036
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42144847
downvote count: 1
type: Question
has title: Can an exception message contain regular expression characters in Java?
has answer: http://stackoverflow.com/a/26784192
answer count: 1
has comment: http://stackoverflow.com/comment/42144908
tagged with: string
favorite count: 0
tagged with: exception
tagged with: regex
accepted answer: http://stackoverflow.com/a/26784192
has body: I'm throwing a new exception in a Java class with some characters that usually get used for regular expressions. throw new Exception("(): Fake timeout for message(.*XYZV.* fakeApp .*)."); Is this Ok? Or do I need to escape them?
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/26723526
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42037563
upvote count: 8
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26724004
accepted answer: http://stackoverflow.com/a/26724004
tagged with: hadoop
has title: package org.apache.hadoop.fs does not exist
has body: First, I KNOW THIS HAS BEEN ASKED BEFORE, but none of the solutions work for me and I would like to know why. I am trying to compile the standard 'WordCount.java' .jar for hadoop on my linux single-node cluster, but keep getting the package org.apache.hadoop.* does not exist error. I know that I have to edit the $CLASSPATH, but everything I have found online is saying to reference hadoop-core and I cannot find a hadoop-core anywhere in my build (2.4.0). How do I find where org.apache.hadoop.* would exist on my system? I feel this would be a good 'general' answer since I have seen many questions on this and everyone gives a specific /path/to/classpath/, but it is (apparently) different depending on version and build of hadoop.
answer count: 1
downvote count: 0
favorite count: 0
score: 8

http://stackoverflow.com/a/26930049
type: Answer
has body: In your ClassA.getimage(), ClassB.getimage() ... make sure to not create an image each time ".getimage()" is called, cache it. private Image image; public Image getImage() { if ( image == null) { image = new Image(Display.getDefault(), ""); } return image; } Since it seems that you are in an Eclipse environment, better even use "org.eclipse.jface.resource.ImageRegistry". Where "UIPlugin" is your plugin extending "org.eclipse.ui.plugin.AbstractUIPlugin". If you don't have one, create one and add it to your MANIFEST.MF (Bundle-Activator: YOURCLASS). public Image getImage() { String key = getClass().getName(); ImageRegistry imageRegistry = UIPlugin.getDefault().getImageRegistry(); Image image = imageRegistry.get(key); if (image == null) { image = new Image(Display.getDefault(), ""); imageRegistry.put(key, image); } return image; }
score: 0
answers question: http://stackoverflow.com/q/26801704

http://stackoverflow.com/comment/42194531
type: QuestionComment
score: 0
has text: It is quite unclear what you want to achieve. Should there be an edge between any two nodes or just a path? Do you need a triangulation?
comment on: http://stackoverflow.com/q/26809302
type: Comment

http://stackoverflow.com/comment/42214857
has text: The string that is guaranteed not to be in the input can only be generated with the input known: change the case of every character in the string is an obvious one. You end up with a string that is the same length as the input, and different.
score: 3
comment on: http://stackoverflow.com/a/26791459
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26733081
has body: Have a look here: http://maven.apache.org/guides/mini/guide-using-one-source-directory.html So what you'd have to do is: src/mainProduct ... Alternatively you could try and use the approach suggested here: Maven compile with multiple src directories The build-helper-plugin and its documentation can be found here: http://mojo.codehaus.org/build-helper-maven-plugin/
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26732982

http://stackoverflow.com/q/26764820
has body: I have two tables both in the same database... how would one go about issuing a querying a mysql database using Java? I need do is to search LIKE items USERNAME COLUMN in table 1 then take the data from ID column and search those against table 2 if the ID is found then it returns true if it is not found it returns false TABLE 1: | Username | ID | ------------------------ | Jack | 3 | | Drew | 2 | | jAcK | 8 | TABLE 2: | ID |comment| ------------------ | 3 | * | | 8 | * | | 2 | * | So I guess I should make this more clear: We search TABLE 1 for jack then all the IDS that are found for LIKE jack are searched against TABLE 2 if the ID is found in TABLE 2 then TRUE if not then FALSE
has answer: http://stackoverflow.com/a/26764858
answer count: 2
has comment: http://stackoverflow.com/comment/42110612
has answer: http://stackoverflow.com/a/26764908
tagged with: java
downvote count: 5
has title: MySQL query: how would one go about issuing a querying a mysql database using Java?
tagged with: mysql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42111835
has comment: http://stackoverflow.com/comment/42110742
upvote count: 0
score: -5
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42110541

http://stackoverflow.com/comment/42202700
type: QuestionComment
has text: So your screen is what, at least 5120px wide? No most systems, buttons tend to be 16-32 or maybe 48px...
score: 0
comment on: http://stackoverflow.com/q/26815666
type: Comment

http://stackoverflow.com/comment/42014155
comment on: http://stackoverflow.com/q/26711441
type: Comment
type: QuestionComment
has text: You can try `chroot` if you on linux
score: 0

http://stackoverflow.com/comment/88956080
score: 6
comment on: http://stackoverflow.com/a/37608916
type: AnswerComment
type: Comment
has text: @Kane I find it easier to specify `@TestPropertySource(properties= {"spring.autoconfigure.exclude=comma.seperated.ClassNames,com.example.FooAutoConfiguration"})` on the `*Test` class. saves having to define a profile for every permutation of undesired configs.

http://stackoverflow.com/comment/49904265
type: Comment
comment on: http://stackoverflow.com/q/26747076
type: QuestionComment
has text: @fracz just to be sure that its due to unit test try to run your app inside a container and see the logs (Spring logs) if its creating your UserController object twice then there is something wrong with your spring configuration.
score: 0

http://stackoverflow.com/comment/42189056
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26801026
type: AnswerComment
has text: I'm working with a fork of the code from https://github.com/cloudfoundry/uaa/ which had 8 references to this same group/artifact pair over 5 different POM files, so I doubt that's the problem. Returning to upstream isn't much help, as the project dropped the pom files in July 2014 when they moved from maven to gradle.

cpu
tags question: http://stackoverflow.com/q/26680710
type: Tag
tag name: cpu

http://stackoverflow.com/comment/41994321
has text: @user3371750 instead of the loop and the `break` statements, use `return;` to exit the `actionPerformed` method early. As I said, if the input is correct, you're resetting `nameField` and you're not exiting the loop. Therefore on the next iteration `nameField.getText().isEmpty()` is true and you'll receive the error message.
comment on: http://stackoverflow.com/a/26700183
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41996927
comment on: http://stackoverflow.com/a/26701627
type: AnswerComment
score: 0
has text: It's normal to make mistake ^^! Just relax.
type: Comment

http://stackoverflow.com/q/26679557
has comment: http://stackoverflow.com/comment/41978671
tagged with: buffer
type: Question
has body: I am trying to read a single line which is about 2 million characters long from the standard input using the following code: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); s = in.readLine(); For the aforementioned input, the s = in.readLine(); line takes over 30 minutes to execute. Is there a faster way of reading this input?
answer count: 1
has answer: http://stackoverflow.com/a/26680449
tagged with: performance
has comment: http://stackoverflow.com/comment/41958956
tagged with: java
upvote count: 1
downvote count: 0
tagged with: bufferedreader
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41957992
has title: Optimizing BufferedReader for large input in java
tagged with: large-data-volumes
score: 1
favorite count: 0

http://stackoverflow.com/comment/42107603
has text: @FelRPI added a new section with usage explanation :)
comment on: http://stackoverflow.com/a/26759423
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42170899
type: Comment
comment on: http://stackoverflow.com/a/26797270
score: 0
type: AnswerComment
has text: I think I'm understood - a java client want to send me jpg file and i should save it to disk and open it in future . So he starts sending me bytes in chunks . Each chunk is saved to disk . Should i be afraid of endians ? Im starting to think that it only has to do with memory representation and not disk representation .....? Thank you for all help ! Btw

http://stackoverflow.com/comment/42219568
type: QuestionComment
comment on: http://stackoverflow.com/q/26825342
has text: have you added POJO in array list with database column values set to it right? so why you are not using **getter method** to access the value. **for(int i=0;i<myList.size();i++){POJO p = myList.get(i); p.getColumnName(); }**
score: 0
type: Comment

http://stackoverflow.com/q/26819396
tagged with: applet
has body: I am very new to Java and programming in general, so I tried to write a simple program whose only job is to make a ball moving around with the arrow keys and jumping with the space button. The program compiles but the ball doesn't move. I probably didn't fully understood the Applet principles, could you explain to me the mistake I made? Applet: package test_game; import java.applet.Applet; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Starting_Point extends Applet implements Runnable, KeyListener { private static final long serialVersionUID = 1L; private static final int WIDTH = 700; private static final int HEIGHT = 300; Character Phil; Thread thread; @Override public void init() { setSize(WIDTH,HEIGHT); Phil = new Character(50, 200); } @Override public void start() { thread = new Thread(this); thread.start(); } public void run() { while (true) { repaint(); } } @Override public void paint(Graphics arg0) { Phil.paint(arg0); } @Override public void keyPressed(KeyEvent arg0) { switch (arg0.getKeyCode()) { case (KeyEvent.VK_LEFT): Phil.setX(Phil.getX() - Phil.getDx()); break; case (KeyEvent.VK_RIGHT): Phil.setX(Phil.getX() + Phil.getDx()); break; case (KeyEvent.VK_SPACE): Phil.setDy(Character.gravity * Character.dt); Phil.setY(Phil.getY() + .5*Character.gravity*Character.dt*Character.dt + Phil.getDy()*Character.dt + Character.jump); break; } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } } Character class: package test_game; import java.awt.Color; import java.awt.Graphics; public class Character { private int x; private int y; private int radius = 10; Graphics g; public static final int gravity = 15; private static final double dx = 4; public double dy; public static final double dt = .2; public static final int jump = 30; public Character(int x, int y) { this.x = x; this.y = y; } pub…
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42218154
tagged with: java
has title: Why doesn't the ball move around in my applet when I press a button?
type: Question
tagged with: keylistener
tagged with: awt
score: 0
has answer: http://stackoverflow.com/a/26823086
accepted answer: http://stackoverflow.com/a/26823086
answer count: 1

http://stackoverflow.com/comment/42050825
type: Comment
type: QuestionComment
score: 0
has text: i believe your context is Null as well
comment on: http://stackoverflow.com/q/26731663

http://stackoverflow.com/a/26688402
has comment: http://stackoverflow.com/comment/41974414
has comment: http://stackoverflow.com/comment/41976599
upvote count: 1
has comment: http://stackoverflow.com/comment/41974156
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41973986
has body: all you need to do is take input from user and then check is it exist in file .you shouldn't use myScanner.nextLine().trim() inside while loop because then it waits to get user input every loop time .ones you get a number from user ,you should check it in the file .what you did is get user input and then again wait for user to input value again and again fixed code import java.util.Scanner; public class Classtest2 { public static void main(String[] args) { // //1. class Scanner sc = new Scanner(Classtest2.class.getResourceAsStream("trombones.txt")); Scanner myScanner = new Scanner(System.in); System.out.println("What number would you like to check for?"); String number = myScanner.nextLine() ; int lineNum = 0; while(sc.hasNextLine()) { word = sc.next(); if(word.equals(number.trim())) { //here was the problem System.out.println("The number "+number+ " is there"); return; } else { } } System.out.println("not found"); // not found } the best approach import java.util.Scanner; public class Classtest2 { public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); System.out.println("What number would you like to check for?"); String number = myScanner.nextLine(); if(isFound(number)){ System.out.println("The number "+number+ " is there"); }else{ System.out.println("The number "+number+ " doesn't exist"); } } public static boolean isFound(String number) { Scanner sc = new Scanner(Classtest2.class.getResourceAsStream("trombones.txt")); String word=""; while (sc.hasNextLine()) { word = sc.next(); if (word.equals(number.trim())) { return true; } } return false; } }
accepted answer of: http://stackoverflow.com/q/26688279
has comment: http://stackoverflow.com/comment/41976491
has comment: http://stackoverflow.com/comment/41974005
answers question: http://stackoverflow.com/q/26688279
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41976452

http://stackoverflow.com/q/26823595
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26823699
has comment: http://stackoverflow.com/comment/42230683
type: Question
tagged with: simpledateformat
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26823699
linked to: http://stackoverflow.com/q/22346705
has answer: http://stackoverflow.com/a/26823635
accepted answer: http://stackoverflow.com/a/26823635
has body: I have a strange issue. The below code is executed in a while loop through a few times. Now, every so often, this sdf.parse returns 0s for the hours, minutes and seconds. An example of the dates look like this... 2014:3:7:8:0 2014:3:7:9:0 2014:3:7:10:0 2014:3:7:11:0 2014:3:7:12:0 * This returns 0's 2014:3:7:13:0 2014:3:7:14:0 Below is the code. SimpleDateFormat sdf = new SimpleDateFormat("yyyy:M:d:h:m"); sdf.setTimeZone(TimeZone.getDefault()); Date sTime = null; try { sTime = sdf.parse(start); } catch (ParseException e) { e.printStackTrace(); return null; }
has title: SimpleDateFormat missing time

http://stackoverflow.com/a/70199817
score: 1
answers question: http://stackoverflow.com/q/26674556
downvote count: 0
has body: The same error can be caused by accidentally passing null as an argument, which is then regarded as a bytea type, making the cast to uuid impossible. So, before going into the solutions above, I would recommend checking one's business logic and quickly activating the hibernate binding parameters logs in application.yml: logging: level: org: hibernate: type: TRACE The faulty argument then becomes apparent, as in my case: .... binding parameter [6] as [VARBINARY] - [null] ... To also see the sql queries, add: spring: jpa: show-sql: true
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42001757
has text: Instead of using ArrayList you could use the [libgdx Array class](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Array.html)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26703134

http://stackoverflow.com/a/26695496
score: 0
has body: This example uses an HashMap to record prices: import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Project1 { private static String userMessage() { StringBuffer buffer = new StringBuffer(); String lineSeparator = System.getProperty("line.separator"); buffer.append("Welcome to Good Burger!"); buffer.append(lineSeparator); buffer.append("======================="); buffer.append(lineSeparator); buffer.append("Place your orders and type 'Finish' when you are done"); buffer.append(lineSeparator); buffer.append("--------------------------------------------------------"); buffer.append(lineSeparator); buffer.append("1. GoodBurger $8.00"); buffer.append(lineSeparator); buffer.append("2. GoodSalad $ 7.00"); buffer.append(lineSeparator); buffer.append("3. Soda $2.00"); buffer.append(lineSeparator); buffer.append("4. KidsMeal $3.00"); buffer.append(lineSeparator); buffer.append("Type '5' if you want to tip. \n"); buffer.append(lineSeparator); buffer.append("What would you like?"); buffer.append(lineSeparator); return buffer.toString(); } private static Map&lt;String, Double&gt; getPrices() { Map&lt;String, Double&gt; prices = new HashMap&lt;String, Double&gt;(); prices.put("GoodBurgers", 7.75); prices.put("GoodSalads", 7.00); prices.put("Sodas", 2.00); prices.put("KidsMeals", 3.00); return prices; } public static void main(String[] args) { String choice; boolean doneOrdering = false; String tipConfirmation; Scanner Keyboard = new Scanner(System.in); double subtotal = 0; int C = 0; double tip = 0.010; final double salestax = 0.081; String userMessage = userMessage(); System.out.println(userMessage); Map&lt;String, Double&gt; prices = getPrices(); while (!doneOrdering) { choice = Keyboard.next(); if (prices.containsKey(choice)) { double price = prices.get(choice); System.out.println(choice + " " + price); subtotal = subtotal + price; } else if (choice == "Tip") { doneOrdering = true; System.out.println("Do you want to tip?"); tipConfirmation = …
type: Answer
answers question: http://stackoverflow.com/q/26695319

http://stackoverflow.com/comment/42120695
comment on: http://stackoverflow.com/a/26770037
type: AnswerComment
score: 0
type: Comment
has text: @MiguelGarcíaGonzález Because you are not thinking about it like pixels in an image, which is what the AWT classes are designed for dealing with. I've added a picture.

http://stackoverflow.com/q/26729213
has body: I need a system, that will store one constantly growing float to a txt-file same time when closing the program and will load the stored value from the txt-file in to the game for use when opening the program. Is json-file easier way to do this? If so, can you help me to make save system with that?
downvote count: 1
type: Question
tagged with: libgdx
tagged with: java
accepted answer: http://stackoverflow.com/a/26731917
upvote count: 0
answer count: 1
favorite count: 0
has title: Libgdx - Save system
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/26731917
type: AnsweredQuestion
tagged with: save

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/26722153

redis
tags question: http://stackoverflow.com/q/26780531
type: Tag
tag name: redis

http://stackoverflow.com/a/26675658
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26675486
has body: No, never use a KeyListener in a text component. Here all you'll want is to add an ActionListener to your JTextField, the same one used on the button should work fine here. In fact, you've already done this, but you just haven't hooked it up. Try changing this: usernameField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { usernameFieldActionPerformed(evt); } }); to usernameField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // use the actionPerformed method you've already created for the send button sendButtonActionPerformed(evt); System.out.println(evt); } }); You should also avoid using NetBeans window builder to create your GUI's and instead code by hand as this will help you learn the Swing library.
downvote count: 0
score: 4

http://stackoverflow.com/comment/42029853
score: 1
type: AnswerComment
has text: There's absolutely no need to create a bean here.
comment on: http://stackoverflow.com/a/26719883
type: Comment

geotools
type: Tag
tags question: http://stackoverflow.com/q/26735362
tag name: geotools

http://stackoverflow.com/a/26709587
type: Answer
has body: This question indicates that you don't properly understand the problem. In your tag you mention encryption. But that's a pretty small field you got there... There's only one encryption algorithm (that I know of) that uses GF(24). That algorithm is the Simplified-AES algorithm developed by Professor Edward Schaefer of Santa Clara University and several of his students. You should study that material and understand the algorithm. What the heck would you need a table of inverses for anyway!? You may have noticed from your time spent on YouTube studying that the algorithm never includes division. So you don't need inverses. The only place the algorithm does multiplication is in the mixColums function and you already have a multiplication table for that. The inverse of mixColumns doesn't divide or need inverses either it just uses a different 2x2 matrix. If you did have to divide couldn't you use the multiplication table to find the inverse? ...And what would this table of inverses look like? Would it be 16x16? Now get off SO and get back to studying.
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26707068

http://stackoverflow.com/a/26730253
has comment: http://stackoverflow.com/comment/89463711
type: Answer
has comment: http://stackoverflow.com/comment/42048306
has comment: http://stackoverflow.com/comment/93442321
has comment: http://stackoverflow.com/comment/48487391
has comment: http://stackoverflow.com/comment/89465770
score: 6
has body: I've been working on SMPP project recently. The library I used for SMPP protocol is OpenSMPP. Here is the example of my class for building and sending SMPP data public class SmppTransport implements Transport { @Override public void send(String url, Map&lt;String, String&gt; map) throws IOException { int smscPort = Integer.parseInt(map.get("port")); String smscHost = map.get("send_url"); String smscUsername = map.get("username"); String smscPassword = map.get("password"); String recipientPhoneNumber = map.get("phone_num"); String messageText = map.get("text"); try { SubmitSM request = new SubmitSM(); // request.setSourceAddr(createAddress(senderPhoneNumber)); // you can skip this request.setDestAddr(createAddress(recipientPhoneNumber)); request.setShortMessage(messageText); // request.setScheduleDeliveryTime(deliveryTime); // you can skip this request.setReplaceIfPresentFlag((byte) 0); request.setEsmClass((byte) 0); request.setProtocolId((byte) 0); request.setPriorityFlag((byte) 0); request.setRegisteredDelivery((byte) 1); // we want delivery reports request.setDataCoding((byte) 0); request.setSmDefaultMsgId((byte) 0); Session session = getSession(smscHost, smscPort, smscUsername, smscPassword); SubmitSMResp response = session.submit(request); } catch (Throwable e) { // error } } private Session getSession(String smscHost, int smscPort, String smscUsername, String smscPassword) throws Exception{ if(sessionMap.containsKey(smscUsername)) { return sessionMap.get(smscUsername); } BindRequest request = new BindTransmitter(); request.setSystemId(smscUsername); request.setPassword(smscPassword); // request.setSystemType(systemType); // request.setAddressRange(addressRange); request.setInterfaceVersion((byte) 0x34); // SMPP protocol version TCPIPConnection connection = new TCPIPConnection(smscHost, smscPort); // connection.setReceiveTimeout(BIND_TIMEOUT); Session session = new Session(connection); sessionMap.put(smscUsername, session); BindResponse response = session.bind(r…
answers question: http://stackoverflow.com/q/26729958
has comment: http://stackoverflow.com/comment/48482723
accepted answer of: http://stackoverflow.com/q/26729958
type: AcceptedAnswer
downvote count: 0
upvote count: 6

overriding
tags question: http://stackoverflow.com/q/26706030
type: Tag
tags question: http://stackoverflow.com/q/26811401
tag name: overriding

http://stackoverflow.com/comment/42022988
comment on: http://stackoverflow.com/a/26703917
score: 0
type: AnswerComment
type: Comment
has text: Unfortunately explicitly declaring transaction doesn't help. What more - search results sometimes return nothing, then at next test run return doubled or tripled result (e.g. for searching "a@a.a" it finds it and return three objects even when there is only one row in db). It also finds strange results, like for searching for "a@a.a" it returns objects that doesn't have "a@a.a" at it email field. I can't see any pattern in this errors so I can't even tell when which of them occurs. Also it seems to reindexing more entities that it should when startAndWait is called.

http://stackoverflow.com/a/26683143
has body: The answer is no you do not need to make the variable volatile. The reasoning being, writes that occur to a variable within a synchronized block will be visible to subsequent threads entering a synchronized block on the same object. So it has the same memory semantics as a volatile read and write.
upvote count: 2
answers question: http://stackoverflow.com/q/26681984
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/51261029
type: Answer
score: 0
has body: The comparison works as follows: String str1 = "str";` //"str" is created in SCP and str1 is a reference to that String str2 = "string";` //"string" is created in SCP and str2 is a reference String str3 = "ing";` //"ing" is created in SCP and str3 is a reference String str4 = str1 + str3;//"string" will be created on Heap and str4 is a reference (this is because if any string created at runntime will always be created on Heap) (here SCP already has this "string" so no change) make a note that str4 is pointing to Heap string Object and not SCP str1 = str4; `// str1 and str4 will start pointing to same String Object on Heap String str5 = "string";` // SCP already has this and str2 pointing to that so now onwards str5 will also point to it based on above 1. str1 and str4 -- &gt; are pointing to "string" object on heap 2. str2 and str5 -- &gt; are pointing to "string" object in scp 3. str3 -- &gt; is pointing to "ing" in scp and finally the corresponding output can be traced based on above lines: System.out.println(str1==str2);`//false System.out.println(str1.intern()==str2.intern());`//true System.out.println(str1==str5);`//false System.out.println(str2==str5);`//true System.out.println("str"+"ing"=="string");`//true as "str"+"ing" will be replaced by "string" at compile time only (constant)
answers question: http://stackoverflow.com/q/26693369

http://stackoverflow.com/comment/42197001
score: 6
type: QuestionComment
comment on: http://stackoverflow.com/q/26812399
type: Comment
has text: I don't see use of variable `racer` anywhere... Also, `isPalindrome()` could be simplified to `return original.equals(reverse())`

http://stackoverflow.com/a/74431949
has body: If you use spring boot with auto-configuration, declaring the following bean can help: @Bean MongoManagedTypes mongoManagedTypes(ApplicationContext applicationContext) throws ClassNotFoundException { return MongoManagedTypes.fromIterable( new EntityScanner(applicationContext).scan(Persistent.class)); } Instead of scanning for Documents it will scan for both Document and TypeAlias, since both of these annotations are Persistent
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/137703773
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26823359

http://stackoverflow.com/comment/42154826
has text: Then probably you have nothing else to do. Just provide a good documentation of your services for the consumers to map the response with no problems.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26789221

http://stackoverflow.com/comment/42086049
type: QuestionComment
comment on: http://stackoverflow.com/q/26751146
has text: Yes. Either copy the JRE from an existing installation or download the `tar.gz` archives from Oracle and unzip them: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
score: 2
type: Comment

http://stackoverflow.com/comment/41966014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26683751
has text: What does "not working" mean? What happens when you compile and run this code?
score: 0

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/26731858

http://stackoverflow.com/q/26687669
has answer: http://stackoverflow.com/a/26689755
has body: I've never used scala before, this is a requirement for an interview test. When I try run the play eclipsify command I get the following error: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0 Getting org.scala-tools.sbt sbt_2.9.1 0.13.5 ... :: problems summary :: :::: WARNINGS module not found: org.scala-tools.sbt#sbt_2.9.1;0.13.5 ==== local: tried C:\Users\Paul\Documents\Programming\play-2.0\framework\..\repository/local/org.scala-tools.sbt/sbt_2.9.1/0.13.5/ivys/ivy.xml ==== Maven2 Local: tried file://C:\Users\Paul/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.13.5/sbt_2.9.1-0.13.5.pom ==== typesafe-ivy-releases: tried http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.13.5/ivys/ivy.xml ==== Maven Central: tried http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.13.5/sbt_2.9.1-0.13.5.pom ==== Scala-Tools Maven2 Repository: tried http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.13.5/sbt_2.9.1-0.13.5.pom ==== Scala-Tools Maven2 Snapshots Repository: tried http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.13.5/sbt_2.9.1-0.13.5.pom :::::::::::::::::::::::::::::::::::::::::::::: :: UNRESOLVED DEPENDENCIES :: :::::::::::::::::::::::::::::::::::::::::::::: :: org.scala-tools.sbt#sbt_2.9.1;0.13.5: not found :::::::::::::::::::::::::::::::::::::::::::::: :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS unresolved dependency: org.scala-tools.sbt#sbt_2.9.1;0.13.5: not found I've spent a lot of time looking online for a solution, but nothing has worked so far, and to be honest I'm not even sure what I'm looking for. Is it possible to point play at the correct repository? if so where is that? Can I tell play to use an older version? How can I do that? I've spent practically the whole day yesterday trying to set up the environment properly, with very little success. In the end, I managed to get a project template running by installing Inte…
tagged with: eclipse
type: Question
tagged with: sbt
has comment: http://stackoverflow.com/comment/41974688
has comment: http://stackoverflow.com/comment/41974337
has title: Play Framework "eclipsify" command throws error, cannot find sbt_2.9.1;0.13.5
accepted answer: http://stackoverflow.com/a/26689755
tagged with: playframework
score: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: scala
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/q/26814614
possible better answer: http://stackoverflow.com/a/26814648
tagged with: android
has answer: http://stackoverflow.com/a/26814648
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26816655
has title: Android/Java Development: App crashes when setting ListView row items that are not visible on screen
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/3724874
tagged with: listview
score: 0
answer count: 2
tagged with: mobile
has body: I have a problem that I encountered since I started learning Android. I have the below code which WORKS PERFECTLY when there are only fewer items in the my ListView: for (int i = 0; i &lt; listView.getCount(); i++) { v = listView.getAdapter().getView(i, null, null); txt_flag = (TextView) v.findViewById(R.id.txt_flag); flag = txt_flag.getText().toString(); txt_catid = (TextView) v.findViewById(R.id.txt_catid); catid = Integer.parseInt(txt_catid.getText().toString()); img_catdes = (ImageView) listView.getChildAt(i).findViewById(R.id.img_catdes); if(categoryid == 1){ img_catdes.setImageResource(R.drawable.category_personal1); } else if(categoryid == 2){ img_catdes.setImageResource(R.drawable.category_personal2); } if ("2".equals(flag)){ chk_flag = (CheckBox) listView.getChildAt(i).findViewById(R.id.checkBox_completed); chk_flag.setChecked(true); } } However, when the ListView becomes longer or more specifically, when there are ListView items that are no longer visible in the screen, I always encounter a CRASH! I am pretty sure that the lines that set the ImageView resource and setting the CheckBox state is the one causing the problem since the error is no longer encountered when I commented that block. PLEASE HELP guys as this has been giving me difficulty sleeping at night. :-( Thanks in advance. LogCat: 11-08 15:16:03.450: D/AbsListView(5306): unregisterIRListener() is called 11-08 15:16:03.470: D/AbsListView(5306): unregisterIRListener() is called 11-08 15:16:03.590: D/dalvikvm(5306): GC_CONCURRENT freed 194K, 25% free 8095K/10684K, paused 3ms+10ms, total 30ms 11-08 15:16:03.640: D/AndroidRuntime(5306): Shutting down VM 11-08 15:16:03.640: W/dalvikvm(5306): threadid=1: thread exiting with uncaught exception (group=0x41c50930) 11-08 15:16:03.640: E/AndroidRuntime(5306): FATAL EXCEPTION: main 11-08 15:16:03.640: E/AndroidRuntime(5306): java.lang.IllegalStateException: Could not execute method of the activity 11-08 15:16:03.640: E/AndroidRuntime(5306): at android.view.…
has answer: http://stackoverflow.com/a/26816655
has comment: http://stackoverflow.com/comment/42200826

http://stackoverflow.com/comment/42067371
type: Comment
type: QuestionComment
has text: I am not sure if its a buffer limitation ptoblem.. I still do not know what is the problem.
comment on: http://stackoverflow.com/q/26740434
score: 0

http://stackoverflow.com/q/26694264
tagged with: java
tagged with: lang
has body: I am getting this error whenever I press spacebar(to shoot the 'missile'), and I can't find out how to fix it, at all. Exception in thread "Thread-0" java.lang.NullPointerException at com.game.main.Bullet.render(Bullet.java:26) at com.game.main.Controller.render(Controller.java:58) at com.game.main.Game.render(Game.java:155) at com.game.main.Game.run(Game.java:108) at java.lang.Thread.run(Thread.java:745) I will list the code that is in the error as I have 9 classes. The Bullet error line: g.drawImage(tex.missile, (int)x, (int)y, null); tex.missile is a BufferedImage variable from the texture class, and is set to missile = ss.grabImage(2, 1, 32, 32); ss is a SpriteSheet class and is set to new SpriteSheet(game.getSpriteSheet()); The SpriteSheet class just gets the SpriteSheet and just sets each square to a row/column etc. Everything there works as my Player &amp; Enemy both work. Controller error line: tempBullet.render(g); Game.render error line: c.render(g); Game.run error line: render(); I highly doubt it has anything to do with the Game class, or anything like that, but I think it has to do with the Bullet class, but yet again. I could be, and most likely am wrong. I think that something may not be set correctly. If you want me to show a whole class, I will. Just tell me which one you need. EDIT: g.drawImage is inside of this method public void render(Graphics g){ g.drawImage(tex.missile, (int)x, (int)y, null); }
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41983898
has answer: http://stackoverflow.com/a/26694370
has answer: http://stackoverflow.com/a/26694396
accepted answer: http://stackoverflow.com/a/26694396
has comment: http://stackoverflow.com/comment/41983996
has comment: http://stackoverflow.com/comment/66789564
score: 0
tagged with: nullpointerexception
tagged with: exception
has comment: http://stackoverflow.com/comment/41983843
possible better answer: http://stackoverflow.com/a/26694370
has comment: http://stackoverflow.com/comment/41983906
has comment: http://stackoverflow.com/comment/41983965
has title: NullPointerException error with Rendering
has comment: http://stackoverflow.com/comment/41983875
has comment: http://stackoverflow.com/comment/41983858
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41984004
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41984015

http://stackoverflow.com/q/26790924
type: Question
has answer: http://stackoverflow.com/a/77995585
has comment: http://stackoverflow.com/comment/55110969
answer count: 2
has body: I have a simple XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="form.xsl"?> <x> <y>Hello</y> </x> and form.xsl: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="UTF-8" method="xml" indent="yes"/> <xsl:variable name="topLevel"> <xsl:variable name="inner" select="'Hi'" /> <xsl:value-of select="$inner"/> </xsl:variable> <xsl:template match="/" > <xsl:value-of select="$topLevel" /> </xsl:template> </xsl:stylesheet> I am using JRE 1.8, and when i transform the XML using javax.xml.transform.Transformer, i get a circular reference error, on the topLevel variable. Circular variable/parameter reference in '[variable(topLevel)] I found out that there is already an issue related to this logged at: JIRA, but am not sure if this has been fixed. There are various workarounds provided but no solutions provided. Note: I have not included any third party jars and am using the default Transformer implementation.
downvote count: 0
has title: Circular variable/parameter reference in a Variable XSLT
has comment: http://stackoverflow.com/comment/42158407
has comment: http://stackoverflow.com/comment/42158499
has comment: http://stackoverflow.com/comment/42158791
has comment: http://stackoverflow.com/comment/42158510
has answer: http://stackoverflow.com/a/72125463
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42158082
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/42158066
has comment: http://stackoverflow.com/comment/42158465
has comment: http://stackoverflow.com/comment/42158048
upvote count: 6
tagged with: xslt
tagged with: java
has comment: http://stackoverflow.com/comment/42158145
has comment: http://stackoverflow.com/comment/42158001

http://stackoverflow.com/comment/42188810
type: Comment
comment on: http://stackoverflow.com/q/26792189
type: QuestionComment
has text: Well if the plugin works fine but the test fails - then the problem lies with the test ;) How did you pick `LightPlatformTestCase` as being the correct test for this situation?
score: 0

http://stackoverflow.com/q/26795053
answer count: 3
has comment: http://stackoverflow.com/comment/42164930
has comment: http://stackoverflow.com/comment/42164583
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26796137
has answer: http://stackoverflow.com/a/26795958
tagged with: java
has comment: http://stackoverflow.com/comment/42165419
tagged with: loops
upvote count: 1
has title: substitution for calling main
has comment: http://stackoverflow.com/comment/42164666
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42164693
has body: I have this problem where I am trying to start the game over if the user says yes, and I always do it by calling main(), but my teacher insists that there are better ways. How do I start the program without calling the main. I assuming you have to use loops but I'm not sure how to use it for this problem. //import library import java.io.*; import java.util.*; //file name public class GuessingGame { //Main method, throws input and output error. public static void main (String [] args) throws IOException { //inputs for random number and switch statements Scanner inRn = new Scanner (System.in); Scanner inSw = new Scanner (System.in); //variables for the loop, random number, character, counter and input int guess=0; int rnd; int num; char decision; //random number generator Random random = new Random(); rnd = random.nextInt(100) + 1; //loops the user input for the guess while (true){ try{ //prompt the user System.out.println(" Please guess a number between 1-100. Press 0 to give up."); num = inRn.nextInt(); } //catches input errors catch (Exception e){ System.out.println("You can only enter numbers!"); inRn.next(); continue; } //if statements if (num==0) { //when user types '0' it ends the program System.out.println("You gave up after " + guess + " try(s) .... Closing program ..."); System.exit(0); } else if (num&gt;rnd) { System.out.println("The number is too big!"); guess++; } else if (num&lt;rnd) { //prints 'too small', adds to counter 'guess' System.out.println("The number is too small!"); guess++; } else { //prints correct, adds to counter, dsiplays # of guesses and ends loop System.out.println("You guessed the right number!!: " + rnd); guess++; System.out.print(" # of guesses: " + guess + " -"); //loops the case untill correct input is chosen either 'Y' or 'N' while(true){ //prompt the user if they want to play again System.out.println(" Would you like to play again? &lt;Y/N&gt;"); decision = inSw.nextLine().charAt(0); //switch statements switch (decision) { case …
score: 0
has answer: http://stackoverflow.com/a/26795550

http://stackoverflow.com/comment/42026925
has text: actually i don't think you building request correctly, maybe you should look on wsdl2java and try invoking client stub which is generated from wsdl, would be much easier for you
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26717514

http://stackoverflow.com/comment/41983366
score: 0
has text: It seems to be a problem in spring integration tcp client pipe. I have succeed cache different exceptions, but the integration has strange behaviour. When the server closes the connection at the first time I catch Socket close exception, but after when server closes connection again I get Read timed out exception again and again. Is it possible ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26691244
type: Comment

http://stackoverflow.com/q/26809967
has answer: http://stackoverflow.com/a/26810024
tagged with: java
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/26819955
type: Question
has title: JScrollPanel is not responding initially
score: -1
answer count: 2
upvote count: 0
favorite count: 0
has body: I wanted to make a chat server client with GUI. Any new messages will be added as a JPanel. Initially messages added to my JScrollPanel is updating smoothly. However when i implemented the server and client to work with the GUI, the first few new messages added are never updated. Messages will only be updated to the JScrollPanel after the third add onward. Some times the adding of components ended prematurely. The client implements runnable so any new messages will be updated to the JScrollPanel via a Thread. It seems like the GUI did not fully initialise. this is the Client code public static void main(String[] args) { new Thread(new MessageClient("htf0001")).start(); MessageGUI dialog = new MessageGUI(collaID); } @Override public void run() { //loop read from server // The default port. int portNumber = 50000; // The default host. String host = "localhost";//"54.169.62.79"; /* * Open a socket on a given host and port. Open input and output streams. */ try { clientSocket = new Socket(host, portNumber); oos = new ObjectOutputStream(clientSocket.getOutputStream()); oos.flush(); ois = new ObjectInputStream(clientSocket.getInputStream()); Staff staff = new Staff(); sendToServer(staff.connectToMessageServer(collaID)); sendToServer(staff.getMessageLog(collaID)); while(!close){ ArrayList&lt;String&gt; input = new ArrayList&lt;String&gt;(); Object o = ois.readObject(); input = (ArrayList&lt;String&gt;) o; if(input.get(0).compareTo("end")!=0){ for(int i=0;i&lt;input.size();i=i+5){ MessageGUI.addMessage(input.get(i),input.get(i+1), input.get(i+2), input.get(i+3),input.get(i+4)); } } else close = true; } oos.close(); ois.close(); clientSocket.close(); } catch (UnknownHostException uhe) { JOptionPane.showMessageDialog(null,uhe.getMessage()); } catch (IOException ioe) { JOptionPane.showMessageDialog(null,ioe.getMessage()); } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(null,ex.getMessage()); } } this is the GUI code part that add in the component public sta…
type: UnansweredQuestion

http://stackoverflow.com/comment/41968698
score: 0
comment on: http://stackoverflow.com/q/26685101
has text: Sure. I'm going to put it as an answer and explain it there :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26809207
accepted answer of: http://stackoverflow.com/q/26807468
has comment: http://stackoverflow.com/comment/42191780
answers question: http://stackoverflow.com/q/26807468
has comment: http://stackoverflow.com/comment/42191440
type: Answer
has comment: http://stackoverflow.com/comment/42191629
downvote count: 0
has comment: http://stackoverflow.com/comment/42191188
has body: Note that you are using two very similarly-named variables in your program. One is tenSecs, whose declaration you've shown us, and the other is tensecs, which you haven't shown, and judging from the error, it is defined as int. It is not a very good practice to use two different variables that are named so closely. Suppose you wanted to keep a variable that represents the integer value of tenSecs. Don't name that variable tensecs, tenSECS or tenSecss or anything like that. The difference is easy to overlook and finding an error like this is very hard. Use a name like tenSecsIntValue or something like that. So, to fix the issue, simply replace that tensecs with tenSecs in your code.
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42122377
comment on: http://stackoverflow.com/q/26711305
type: Comment
type: QuestionComment
score: 0
has text: Seems to me this is a packaging problem. Did you use the maven-shade plugin like Taylor suggested? Your topology looks ok to me at first glance but really this seems like a pom.xml issue.

http://stackoverflow.com/comment/42125560
score: 0
has text: Ah, I see that now, my apologies, I didn't fully understand the question.
type: Comment
comment on: http://stackoverflow.com/q/26772693
type: QuestionComment

http://stackoverflow.com/q/26755318
has comment: http://stackoverflow.com/comment/42106747
downvote count: 0
has answer: http://stackoverflow.com/a/26757417
accepted answer: http://stackoverflow.com/a/26755591
type: Question
has answer: http://stackoverflow.com/a/26755591
score: 1
tagged with: java
tagged with: servlets
answer count: 2
possible better answer: http://stackoverflow.com/a/26757417
upvote count: 1
has comment: http://stackoverflow.com/comment/42096829
tagged with: tomcat
favorite count: 0
has body: I deleted my precedent post to recreate a clearer. For information, I have simplified the code to make it simpler. I present you my problem. My servlet HelloWorld : public class HelloWorld extends HttpServlet { private String message; public void init() throws ServletException { // Do required initialization message = "Hello World"; } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setContentType("text/html"); // session test System.out.println( request.getSession().getId() ); PrintWriter out = response.getWriter(); out.println(" Hello World "); } public void destroy() { // do nothing. } } The servlet display a html page with message HellWorld and include DWR (Direct Web Remoting) javascript files. The DWR javascript files are retrieved from servlet /dwr/. Web.xml : <?xml version="1.0" encoding="UTF-8"?> TestDWR2 HelloWorld test.HelloWorld HelloWorld /HelloWorld/* dwr-invoker org.directwebremoting.servlet.DwrServlet config WEB-INF/dwr.xml debug true dwr-invoker /dwr/* <web-resource-collection> Extranet resource Extranet resources /HelloWorld/* /dwr/* </web-resource-collection> intranet_admin BASIC Extranet Intranet Admin intranet_admin The servlet /HelloWorld and /dwr are securised. The login is based on tomcat user database : <?xml version='1.0' encoding='utf-8'?> <user username="tomcat" password="tomcat" roles="intranet_admin"/> Http request / response : For HelloWorld servlet call For DWR servlet call (engine.js) For DWR servlet call (util.js) For DWR servlet call (_System.pageLoaded.dwr) As you can see the JSESSIONID change for each request and this is my problem I can not solve for some time... I still progress last few days. I know now that the problem only appears when the servlets are secure : <web-resource-collection> Extranet resource Extranet resources /HelloWorld/* /dwr/* </web-resource-collection> If a remove this security, each request return same J…
tagged with: web.xml
has comment: http://stackoverflow.com/comment/42093316
tagged with: jsessionid
has title: Java Servlet - Different JSESSION ID when servlet are securise. Why?
type: AnsweredQuestion

http://stackoverflow.com/comment/42109374
type: QuestionComment
score: 0
has text: Do you think it would be possible to do it without making the program find the form, fill in the form, press enter etc
comment on: http://stackoverflow.com/q/26764153
type: Comment

http://stackoverflow.com/comment/118471399
score: 3
comment on: http://stackoverflow.com/q/26769065
has text: I have noticed the same. onAdClosed is called with a small delay, even in 2021.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26750945
answers question: http://stackoverflow.com/q/26736805
type: Answer
has body: The firewall on master JBoss server was blocking the replication to the master. Issue is resolved. It is worth to read this article in similar cases, it gives more idea on 'remoteObjectPort'.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26736805
score: 1

http://stackoverflow.com/q/26804747
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26804879
has body: I'm struggling with a toast to overcome the empty editText problem. No syntax errors but the app stops unexpectedly. I'm not sure whether the problem comes from the listener or the IF loop. But the calculator works fine apart from the empty editText exception. Thanks !! Here is my 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="com.rayana.calculator.MainActivity" &gt; &lt;TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/button1" android:layout_marginTop="39dp" android:text="Result =" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:layout_alignLeft="@+id/button1" android:layout_marginBottom="31dp" android:text="B =" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/editText1" android:layout_alignLeft="@+id/textView2" android:text="A =" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/editText2" android:layout_alignLeft="@+id/editText2" android:layout_marginBottom="45dp" android:ems="10" android:inputType="numberDecimal" /&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2" android…
type: Question
has title: Errors with a toast on a calculator app
downvote count: 0
has comment: http://stackoverflow.com/comment/42183004
has answer: http://stackoverflow.com/a/26804921
answer count: 3
accepted answer: http://stackoverflow.com/a/26804879
has comment: http://stackoverflow.com/comment/42182736
has comment: http://stackoverflow.com/comment/42184273
tagged with: calculator
tagged with: toast
has comment: http://stackoverflow.com/comment/42182722
favorite count: 0
has answer: http://stackoverflow.com/a/26804842
tagged with: android
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26804842

http://stackoverflow.com/comment/42095749
score: 0
type: Comment
has text: actually this should be a comment to the question rather than an answer.
comment on: http://stackoverflow.com/a/26756297
type: AnswerComment

http://stackoverflow.com/comment/41998370
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26702483
score: 0
has text: What do you expect the request body to map to and why?

http://stackoverflow.com/q/26693938
has comment: http://stackoverflow.com/comment/42513583
has comment: http://stackoverflow.com/comment/42483852
tagged with: raven
tagged with: sentry
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
score: 2
has body: I have been trying to set up logging to getsentry.com on Google AppEngine using Java. I have tried using their projects at https://github.com/getsentry/raven-java. Specifically I have tried setting up java.util.logging (JUL) with their raven module, and adding appengine support using raven-appengine. I would like to know if anyone knows of a way to set up getsentry with appengine? Below is some of what I have tried. Using the configuration logging.properties: handlers = java.util.logging.ConsoleHandler,net.kencochrane.raven.jul.SentryHandler net.kencochrane.raven.jul.SentryHandler.level=WARNING net.kencochrane.raven.jul.SentryHandler.dsn=https://&lt;user&gt;:&lt;password&gt;@app.getsentry.com/&lt;some number&gt; net.kencochrane.raven.jul.SentryHandler.ravenFactory=net.kencochrane.raven.appengine.AppEngineRavenFactory java.util.logging.ConsoleHandler.level=INFO then the development server says that the class net.kencochrane.raven.jul.SentryHandler cannot be found. The question How to add custom log handler to Google App Engine? says to load it in code instead. So I tried that, but all sorts of accesses into the logging framework are disallowed by Google. So I abandoned this as well.
answer count: 0
upvote count: 2
has title: Setting up GetSentry.com with Java on Google AppEngine
tagged with: java
type: Question

http://stackoverflow.com/comment/42071682
type: AnswerComment
comment on: http://stackoverflow.com/a/26736297
score: 0
type: Comment
has text: so are you using this code to update using the product_qty and not the row_id?

http://stackoverflow.com/comment/42133971
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26777022
type: Comment
has text: @BrunoLowagie as you say the NoClassDefFoundError is misleading, the problem was that I had multiple dependecies in my pom.xml files. I solved the problem thanks to Kenneth's suggestion

http://stackoverflow.com/comment/47684385
comment on: http://stackoverflow.com/q/26789748
type: QuestionComment
score: 0
type: Comment
has text: it was causing for a recursive function

http://stackoverflow.com/comment/42009269
type: QuestionComment
comment on: http://stackoverflow.com/q/26708269
has text: Can you connect using a SQL Client? Have you added the jtds jar, what version of jtds, Java are you using?
score: 0
type: Comment

http://stackoverflow.com/a/26684228
answers question: http://stackoverflow.com/q/26684025
has comment: http://stackoverflow.com/comment/41967711
accepted answer of: http://stackoverflow.com/q/26684025
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41978056
has body: You can turn off escape html symbols when printing to out &lt;s:property escapeHtml="false"/&gt;&lt;br&gt;
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42152056
type: Comment
comment on: http://stackoverflow.com/a/26787827
has text: What is your development environment are you using eclipse or netbeans?
type: AnswerComment
score: 0

http://stackoverflow.com/a/26815582
type: Answer
has body: Main is the entry point of your program, whatever you include in it will run. Your program is running it's just not doing anything (except creating a circle). If you want the program to display those messages you need to call display() inside main. public static void main(String[] args) { Circle myCircle = new Circle(); myCircle.display(); }
answers question: http://stackoverflow.com/q/26815552
score: 0

http://stackoverflow.com/comment/41966221
type: QuestionComment
comment on: http://stackoverflow.com/q/26683751
score: 0
type: Comment
has text: remaining time finishs at endBidTime. at 18:30. i didnt add 18:30 in code

http://stackoverflow.com/comment/42095238
has text: This might be helpful for you, [How to clone an Input Stream](http://stackoverflow.com/questions/5923817/how-to-clone-an-inputstream)!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26756467
type: QuestionComment

http://stackoverflow.com/comment/42158001
type: QuestionComment
comment on: http://stackoverflow.com/q/26790924
score: 1
has text: I don't see anything circular in your code and since [it works without any problems in Xalan 2.7.1](http://xsltransform.net/6qVRKvW) it's clearly unrelated to the link in your post.
type: Comment

http://stackoverflow.com/a/26678106
type: Answer
downvote count: 0
has body: No, you go and delete this code and use a ThreadPool instead. What you trying to do is quite hard and you should be using the higher abstraction you have to do multithreading or you don't do it at all. Check out Executors, currently they are the higher abstraction. If your tasks are compute bound then ForkJoin in Java 7 is your friend and you don't need to bother about the pool size as long as you know how to recursively divide your problem into subproblems.
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/26678072
has comment: http://stackoverflow.com/comment/41955771
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26678072
has comment: http://stackoverflow.com/comment/41955950

http://stackoverflow.com/a/26803683
downvote count: 0
score: 1
has body: What you are talking about is called the extension folder. Here are summarized some pros and cons about its usage.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26803427

http://stackoverflow.com/comment/42098037
type: QuestionComment
type: Comment
score: 2
has text: Grumble. It's 2014. It's been the year of the cybercriminal every year now since about 2006. Why do people still write sql-injectable code? Please consider using prepared statements and bind parameters.
comment on: http://stackoverflow.com/q/26757660

http://stackoverflow.com/q/26825796
type: Question
answer count: 1
score: 0
has title: Error while creating XML file in JAVA
has body: Am reading data from MySQL database and writing it to XML file. AM getting following error "HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. " Any Ideas how to solve this private static Document buildCustomerXML(ResultSet _customerRS, ResultSet contractRS) throws Exception { Document xmlDoc = new DocumentImpl(); /* Creating the root element */ Element rootElement1 = xmlDoc.createElement("Contracts"); xmlDoc.appendChild(rootElement1); while(contractRS.next()){ Element contract = xmlDoc.createElement("Contract"); /* Build the CustomerId as a Attribute*/ contract.setAttribute("ID", _customerRS.getString("ID")); rootElement1.appendChild(contract); } Element rootElement = xmlDoc.createElement("Employees"); xmlDoc.appendChild(rootElement); while(_customerRS.next()) { Element employee = xmlDoc.createElement("Employee"); /* Build the CustomerId as a Attribute*/ employee.setAttribute("id", _customerRS.getString("id")); /* Creating elements within customer DOM*/ Element contractid = xmlDoc.createElement("ContractID"); Element lastName = xmlDoc.createElement("Name"); Element skills = xmlDoc.createElement("Skills"); Element skill = xmlDoc.createElement("Skill"); /* Populating Customer DOM with Data*/ contractid.appendChild(xmlDoc.createTextNode(_customerRS.getString("Contractid"))); lastName.appendChild(xmlDoc.createTextNode(_customerRS.getString("last"))); skill.appendChild(xmlDoc.createTextNode(_customerRS.getString("Skill"))); /* Adding the firstname and lastname elements to the Customer Element*/ employee.appendChild(contractid); employee.appendChild(lastName); skills.appendChild(skill); employee.appendChild(skills); /* Appending Customer to the Root Class*/ rootElement.appendChild(employee); } return xmlDoc; }
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26827097
tagged with: java
tagged with: mysql
tagged with: dom

http://stackoverflow.com/q/26776200
has comment: http://stackoverflow.com/comment/42131590
tagged with: android
has comment: http://stackoverflow.com/comment/42131780
has comment: http://stackoverflow.com/comment/42131239
has comment: http://stackoverflow.com/comment/42131103
has comment: http://stackoverflow.com/comment/42131023
has title: JSONArray to String in java
has answer: http://stackoverflow.com/a/26776415
upvote count: 3
has body: I have an JSONArray that looks like this: how can i convert that to a string? if i try: json.toString(); the string is: ["package.package.ChecklistModels.ChecklistAnswer@405dddd8","package.package.ChecklistModels.ChecklistAnswer@405ddf48","package.package.ChecklistModels.ChecklistAnswer@405de070","package.package.ChecklistModels.ChecklistAnswer@405de198","package.package.ChecklistModels.ChecklistAnswer@405de2c0","package.package.ChecklistModels.ChecklistAnswer@405de3e8","package.package.ChecklistModels.ChecklistAnswer@405de510"] but i want something like this: { "json": "values": [ { "answer": "true", "remark":"", "questionId": "0" "checklistId": "2" }, { "answer": "true", "remark":"", "questionId": "0" "checklistId": "2" } ] } EDIT: this a snipped how i make the json array: if(cb.isChecked() || !text.getText().toString().equals("")){ ChecklistAnswer answer = new ChecklistAnswer(questions.get(id).id, 2, cb.isChecked(), text.getText().toString()); answers.add(answer); } } JSONArray json = new JSONArray(answers); String jsonString = json.toString();
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42132280
downvote count: 1
has answer: http://stackoverflow.com/a/26777692
score: 2
has answer: http://stackoverflow.com/a/26776348
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42131721
type: Question
has answer: http://stackoverflow.com/a/26777081
has comment: http://stackoverflow.com/comment/42131820
has answer: http://stackoverflow.com/a/54233459
has comment: http://stackoverflow.com/comment/42131404
tagged with: arrays
has answer: http://stackoverflow.com/a/26776290
answer count: 6
has comment: http://stackoverflow.com/comment/42131990
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/42163185
score: 0
type: AnswerComment
type: Comment
has text: seems like you are using a simple vernam cypher, this could be broken easily. Isn't this a concern or did I understand your answer wrong?
comment on: http://stackoverflow.com/a/26778918

http://stackoverflow.com/comment/41958568
has text: @brso05 I'm guessing it's homework; he hasn't got to Sets yet.
comment on: http://stackoverflow.com/q/26679860
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/122832374
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26743044
has text: @luboskrnac beans have properties, not least of which are name (which can be used with qualifier) and scope. From your answer, it's unclear how items inside the returned list can be assigned name and scope in the ways that spring context would automatically pick up and wire accordingly in other parts of the application

http://stackoverflow.com/comment/42180276
score: 0
comment on: http://stackoverflow.com/q/26789341
type: Comment
type: QuestionComment
has text: I did not downvote you, but whoever did probably did so because your question is overly broad.

http://stackoverflow.com/comment/42251273
comment on: http://stackoverflow.com/q/26775613
type: Comment
type: QuestionComment
has text: sorry sir! but can I know the correct forum to post this SonarQube question?
score: 0

http://stackoverflow.com/comment/42056178
score: 0
type: Comment
has text: Glad it works! I see you're new here - the done thing is to accept an answer when you've got one that is as good as you need.
comment on: http://stackoverflow.com/a/26711709
type: AnswerComment

http://stackoverflow.com/comment/41947956
type: QuestionComment
has text: Do you have any error log?
comment on: http://stackoverflow.com/q/26674192
score: 0
type: Comment

http://stackoverflow.com/comment/41968898
comment on: http://stackoverflow.com/q/26685367
score: 0
type: Comment
has text: [Type erasure](http://docs.oracle.com/javase/tutorial/java/generics/erasure.html). So you can't obtain a type like a variable.
type: QuestionComment

http://stackoverflow.com/a/26759481
downvote count: 0
type: Answer
has body: Both AmazonClientException and AmazonServiceException are derived from RuntimeException. From the Javadoc for RuntimeException: A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26759400
answers question: http://stackoverflow.com/q/26759400
score: 1
has comment: http://stackoverflow.com/comment/42101790
type: AcceptedAnswer

http://stackoverflow.com/comment/42202178
score: 0
type: Comment
has text: let him comment as to if has worked I'll take it back. Gaurav please restart u r eclipse and let us know the results.
type: AnswerComment
comment on: http://stackoverflow.com/a/26815536

http://stackoverflow.com/q/26754725
has comment: http://stackoverflow.com/comment/42092449
has answer: http://stackoverflow.com/a/27284005
score: 8
upvote count: 9
linked to: http://stackoverflow.com/q/21950105
has answer: http://stackoverflow.com/a/26756095
has comment: http://stackoverflow.com/comment/42093543
accepted answer: http://stackoverflow.com/a/26756095
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6139451
favorite count: 0
has title: gluProject Converting 3D coordinates to 2D coordinates does not convert the 2D Y Coordinate correctly
linked to: http://stackoverflow.com/q/724219
has body: After two hours of googling (here, here, here, here, and here, and a ton others which I am not bothered to find), I thought I had finally learnt the theory of turning 3D coordinates to 2D coordinates. But it isn't working. The idea is to translate the 3D coordinates of a ship to 2D coordinates on the screen to render the username of the player controlling that ship. However, the text is rendering in the wrong location: The text is "Test || 2DXCoordinate || 2DZCoordinate". Here is my getScreenCoords() - Which converts the 3D coordinates to 2D. public static int[] getScreenCoords(double x, double y, double z) { FloatBuffer screenCoords = BufferUtils.createFloatBuffer(4); IntBuffer viewport = BufferUtils.createIntBuffer(16); FloatBuffer modelView = BufferUtils.createFloatBuffer(16); FloatBuffer projection = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelView); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection); GL11.glGetInteger(GL11.GL_VIEWPORT, viewport); boolean result = GLU.gluProject((float) x, (float) y, (float) z, modelView, projection, viewport, screenCoords); if (result) { return new int[] { (int) screenCoords.get(0), (int) screenCoords.get(1) }; } return null; } screenCoords.get(0) is returning a perfect X coordinate. However, screenCoords.get(1) is going higher or lower depending on how far away I am from the ship. After many hours of debugging, I have narrowed it down to this line being incorrect: GLU.gluProject((float) x, (float) y, (float) z, modelView, projection, viewport, screenCoords); However, I have no idea what is wrong. The X coordinate of the ship is fine.... Why not the Y? According to BDL's answer, I am supplying the "wrong matrix" to gluProject(). But I don't see how that is possible, since I call the method right after I render my ship (Which is obviously in whatever matrix draws the ship). I just can't fathom what is wrong. Note: BDL's answer is perfectly adequate except that it does not explain why the…
tagged with: glu
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42093828
downvote count: 1
tagged with: opengl
has comment: http://stackoverflow.com/comment/42093562
tagged with: java
tagged with: lwjgl
possible better answer: http://stackoverflow.com/a/27284005

http://stackoverflow.com/comment/42166131
type: Comment
has text: what is return type of **getAllMant()** api, are you sure it is **List<ArrayList<String>>**
type: QuestionComment
comment on: http://stackoverflow.com/q/26795838
score: 0

http://stackoverflow.com/q/26719731
tagged with: in-memory-database
has answer: http://stackoverflow.com/a/26754902
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42052395
score: 0
has comment: http://stackoverflow.com/comment/42052926
has body: How to setup a simple embedded database in a spring(data)+maven project? I need to develop a simple graphical application that read some data files and display pretty stuff about it interactively. The data is very repetitive with a little hierarchical structure. However I still don't know how I will need to access it. For these reasons, I want to store it in a database so that I can later use DB query to access the data with query filter. (it also seems a good idea to develop a persistent layer) Because it is for a little application, I want to use an in-memory DB. I am quite new to java (using proper dev framework) and database. But I worked on a project using spring, spring-data, JPA, etc... I did not really understand how it worked internally and would not be able to setup it up, but I found it very practical. Now, I found lots of docs and tutorial on internet about that, but I didn't understand enough to know how to adapt them to my need. What (I think) I want is: to use maven+spring spring data (I guess) to use Entity, JpaRepository and Autowired stuff an independent program, thus starting from a Application.main method as little and simple dependencies as possible an embedded DB (+fast+light if possible) genericity is nice What I fill to be lost with are: where should I put what properties/xml-declaration how are all the dependencies working together (spring, spring-data, h2, hsqldb, ...) I found this project https://github.com/wrpinheiro/spring-jpa-embedded-db that looks to fit, but: there are way too many dependencies that (I think) I don't need, thus don't want I don't know how to start a program with it I don't get the org.springframework.stereotype.Service thing nor the javax.inject.Inject
tagged with: maven
has title: Simple embedded database with spring
tagged with: spring
type: Question
accepted answer: http://stackoverflow.com/a/26754902
tagged with: java
has comment: http://stackoverflow.com/comment/42050879
tagged with: jpa
answer count: 1

http://stackoverflow.com/a/26821761
type: Answer
has body: One-liner in Java 8: story = Pattern .compile(String.format("(?&lt;=%1$s)|(?=%1$s)", "foo|bar")) .splitAsStream(story) .map(w -&gt; ImmutableMap.of("bar", "foo", "foo", "bar").getOrDefault(w, w)) .collect(Collectors.joining()); Lookaround regular expressions (?&lt;=, ?=): http://www.regular-expressions.info/lookaround.html If the words can contain special regex characters, use Pattern.quote to escape them. I use guava ImmutableMap for conciseness, but obviously any other Map will do the job as well.
upvote count: 12
answers question: http://stackoverflow.com/q/26791441
downvote count: 0
score: 12

http://stackoverflow.com/comment/42027797
comment on: http://stackoverflow.com/q/26718649
score: 0
has text: Yes. It seems that something is off with parsing the JSON and it is not finding the info and adding it to results
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42131983
score: 0
type: QuestionComment
type: Comment
has text: [this](http://stackoverflow.com/questions/10578984/what-is-string-interning) might help you
comment on: http://stackoverflow.com/q/26776753

http://stackoverflow.com/a/26766200
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26765950
answers question: http://stackoverflow.com/q/26765950
has body: Well you can write a method to do this. public static &lt;K, V&gt; Map.Entry&lt;K, V&gt; getEntryByIndex(Map&lt;K, V&gt; map, int i) { if(i &gt;= map.size()) { throw new IndexOutOfBoundsException(String.valueOf(i)); } // use Iterator Iterator&lt;Map.Entry&lt;K, V&gt;&gt; it = map.entrySet().iterator(); // skip to i for(; i &gt; 0; --i) { it.next(); } return it.next(); } This pretty much treats it like a linked list. If you are finding you do this a lot you may want to permanently keep an ArrayList along with the Map.
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/42056533
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26734515
has text: Me too, anyways thanks for your time.
score: 0

http://stackoverflow.com/comment/42201857
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26812994
has text: I haven't used the print line method before but i guess i will learn how to use it, thanks for your answer!
type: Comment

http://stackoverflow.com/q/26785315
downvote count: 0
score: 6
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/59406476
possible better answer: http://stackoverflow.com/a/26785388
upvote count: 6
accepted answer: http://stackoverflow.com/a/26785374
has answer: http://stackoverflow.com/a/26785388
has title: How to overwrite an existing .txt file
tagged with: file
tagged with: java
linked to: http://stackoverflow.com/q/13729625
has answer: http://stackoverflow.com/a/26785373
has answer: http://stackoverflow.com/a/26785362
has body: I have an application that creates a .txt file. I want to overwrite it. This is my function: try{ String test = "Test string !"; File file = new File("src\\homeautomation\\data\\RoomData.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); }else{ } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(test); bw.close(); System.out.println("Done"); }catch(IOException e){ e.printStackTrace(); } What should I put in the else clause, if the file exists, so it can be overwritten?
has answer: http://stackoverflow.com/a/26785374
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/26695221
upvote count: 1
has body: I'll give this a try. It's something that is easier to explain than to understand. The recursive method, on which you have made a decent start, might be documented as follows: "For a given directory: for each file in the directory, count all the lines which contain a given string; for each directory in the directory, recurse". The recursion is possible - and useful - because your original target is a container, and one of the types of things it can contain is another container. So think of the counting method like this: int countLines(dir, string) // the string could be an instance variable, also, and not passed in { var countedLines = 0; for each item in dir: if item is file, countedLines += matchedLinesInFile(item, string); else if item is dir, countedLines += countLines(item, string); else throw up; // or throw an exception -- your choice } then call countLines from an exterior method with the original dir to use, plus the string. One of the things that trips people up about recursion is that, after you get it written, it doesn't seem possible that it can do all that it does. But think through the above for different scenarios. If the dir passed in has files and no dirs, it will accumulate countedLines for each file in the dir, and return the result. That's what you want. If the dir does contain other dirs, then for each one of those, you're going to call the routine and start on that contained dir. The call will accumulate countedLines for each file in that dir, and call itself for each dir recursively down the tree, until it reaches a dir that has no dirs in it. And it still counts lines in those, it just doesn't have any further down to recurse. At the lowest level, it is going to accumulate those lines and return them. Then the second-lowest level will get that total to add to its total, and start the return trips back up the recursion tree. Does that explain it any better?
has comment: http://stackoverflow.com/comment/41985902
type: Answer
has comment: http://stackoverflow.com/comment/41987569
has comment: http://stackoverflow.com/comment/42029217
score: 1
has comment: http://stackoverflow.com/comment/42017868
accepted answer of: http://stackoverflow.com/q/26694816
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26694816
downvote count: 0
has comment: http://stackoverflow.com/comment/41992510
has comment: http://stackoverflow.com/comment/42018166

http://stackoverflow.com/q/26800860
has title: Android Studio 0.8.14 and 64 bit JDK
has body: I downloaded Android Studio Beta v0.8.14 with the Android SDK for Windows from here, however, getting following error message: Now I do have JDK 1.7: Will it only work with 32 bits? If I download a 32 bit JDK I'll have to tinker with JAVA_HOME every time Android Studio is run? Can somebody please help?
score: 0
has comment: http://stackoverflow.com/comment/42175432
has comment: http://stackoverflow.com/comment/42176801
answer count: 2
has comment: http://stackoverflow.com/comment/42175476
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42186043
has answer: http://stackoverflow.com/a/26947553
has comment: http://stackoverflow.com/comment/42175368
tagged with: android-studio
has answer: http://stackoverflow.com/a/26800987
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42175222

http://stackoverflow.com/comment/42210624
type: AnswerComment
score: 0
type: Comment
has text: Thank you very much. Is there anywhere I can get detailed tutorials on this stuff? I figured it was simple but I couldn't find anything searching.
comment on: http://stackoverflow.com/a/26820478

http://stackoverflow.com/q/26757824
tagged with: spring
score: 3
tagged with: builder
has comment: http://stackoverflow.com/comment/42098383
answer count: 0
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42097671
has title: How to use a Builder Pattern with Spring Injection?
tagged with: spring-ioc
tagged with: composition
downvote count: 0
has body: TL;DR: How can I use composition a Builder Pattern with Spring IoC? I am creating a Spring project that populates a table based on distribution parameters for some fields (i.e. 50% of records must be of type A, 40% of type B, 10% of type C; For each type 50% must be of subtype 1, 20% of subtype 2, 10% of subtype 3, etc etc). In order to speed up record creation I have a RecordFactory that calculates the distribution for these parameters and returns a list of RecordBuilder. Each RecordBuilder extends the Callable interface to process and return records concurrently: What I did so far, considering just type A, B and C was to create a TypeABuilder, TypeBBuilder and TypeCBuilder which returned different ProcessorFactory implementations for each type: public class RecordFactory { @Inject private transient TypeABuilder aBuilder; @Inject private transient TypeBBuilder bBuilder; @Inject private transient TypeCBuilder cBuilder; public List&lt;DataBuilder&gt; getBuilders() { // calculates distribution for each type and add the builders accordingly } } But, obviously, this is a bad design. As the project becomes more complex, I'd need to have m x n classes for each possible combination. A better design would be to use composition, create DataBuilders according to the parameters needed. How can I do this without losing the benefits o Spring IoC? Update: I have changed the way the RecordFactory builds ProcessorFactory. Instead of separate Builder objects, I have one Builder object which uses the Builder pattern to create a ProcessorFactory based on my needs: @Component @Scope("prototype") public class Builder { private Type type; private Subtype subtype; public Builder setType(Type type) {` this.type = type; return this; } public setSubtype(Subtype subtype) { this.subtype = subtype; return this; } public ProcessorFactory createFactory() { return new ProcessorFactoryImpl(this); } } public class ProcessorFactoryImpl { @Inject private transient TypeProcessor typeProcessor; @Inject …
has comment: http://stackoverflow.com/comment/42098631
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26754060
tagged with: java
type: Question
tagged with: jsf-2
has body: I'm creating a custom login form using spring security 3.1, primefaces 5.0,jsf 2.0. URL to access application: testing:8080/TEST On loading the application, the login page is displayed. When click on submit, the page hello.xhtml should be displayed.(URL: testing:8080/TEST/welcome). Currently http status 404 is displayed instead of hello.xhtml. I think the issue is related to the URL. Can someone help on this? spring-security.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> <security:http auto-config="true" use-expressions="true"> <security:intercept-url pattern="/login" access="permitAll" /> <security:intercept-url pattern="/loginfailed" access="permitAll" /> <security:intercept-url pattern="/welcome" access="permitAll" /> <security:intercept-url pattern="/admin**" access="hasAnyRole('ROLE_USER')" /> <security:form-login login-page="/login" default-target-url="/welcome" always-use-default-target="true" authentication-failure-url="/login?error" username-parameter="username" password-parameter="password" /> <security:logout logout-success-url="/login?logout" /> </security:http> <security:authentication-manager> <security:authentication-provider> <security:user-service> <security:user name="admin" password="admin" authorities="ROLE_USER" /> </security:user-service> </security:authentication-provider> </security:authentication-manager> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance…
has comment: http://stackoverflow.com/comment/42124642
answer count: 1
has comment: http://stackoverflow.com/comment/42091617
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/42091664
has answer: http://stackoverflow.com/a/26755079
has title: Creating a custom login using spring security
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42096877
tagged with: spring
score: 3
tagged with: primefaces

http://stackoverflow.com/comment/42019573
has text: This could have been a comment!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26714590
type: Comment

http://stackoverflow.com/comment/42110671
type: Comment
has text: @RabiaMairaj it depends on how you implement it, but if you implement it in the most straightforward way, the elements will be added in the same order that they would have been added in your method had it worked
comment on: http://stackoverflow.com/a/26764113
type: AnswerComment
score: 0

http://stackoverflow.com/q/26680656
accepted answer: http://stackoverflow.com/a/26692880
tagged with: parsing
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has body: From my Android application I need to use a RESTful web service that returns me a list of objects in json format. This list can be very long (about 1000/2000 object.). What I need to do is to search and retrive just some of the objects inside the json file. Due to the limited memory of mobile device, I was thinking that using object-binding (using for example GSON library) can be dangerous. Which are the alternatives for solving this problem?
type: Question
has answer: http://stackoverflow.com/a/26692880
has answer: http://stackoverflow.com/a/26681449
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26681449
has title: Alternatives to JSON-object binding in Android application

http://stackoverflow.com/q/26781173
tagged with: apache-servicemix
type: UnansweredQuestion
tagged with: jetty
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26785616
has body: I'm trying to run an embedded jetty instance from an OSGi server. When the server starts I can see the following in the log: Started o.e.j.w.WebAppContext@1f437060{/browser,bundle://201.0:24/browser,AVAILABLE} The first request is successful but later requests will result in a stack trace, e.g. WARN | ResourceCache | Could not load bundle://201.0:24/browser/index.html true 1415275444922 java.nio.HeapByteBuffer[pos=0 lim=9 cap=9] java.nio.HeapByteBuffer[pos=0 lim=29 cap=29] WARN | ResourceCache | java.io.FileNotFoundException: \browser\index.html (Det går inte att hitta sökvägen) at java.io.RandomAccessFile.open(Native Method)[:1.8.0_20] at java.io.RandomAccessFile.&lt;init&gt;(RandomAccessFile.java:243)[:1.8.0_20] at org.eclipse.jetty.util.BufferUtil.readFrom(BufferUtil.java:408)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.server.ResourceCache.getIndirectBuffer(ResourceCache.java:296)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.server.ResourceCache$Content.getIndirectBuffer(ResourceCache.java:478)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.server.ResourceCache$Content.getInputStream(ResourceCache.java:525)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.server.HttpOutput.sendContent(HttpOutput.java:427)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.server.HttpOutput.sendContent(HttpOutput.java:345)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.servlet.DefaultServlet.sendData(DefaultServlet.java:887)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:493)[201:com.test.mybundle:1.0.0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)[201:com.test.mybundle:1.0.0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)[201:com.test.mybundle:1.0.0] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505)[201:com.test.mybundle:1.0.0] at org.eclipse.jett…
score: 0
tagged with: osgi
answer count: 1
has title: Jetty + OSGi results in strange cache errors

http://stackoverflow.com/q/26759646
downvote count: 4
upvote count: 0
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/42100816
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42100703
has body: "Is this statement correct? it cannot pass my JUnit test!!!" What is wrong with my statement? It doesnt pass the JUnit test. String sqlStringLockWithIP = "UPDATE ACCOUNTS SET " + "LOCKSTATE = "+1+" , " + "IPADDRESS = "+ipAddress+" WHERE ID = " + id;
has comment: http://stackoverflow.com/comment/42143214
tagged with: java
score: -4
type: Question
has title: Java sqlite update statement
has comment: http://stackoverflow.com/comment/42100657
has answer: http://stackoverflow.com/a/26759705
has comment: http://stackoverflow.com/comment/42100834

http://stackoverflow.com/comment/42167953
comment on: http://stackoverflow.com/q/26796986
has text: Do you know what `replaceAll` does?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/26702449
downvote count: 0
answers question: http://stackoverflow.com/q/26702315
type: Answer
has body: Within this code if (c.moveToFirst()){ long temp; temp = c.getLong(c.getColumnIndex(KEY_ROWID)); rowID = String.valueOf(temp); Log.i("----_ROW ID = ", rowID); }else if (!c.moveToFirst()) Log.i("CURSOR ERROR", " CURSOR INDEX MOST LIKELY 0"); else c.moveToFirst(); you might end up never assigning anything to rowID and if you declared it simply String rowID; not String rowID = new String(); it stays null. Is this a possibility ?
upvote count: 1
score: 1

http://stackoverflow.com/q/26702553
tagged with: android
has comment: http://stackoverflow.com/comment/41999685
has comment: http://stackoverflow.com/comment/42000438
answer count: 0
tagged with: java
tagged with: image-processing
has body: I'm trying to solve a linear system on Android platform to perform some image processing. (OpenGL or Java Matrix). Currently i have a 4x4 matrix and 4x1 vector represented as Matrix4f and Float4f respectively. I want to divide them and save the output vector. I need to use a Matrix because later i'll draw on the device screen a picture transformed by a matrix i'll generate from that vector result. I could't find how to multiply the two on Android. Already saw answers suggesting using a third party library ( JScience library ), but i prefer not to do so, only as a last resort. Thanks.
type: Question
tagged with: linear-algebra
score: 0
has title: How can i calculate a linear system using Matrix on Android?
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/42725257
type: UnansweredQuestion

http://stackoverflow.com/comment/42169342
has text: @PankajKumar - My confusion is `double d = 1.13452289575668E8;` should become `1.13` ?
comment on: http://stackoverflow.com/q/26797574
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26819417
has body: toArray method will return the array of elements in the order they were inserted to stack. If you need the elements in LIFO use the pop method. You can go through Stack api here, http://docs.oracle.com/javase/6/docs/api/java/util/Stack.html
score: 1
answers question: http://stackoverflow.com/q/26819240
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42064136
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26737290
has text: This wont work properly if both Test and AnotherTest exist in the same application context. See my answer for details

http://stackoverflow.com/q/26687588
upvote count: 3
tagged with: java
tagged with: web-applications
accepted answer: http://stackoverflow.com/a/26687713
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/21045007
has title: How to read manifest.mf from *.war/META-INF/MANIFEST.MF file?
answer count: 1
has body: Using maven get compiled *.war file, which contains: - META-INF - - MANIFEST.MF - WEB-INF - - classes - - lib - - web.xml Using java.util.jar.Manifest I want to read the manifest file to get application version from there like in https://stackoverflow.com/a/21046257/1728511 But Application.class.getResourceAsStream("/META-INF/manifest.mf") returns null. Application.class.getResource( "" ).getFile() returns %WAR%/WEB-INF/lib/javax.ws.rs-api-2.0.jar!/javax/ws/rs/core/ Using Spring, I've implemented ApplicationContextAware interface to get ApplicationContext instance. And applicationContext.getClassLoader().getResourceAsStream( "" ) returns %WAR%/WEB-INF/classes. But I don't need WEB-INF, I need META-INF directory. How to get it?
favorite count: 0
has comment: http://stackoverflow.com/comment/41972606
has answer: http://stackoverflow.com/a/26687713
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/41972742
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/26778346
accepted answer of: http://stackoverflow.com/q/26778288
upvote count: 1
type: Answer
has body: You can use SampleReflection.class.getDeclaredFields(), iterate over the result and filter by name. Then call field.get(null) to get the value of the static fields. If you want to access non-public fields as well you might have to call first.setAccessible(true) (provided the security manager allows that). Alternatively you could have a look at Apache Common's reflection utilities, e.g. FieldUtils and the like. Depending on what you actually want to achieve there might be better approaches though, e.g. using a map, enums etc. In your case where you have static fields using an enum might be a better way to go. Example: enum SampleFields { TWO_name("html"), TWO_find("css"), ONE_KEY_java("java"), ONE_KEY_jsp("jsp"); ONE_KEY_oracle("oracle"), ...; private String value; private SampleFields(String v) { value = v; } } Then iterate over SampleFields.values() and filter by name. Alternatively, if that fits your needs, you could split the names and pass a map to the enum values, e.g. enum SampleFields { TWO(/*build a map "name"-&gt;"html","find"-&gt;"css")*/ ), ONE_KEY(/*build a map "java"-&gt;"java","jsp"-&gt;"jsp", ...*/); private Map&lt;String, String&gt; values; private SampleFields(Map&lt;String, String&gt; map) { values = map; } } Then get the enum values like this: SampleFields.valueOf("ONE_KEY").get("java")
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26778288

http://stackoverflow.com/a/26799402
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26798990
answers question: http://stackoverflow.com/q/26798990
has body: Try the following: public int compare(Viewer viewer, Object e1, Object e2) { Person p1 = (Person) e1; Person p2 = (Person) e2; int rc = 0; if(!p1.getFirstName().equals(p2.getFirstName())) { rc = p1.getFirstName().compareTo(p2.getFirstName()); }else if(!p1.getLastName().equals(p2.getLastName())) { rc = p1.getLastName().compareTo(p2.getLastName()); }else if(!p1.getGender().equals(p2.getGender())) { rc = p1.getGender().compareTo(p2.getGender()); }else if(!p1.isMArried==p2.isMarried) { rc = (p1.isMarried() ? 1 : -1); }else rc=0; return rc; }
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26714110
accepted answer: http://stackoverflow.com/a/26715029
tagged with: mysql
has title: Storing JsonObject into JsonArray & JsonException error message
has comment: http://stackoverflow.com/comment/42018787
type: Question
has comment: http://stackoverflow.com/comment/42019727
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42020338
score: 0
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/26715029
linked to: http://stackoverflow.com/q/26715533
has comment: http://stackoverflow.com/comment/42018915
has body: I am having some problem when trying to return the data fetched from MySQL as JSON in my Java Web Service: public String getAllEvent() { JSONArray jsonArray = new JSONArray(); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/mydb", "root", "root"); PreparedStatement statement = con .prepareStatement("SELECT * FROM event"); ResultSet result = statement.executeQuery(); while (result.next()) { JSONObject eventInfo = new JSONObject(); eventInfo.put("eventID", result.getString("eventID")); eventInfo.put("eventName", result.getString("eventName")); eventInfo.put("eventDesc", result.getString("eventDesc")); eventInfo.put("eventDate", result.getString("eventDate")); eventInfo.put("eventTime", result.getString("eventTime")); eventInfo.put("eventX", result.getString("eventX")); eventInfo.put("eventY", result.getString("eventY")); eventInfo.put("eventBy", result.getString("eventBy")); jsonArray.put(eventInfo); } String jsonStr = jsonArray.toString(); return jsonStr; } catch (JSONException je) { return null; } catch (Exception exc) { System.out.println(exc.getMessage()); } return jsonArray.toString(); } There are two errors message, one is at the jsonArray.put(eventInfo); with error message: The method put(JSONObject) is undefined for the type JSONArray The other one was with the JSONException: JSONException cannot be resolved to a type Any ideas? I've to import json-simple-1.1.jar into my project as external libraries, if not the JSONObject will get an error message of unresolved type. Thanks in advance.
type: AnsweredQuestion

autowired
tags question: http://stackoverflow.com/q/26757690
tags question: http://stackoverflow.com/q/26777580
tags question: http://stackoverflow.com/q/26829490
type: Tag
tags question: http://stackoverflow.com/q/26718746
tags question: http://stackoverflow.com/q/26829706
tags question: http://stackoverflow.com/q/26777207
tags question: http://stackoverflow.com/q/26730388
tags question: http://stackoverflow.com/q/26744962
tag name: autowired

http://stackoverflow.com/comment/42267768
has text: Beautiful, but hits the ground when an input file of 100 mb is supplied.
score: 0
comment on: http://stackoverflow.com/a/26791826
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42108266
type: QuestionComment
comment on: http://stackoverflow.com/q/26762905
has text: Okay world's tiniest tester/proof program coming for you!
score: 0
type: Comment

http://stackoverflow.com/comment/41997493
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26701998
has text: So how would i fix my code to basically get it to run like i want? Very new to programming so i don't understand your answer too much.

http://stackoverflow.com/q/26776703
has body: Second programming class So we have been tasked with a linked list, building each method from scratch. Well I started on this day before yesterday and had a null pointer exception, I figured id iron it out later and continued. Well after cutting my program down to nothing to find the culprit im left with code that SHOULD work as its copied from our lab (that worked). If you guys think you can figure out why im getting a null pointer exception on my add method id greatly appreciate it and see if im doing the second constructor correctly. If I can get SOME traction on this to get started it would go allot easier but as is I cant even begin. You will notice allot of blank methods, ill get to them once I can get my constructor + add method working My code: import java.util.Collection; import java.util.Iterator; /** * Created by hhhh on 11/2/2014. */ public class Lset&lt;R&gt; implements Set151Interface&lt;R&gt; { private Node head; private int length; /**In the first (following) constructor im trying to re use code and call my clear method. *Should save space and make code look cleaner. */ public Lset(){ clear(); } public Lset(Collection&lt;? extends R&gt; list){ this(); for (R object : list) { add(object); } } /** * Copied from Lab7, this add method checks to see if there are more nodes than just the head. * After the check if false, creates a new node and adds it to the end of the list. * @param entry * @return */ @Override public boolean add(R entry) { Node newNode = new Node(entry); // empty list is handled differently from a non-empty list if (head.next == null) { head = newNode; } else { Node lastNode = getNodeAt(length - 1); lastNode.next = newNode; } length++; return true; } @Override public void clear() { this.length = 0; this.head = null; } @Override public boolean contains(Object o) { return false; } @Override public Iterator&lt;R&gt; iterator() { return null; } @Override public boolean containsAll(Collection&lt;?&gt; c) { return false; } @Override public boo…
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26790433
tagged with: java
has title: Trying to get this linked list started
has comment: http://stackoverflow.com/comment/42131948
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26776791

http://stackoverflow.com/comment/42050972
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26731794
score: 0
has text: Hmm...maybe with Java 8 where you can provide default methods for interfaces. Because a class can implement more than one interface we have something like multiple inheritance.

http://stackoverflow.com/comment/42198953
type: Comment
comment on: http://stackoverflow.com/a/26813516
type: AnswerComment
has text: No? `// ccceeeggggddddc` `// egdc` `// cdge`
score: 0

http://stackoverflow.com/a/26730402
has body: In REST Services you can pass a parameter in two ways. as path variables As a query argument. Example: GET /students/tom or GET /students?name=tom
type: Answer
has comment: http://stackoverflow.com/comment/42049431
has comment: http://stackoverflow.com/comment/42053024
has comment: http://stackoverflow.com/comment/42055593
has comment: http://stackoverflow.com/comment/42054871
has comment: http://stackoverflow.com/comment/42055028
score: 0
answers question: http://stackoverflow.com/q/26730059

http://stackoverflow.com/q/26697849
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26697855
type: UnansweredQuestion
has body: /* I creates an Employee class, and one instance variable A, and I've overridden toString() method. I created a test class in which I create a `List` of `Employee` type. After creating `Employee` object `obj`, I initialized `A` variable using `obj.A=10` and added this obj into the `List` with `add(obj)`. In the next line I initialized `obj.A=13` and added into the list with `add(obj)`. This way I added a different value to the list. When I iterateover the List to display it, I see only the last value multiple times. Why is that? What should I do if I want to save different values using a single object and a single instance variable?*/ package com.swt; /** * * @author RISHI */ public class Employee { public int a; Employee () {} public int getA() { return a; } public void setA(int a) { this.a = a; } @Override public String toString() { return "Employee{" + "a=" + a + '}'; } } package com.swt; import java.util.ArrayList; import java.util.List; public class EmployeTest { public static void main(String[] args) { List&lt;Employee&gt; al=new ArrayList&lt;Employee&gt;(); Employee obj=new Employee(); obj.a=10; al.add(obj); obj.a=13; al.add(obj); obj.a=15;`enter code here` al.add(obj); for(Employee e:al) { System.out.println("your list iteam value is"+e); } }
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26697862
has comment: http://stackoverflow.com/comment/41990036
score: -1
has title: Saving same value of an object in a List
answer count: 2
has comment: http://stackoverflow.com/comment/41990082

http://stackoverflow.com/comment/42203904
score: 0
type: AnswerComment
has text: no problem with the static Vector in the abstract class?
type: Comment
comment on: http://stackoverflow.com/a/26816647

http://stackoverflow.com/comment/42081483
has text: but they have a value of 2 once I input 2. Right?
type: Comment
comment on: http://stackoverflow.com/a/26748486
type: AnswerComment
score: 0

http://stackoverflow.com/a/49765795
answers question: http://stackoverflow.com/q/26825306
type: Answer
has body: I know this question is so old, but till now not have accepted answer. as your note: EDIT: Previous number was 123-456-7890. The number I had before was larger than the 2.1 billion that java can handle. 987-654-3210 is a better example. so, please use Long.valueOf(str) instead of Integer.parseInt(str) or Integer.valueOf(str) hope this help u all :)
score: 0

http://stackoverflow.com/q/26825497
has comment: http://stackoverflow.com/comment/42219513
has comment: http://stackoverflow.com/comment/42219482
has comment: http://stackoverflow.com/comment/42219502
accepted answer: http://stackoverflow.com/a/26825510
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26825510
linked to: http://stackoverflow.com/q/18093928
has body: I've the java class: package com.server.main; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class Main { public static void main(String args[]) throws Exception{ ServerSocket server = new ServerSocket(12345); Socket client = server.accept(); PrintWriter writer = new PrintWriter(client.getOutputStream()); writer.write("Hello from server"); } } Now I'm trying to compile and run it. What I do is: javac Main.java It's OK, Main.class is produced. Now, according to that post, I was trying to run that program: java -cp C:\Users\workspace\Tests\src\com\server\main Main java -cp C:\Users\workspace\Tests\src\com\server\main Main.class java -cp . Main java -cp . Main.class All these produce the output: Error: Could not find or load main class Main What's wrong?
has comment: http://stackoverflow.com/comment/42219521
possible better answer: http://stackoverflow.com/a/26825508
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/27989825
tagged with: java
has answer: http://stackoverflow.com/a/26825508
has title: Error: Could not find or load main class Main
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42214594
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26822651
has text: Make a copy of `t` when adding it to `tt`
score: 0

http://stackoverflow.com/comment/42186255
type: QuestionComment
has text: Also, you could have found this in the [javadocs](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26806596

http://stackoverflow.com/q/26769687
tagged with: java
has title: Sending BufferedImage over server to another java client
type: UnansweredQuestion
has body: I am attempting to send a BufferedImage over a socket sever to another client. Ill post my code below. When I run the server and the connect to the server with the sending client, and receiving client, everything just sits there. The server shouldn't even be receiving anything unless it has already printed "name is attempting to connect to: " which it doesn't it just sits there. I don't know why it doesn't do anything at all. Client that sends: http://pastebin.com/X4z55Hdp Client that receives: http://pastebin.com/MB9qEyGy Server Source that sends and recieves: package core; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.Socket; import utilities.Tools; public class Node implements Runnable { private String name; private Socket socket; private boolean isApp; public Node(Socket s, String name) { this.setName(name); this.setSocket(s); } public String getName() { return name; } public void setName(String name) { this.name = name; } public Socket getSocket() { return socket; } public void setSocket(Socket socket) { this.socket = socket; } public void run() { while (true) { try { BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); if (in.readLine() != null) { // Tools.log("[INPUT] " + in.readLine()); String i = in.readLine(); if (i.contains("set name ")) { String n = i.replace("set name ", ""); Tools.log("Changing " + name + " to " + n); this.name = n; if (n.contains("_app")) { this.isApp = true; } } else { String toFind = name + "_app"; if (isApp) toFind = name.replace("_app", ""); Tools.log(name + " is attempting to connect to: " + toFind); for (Node n : Server.nodes) { if (n.getName().equals(toFind)) { Tools.log(n.getName() + " found, sending data"); ObjectOutputStream outTo…
favorite count: 0
type: Question
tagged with: sockets
has answer: http://stackoverflow.com/a/26770769
has answer: http://stackoverflow.com/a/26769764
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42119852
tagged with: server

http://stackoverflow.com/q/26686566
has body: I want to have an input file with a format like this: ArrayName Value where ArrayName is the name of the array that you want to store the value in. Each line of input can be stored in a new or an existing array. The problem I have is that I don't know how to take the ArrayName from the file and create an array out of it. Or if the array already exists I'm not sure how to store the value into the array with that name.
has answer: http://stackoverflow.com/a/26686602
type: Question
has title: Is there a way to store data into an array from an input file where the name of the array is given in the file?
score: 0
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/26686587
tagged with: file-io
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/26696275
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/28877021
type: Question
has answer: http://stackoverflow.com/a/26696415
tagged with: java
tagged with: hibernate
tagged with: wildfly-8
has title: Wildfly Greeter quickstart project
answer count: 2
tagged with: jpa
downvote count: 0
has body: The 'greeter' is a quickstart project in WildFly 8 to demonstrate basic hibernate database and JPA functionality as a tutorial. In the project, I don't understand when and how the "USERS" database is created in H2 database. These are two relevant files for database creation and setting: META-INF/persistence.xml java:jboss/datasources/GreeterQuickstartDS <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <property name="hibernate.show_sql" value="false" /> WEB-INF/greeter-quickstart-ds.xml jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1 h2 sa sa /wildfly-greeter/src/main/resources/import.sql INSERT INTO USERS (ID, USERNAME, FIRSTNAME, LASTNAME) VALUES (-1, 'jdoe', 'John', 'Doe'); INSERT INTO USERS (ID, USERNAME, FIRSTNAME, LASTNAME) VALUES (-2, 'emuster', 'Erika', 'Mustermann'); By default, the H2 database system does not come with a USERS database, which is used by the demo. So how the "USERS" is created in this demo project? Thanks.
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26830108
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42227492
has body: I am new in JUnit and I found a lot of examples in web, but all of them show me a class of tests, where they start in sequence. I have the follow test class: public class ControlServiceTest { @Test public void testCreateUser() { //some stuff } @Test public void testLoginUser() { //some stuff } } But i need to start only one test at same time, not both. I will be glad if somebody explain me how can I do it.
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26830266
has title: How to start JUnit tests separately?
type: Question
has comment: http://stackoverflow.com/comment/42227260
accepted answer: http://stackoverflow.com/a/26830266
tagged with: junit
answer count: 1

http://stackoverflow.com/q/26826543
has title: Java: how to pass Class to lambda
type: AnsweredQuestion
tagged with: java
has body: I try to make create multi dirs and files more easier with follwoing code: package ro.ex; class File { public interface Lamb { public void call(Class c); } public static void tap(Lamb l) { l.call(File.class); } public static void mkdir(String path) { } public static void main(String[] args) { File.tap((f) -&gt; { f.mkdir("dir"); f.mkdir("dir2"); }); } } but in f.mkdir("dir"), intellij idea raise can't resolve method 'mkdir' my question is: how to change code to make code in main block work well
type: Question
has answer: http://stackoverflow.com/a/26826600
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26826592
has answer: http://stackoverflow.com/a/26826592
has comment: http://stackoverflow.com/comment/42271514
accepted answer: http://stackoverflow.com/a/26826600
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/comment/42416621
score: 0
type: Comment
has text: Do you mean call getRegisteredHandlers and then add my custom formatter to each of them?
comment on: http://stackoverflow.com/a/26767372
type: AnswerComment

http://stackoverflow.com/q/26685101
has comment: http://stackoverflow.com/comment/41968339
has comment: http://stackoverflow.com/comment/41968299
tagged with: java
has comment: http://stackoverflow.com/comment/41968313
answer count: 2
has answer: http://stackoverflow.com/a/26685385
downvote count: 0
has body: I am trying to make a calculator app. I have a outer linearlayout which is vertical orientation and then have nested linear layouts which have a horizontal orientation where my buttons will go. Only the last nested linear layout is not adjusting the width properly of the buttons as I want the '0' button to take half the width and the '.' and '=' button to take a quarter of the width. I gave the '=' button a layout weight of 0.5 and the '.' & '=' button a layout weight of 0.25 but it still won't work properly. Here is a screenshot of the graphical layout: XML code: <TextView android:text="0" android:layout_width="wrap_content" android:layout_weight = "0.25" android:layout_height="0dp" android:textSize="40sp" android:layout_gravity="right" android:textColor="#FFFFFF" android:id="@+id/tvDisplay"/> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="0.15" android:orientation="horizontal"
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26777503
tagged with: android-layout-weight
tagged with: android
type: UnansweredQuestion
has title: layout_weight not adjusting size properly
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41968698

http://stackoverflow.com/comment/42051748
type: AnswerComment
score: 0
type: Comment
has text: @letsjak WTF did i just read...yes i know what you mean, but no you are not able to pause a loop
comment on: http://stackoverflow.com/a/26732142

http://stackoverflow.com/comment/42207439
type: Comment
comment on: http://stackoverflow.com/a/26817811
has text: getLength() gives the number of "rows" in the XML document, not the attributes within each row. Sorry, I don't know the correct XML terminology, but I hope it is clear what I mean.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42186831
score: 0
type: Comment
has text: Have to go now, will post back tomorrow if I still haven't figured it out - appreciate the help mate, thankyou
comment on: http://stackoverflow.com/a/26805977
type: AnswerComment

http://stackoverflow.com/q/26750946
has title: Null Pointer Exception error while creating array of files
has body: Inside the for loop, depending on if condition, files need to be created every time. While executing the code, NullPointerException pops up. File[] tempDir=null; for( ) { if(condition){ try { tempDir[l]=new File(tempFileName); if(l==0){ tempDir[l++].mkdir(); /*code*/ } if (!tempDir[l].exists()){ tempDir[l++].mkdir(); /*code*/ } } }
upvote count: 0
has answer: http://stackoverflow.com/a/26750962
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
downvote count: 1
has answer: http://stackoverflow.com/a/26751138
linked to: http://stackoverflow.com/q/218384
tagged with: java
linked to: http://stackoverflow.com/q/1938101
score: -1
type: Question
answer count: 2
tagged with: arrays
favorite count: 0
tagged with: file-io

http://stackoverflow.com/a/26816060
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42212864
has body: In my experience, this could very well just be your OS/filesystem/storage appliance/etc issue, or the application your using to view the file size, not retrieving/replicating/updating file metadata...and the data might actually be there. The file system may only replicate/report metadata after your write lock is released, for example. When you open the file (read-only) while the application is running, do you see data, despite the reported file size?
type: Answer
has comment: http://stackoverflow.com/comment/42204656
accepted answer of: http://stackoverflow.com/q/26676331
has comment: http://stackoverflow.com/comment/42253160
has comment: http://stackoverflow.com/comment/42207881
score: 0
answers question: http://stackoverflow.com/q/26676331

http://stackoverflow.com/a/26689553
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26688902
has body: You can solve this problem like this: Let M be the largest number in the NxN integer matrix A. Define a new N*N matrix B where b[i,j] = M - a[i,j] + 1. B contains only positive integers. The traversal method corresponds to a certain well-defined directional graph on the cells of the matrix. Now use the dijkstra algorithm on this graph, where the distances of each node to the three (or two in the cases on the edges) nodes above is simply equal to the number b[i,j]. The dijkstra algorithm will give you the 'shortest' path in this graph, which corresponds to the path with the largest sum in the matrix A. To see why the problem can be solved in this way, suppose there are x sequences s1, s2, s3, ..., sx of equal length N. Some sequence si will have the largest sum. If we take sequences t1, t2, ..., tx so that t1k = -s1k, then the largest sum s is the smallest sum t. If we then add a constant to each of the values in each sequence then the t sequence with the largest sum does not change, for each of these sequences is equally long.

http://stackoverflow.com/comment/42000168
type: QuestionComment
has text: @Tom, I rescind my earlier comment about your comment being the correct answer. It should be `input <= 0 || input >= 5`. No need to change the `||` to `&&`, because Harbinger wants the loop to keep repeating while the input is INVALID, not while it's VALID.
score: 0
comment on: http://stackoverflow.com/q/26703347
type: Comment

http://stackoverflow.com/q/26773310
possible better answer: http://stackoverflow.com/a/26773350
downvote count: 0
linked to: http://stackoverflow.com/q/8559092
has answer: http://stackoverflow.com/a/26773350
accepted answer: http://stackoverflow.com/a/26773456
has answer: http://stackoverflow.com/a/26773407
has body: I'm trying to add a string to an array of array lists. ArrayList&lt;String&gt;[] test = (ArrayList&lt;String&gt;[]) new ArrayList[2]; test[0].add("Hello World!"); When the code above is executed, a null pointer exception is thrown. Any ideas how this can work?
favorite count: 0
has title: How to add an item to an array of array list
answer count: 4
upvote count: 2
has answer: http://stackoverflow.com/a/26773355
has answer: http://stackoverflow.com/a/26773456
score: 2
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/26784107
has comment: http://stackoverflow.com/comment/42145106
answers question: http://stackoverflow.com/q/26783919
has comment: http://stackoverflow.com/comment/42146620
has comment: http://stackoverflow.com/comment/42145449
upvote count: 4
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26783919
has body: I want to know whether there is a way to re-initialize a declared global variable as a constant later after using it as a variable... No, there isn't. (Java also doesn't have global variables; looking at your code, x and y are instance data members. The closest thing Java has to global variables are public static [aka "class"] data members in public classes.) That is because after doing some work with a declared variable I want to use it in a Switch case statement... You can't if the case values (a.x, in your case) aren't constants. Instead, you have to use if/else if/else: class A { int x; int y; public static void main(String args[]) { A a = new A(); System.out.println(a.x); a.y = 3; if (a.y == a.x) { // ... } else if (a.y == something_else) { // ... } else { // ... } } }
type: Answer

http://stackoverflow.com/a/26686628
has comment: http://stackoverflow.com/comment/41971936
has body: Not sure if I'm understanding your question right, but you're trying to use String.valueOf() to get something and add it to an integer array? The valueOf() returns a String. If you want the integer, use something like Integer.parseInt(String).
answers question: http://stackoverflow.com/q/26686581
score: 0
type: Answer

http://stackoverflow.com/comment/41987589
type: AnswerComment
comment on: http://stackoverflow.com/a/26696170
has text: The above modified code meets your requirements and is simpler too.
type: Comment
score: 0

http://stackoverflow.com/q/26766492
upvote count: 1
tagged with: restriction
answer count: 1
favorite count: 0
has title: Access Restriction to audio
type: AnsweredQuestion
tagged with: audio
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26766783
accepted answer: http://stackoverflow.com/a/26766783
type: Question
has body: I'm just trying to do a simple program here so that i can try to include it on a game. package practs; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import sun.audio.*; import javax.swing.JButton; import javax.swing.JFrame; public class Project1{ public static void main(String[] args){ JFrame frame = new JFrame(); frame.setSize(200,200); frame.setLocationRelativeTo(null); JButton button = new JButton("Click me"); frame.add(button); button.addActionListener(new AL()); frame.setVisible(true); } public static class AL implements ActionListener{ public final void actionPerformed(ActionEvent e){ music(); } } public static void music(){ AudioPlayer MGP = AudioPlayer.player; AudioStream BGM; AudioData MD; ContinousAudioDataStream loop = null; try{ InputStream test = new FileInputStream("backgroundMusic.m4a"); BGM = new AudioStream(test); AudioPlayer.player.start(BGM); MD = BGM.getData(); loop = new ContinousAudioDataStream(MD); }catch(FileNotFoundException e){ e.printStackTrace(); }catch(IOException error){ error.printStackTrace(); } MGP.start(loop); } } The problem is, is that all the errors,(except ContinousAudioDataStream): Access restriction: The type 'AudioPlayer' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/rt.jar') These errors occur to AudioPlayer AudioStream AudioData This is what happens to ContinousAudioDataStream ContinousAudioDataStream ContinousAudioDataStream cannot be resolved to a type

http://stackoverflow.com/comment/42061683
type: QuestionComment
has text: hmmm can't u use String.contains("student") for each entry?
comment on: http://stackoverflow.com/q/26737802
score: 0
type: Comment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/26677239
tag name: maven-jaxb2-plugin

http://stackoverflow.com/q/26703105
answer count: 1
tagged with: user-interface
has title: How to make responsive MVP Swing GUI in Java?
tagged with: mvp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26703145
tagged with: swing
has body: I have an application that is built on passive MVP architecture using Swing in Java 7. My Presenter class does some time-consuming tasks and my View/GUI just calls the presenter's methods after an event. The presenter calls view's methods to update GUI. Obviously, I don't want the long-running tasks to happen on EDT. My first thought was to use a SwingWorker, but since it has only one doInBackground method, I think I would have to implement a SwingWorker for every single one method in Presenter. Or would I? Is there a simple way to make View/GUI run on EDT and everything else (i.e. Presenter's logic without it's calls to update View) on another (worker) thread?
tagged with: java
type: Question
tagged with: swingworker
score: 0

http://stackoverflow.com/comment/42093285
has text: Sure, just remove "&diagnostics=true", there will be less information.
comment on: http://stackoverflow.com/a/26701599
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/26803155
has body: Asymmetric means you cannot use the same key for decryption that you used for encryption. Code signing is one scenario where you encrypt using the private key. Recipients of the code can then use their public key to verify if the code was unchanged.
upvote count: 3
answers question: http://stackoverflow.com/q/26803003
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/42180682
has comment: http://stackoverflow.com/comment/42208844
type: Answer

http://stackoverflow.com/a/26729024
has body: JarFile jarFile = new JarFile("path/to/jarFile.jar"); InputStream inputStream = jarFile.getInputStream(jarFile.getEntry("path/inside/the/jar/to/propFile.properties")); Properties properties = new Properties(); properties.load(inputStream);
answers question: http://stackoverflow.com/q/26728317
type: Answer
score: 0

http://stackoverflow.com/comment/42209517
has text: @ElliottFrisch That's a good option, I can use that method as well, but since I already started with this I'm interested where is my mistake.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26819914

http://stackoverflow.com/q/26824236
has answer: http://stackoverflow.com/a/26824313
answer count: 1
tagged with: variables
favorite count: 0
tagged with: arraylist
tagged with: android
downvote count: 1
has body: I met this type of error when creating a new class. Below was my code: package com.example.opener.test; import java.util.ArrayList; import Product.Product; public class ProductMgrStubs { /* Attribute */ byte[] image1 = new byte[]{6,7,5,6,5}; Product product1 = new Product("Product 1", image1, "Product 1", 0); ArrayList&lt;Product&gt; productList = new ArrayList&lt;Product&gt;(); productList.add(product1); /* The error message popped out from here */ } Could anyone help me figure out what actually happened and some suggestions to fix this? I really appreciate your help Sincerely
upvote count: 0
tagged with: declaration
duplicate of: http://stackoverflow.com/q/22950577
type: Question
type: AnsweredQuestion
has title: Syntax error on token(s) "product1. "VariableDeclaratorId expected after this token
tagged with: java
accepted answer: http://stackoverflow.com/a/26824313
score: -1
linked to: http://stackoverflow.com/q/22950577

http://stackoverflow.com/comment/42170861
comment on: http://stackoverflow.com/q/26798098
score: 0
has text: `m.k` is just an obfuscating way to access `Mouse.k`. You can access `Mouse.k` even without deserializing anything.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42216178
type: QuestionComment
comment on: http://stackoverflow.com/q/26823530
score: 0
has text: @mattias,could you give a hint where am going wrong?
type: Comment

http://stackoverflow.com/q/26791044
has comment: http://stackoverflow.com/comment/42157962
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26791082
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42158067
has body: I have an anonymous class which takes the iterated value from a collection as shown below. With this code, is that immediate variable in preserved within anonymous class? Or different threads can take same in value? List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); for (int i = 1; i &lt;= 20; i++) list.add(i); for (final Integer in : list) { new Thread(new Runnable() { @Override public void run() { Thread.sleep(1000); System.out.println(value + "," + in); } }).start(); }
downvote count: 0
has title: Final variables within anonymous classes
accepted answer: http://stackoverflow.com/a/26791082
answer count: 1
has comment: http://stackoverflow.com/comment/42157897
has comment: http://stackoverflow.com/comment/42157997
favorite count: 0
linked to: http://stackoverflow.com/q/4732544
tagged with: final
tagged with: anonymous-inner-class
upvote count: 1

http://stackoverflow.com/comment/42051887
score: 0
type: AnswerComment
type: Comment
has text: Thanks, using your code it is not throwing any exception. But I have one problem, after iterating toRemove list and calling removeRow method, my excel is not getting updated. Do I need to write it back to same location?
comment on: http://stackoverflow.com/a/26730597

communication
tag name: communication
tags question: http://stackoverflow.com/q/26778807
type: Tag

http://stackoverflow.com/comment/42069436
type: AnswerComment
score: 0
has text: You are correct! This is exactly what I wanted!! Loads of love thanks!! :D
type: Comment
comment on: http://stackoverflow.com/a/26741704

http://stackoverflow.com/comment/42049794
has text: thanks Mr.Ihsan.. its worked for me .. i had given <jvmarg value="noverify " /> This link is usefull : http://www.takipiblog.com/oracles-latest-java-8-update-broke-your-tools-how-did-it-happen/
type: AnswerComment
comment on: http://stackoverflow.com/a/26710309
type: Comment
score: 1

http://stackoverflow.com/comment/41950909
has text: ok i see i need to use JavaCompiler first and dynamic compile file and after that get java.lang,Class from this dynamic compiled file
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26675685
type: Comment

http://stackoverflow.com/a/26752976
has comment: http://stackoverflow.com/comment/42093397
score: 72
has body: My syntax may be a bit off, but flatMap should do most of the work for you : Map&lt;String, Long&gt; toMap(Stream&lt;Map&lt;String, Long&gt;&gt; stream) { return stream.flatMap (map -&gt; map.entrySet().stream()) // this would create a flattened // Stream of all the map entries .collect(Collectors.toMap(e -&gt; e.getKey(), e -&gt; e.getValue())); // this should collect // them to a single map }
has comment: http://stackoverflow.com/comment/42089199
has comment: http://stackoverflow.com/comment/68537338
upvote count: 72
answers question: http://stackoverflow.com/q/26752919
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42089236
accepted answer of: http://stackoverflow.com/q/26752919
has comment: http://stackoverflow.com/comment/42093036
type: Answer

http://stackoverflow.com/comment/41968955
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26685341
type: AnswerComment
has text: There is really no need to create a new model. Calling `clear` on the existing one should be enough, but there is something off in the OP's code which is not provided.

http://stackoverflow.com/q/26762212
has body: I am trying to retrieve a string from a server using HTTPGet, then I want to set that string to a TextView in my MainActivity class. Here is the class I am trying to use to accomplish this. (I didn't include the imports here, but they are in the actual class. I also withheld the URL I am using here, but the actual URL is in my class) public class GetFromServer { public String getInternetData() throws Exception { BufferedReader in = null; String data = null; try{ HttpClient client = new DefaultHttpClient(); URI website = new URI("URL withheld"); HttpGet request = new HttpGet(); request.setURI(website); HttpResponse response = client.execute(request); in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer sb = new StringBuffer(""); String l = ""; String nl = System.getProperty("line.separator"); while ((l = in.readLine()) !=null){ sb.append(l + nl); } in.close(); data = sb.toString(); return data; }finally { if (in != null){ try{ in.close(); return data; }catch (Exception e){ e.printStackTrace(); } } } } } Then to use it in my MainActivity class: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.textView); GetFromServer test = new GetFromServer(); String returned = null; try { returned = test.getInternetData(); textView.setText(returned); } catch (Exception e) { e.printStackTrace(); } } This doesn't work because I get the android.os.NetworkOnMainThreadException, which means I have to use an AsyncTask. What I am asking is how do I turn this class into an AsyncTask so that it will work? Once it is an AsyncTask, how do I use it in my MainActivity class?
tagged with: android
accepted answer: http://stackoverflow.com/a/26762386
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: androidhttpclient
answer count: 1
has answer: http://stackoverflow.com/a/26762386
score: 0
tagged with: android-asynctask
has title: Making an Async HTTPGet class

http://stackoverflow.com/comment/42230434
has text: Tried it all, same problem: tv.setClickable(true); tv.setFocusable(true); tv.setFocusableInTouchMode(true); and in listview Oncreate: this.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); btw, textview does not have an onlongitemclicklistener, I think you meant onlongclicklistener? That's in the adapter already.
comment on: http://stackoverflow.com/a/26831183
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26819626
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/26819686
has comment: http://stackoverflow.com/comment/68824948
score: 1
tagged with: java
has body: I am building Hadoop project using Maven. I am facing below error [ERROR] Failed to execute goal on project hadoop-minikdc: Could not resolve dependencies for project org.apache.hadoop:hadoop-minikdc:jar:3.0.0-SNAPSHOT: Failure to find org.apache.directory.jdbm:apacheds-jdbm1:bundle:2.0.0-M2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced pom.xml org.apache.hadoop hadoop-project 3.0.0-SNAPSHOT ../../hadoop-project 4.0.0 org.apache.hadoop hadoop-minikdc 3.0.0-SNAPSHOT Apache Hadoop MiniKDC Apache Hadoop MiniKDC jar commons-io commons-io compile org.apache.directory.server apacheds-core-api 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.apache.directory.server apacheds-interceptor-kerberos 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.apache.directory.server apacheds-protocol-shared 2.0.0-M15 compile org.apache.directory.server apacheds-protocol-kerberos 2.0.0-M15 compile org.apache.directory.server apacheds-ldif-partition 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.apache.directory.server apacheds-mavibot-partition 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.apache.directory.api api-all 1.0.0-M20 compile xml-apis xml-apis xpp3 xpp3 dom4j dom4j org.apache.directory.server apacheds-jdbm-partition 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.apache.directory.server apacheds-protocol-ldap 2.0.0-M15 compile org.apache.directory.api api-ldap-schema-data org.slf4j slf4j-log4j12 compile junit junit compile Can anyone help me out?
has comment: http://stackoverflow.com/comment/42209588
type: Question
tagged with: hadoop
has title: Error while building Hadoop using Maven
answer count: 3
tagged with: apache
downvote count: 0
linked to: http://stackoverflow.com/q/9932923
favorite count: 0
has comment: http://stackoverflow.com/comment/42208961
linked to: http://stackoverflow.com/q/3805329
has answer: http://stackoverflow.com/a/27395895
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31954676

http://stackoverflow.com/comment/41991182
comment on: http://stackoverflow.com/q/26698494
score: 1
has text: You just posted another question with of a similar nature. Why are you not satisfied with the other answers in that question? You should read some literature about what *is* an algorithm and what isn't. This hello-world program has a constant time complexity for example, since there is no input. Please stop spamming and actually read the answers and comments of your questions.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26926624
accepted answer of: http://stackoverflow.com/q/26828777
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: My test passed without any problems. It is funny that in your case the "." and "," seem to be reversed. Camel uses the java.text.DecimalFormat class that determines the locale as follows: Locale def = Locale.getDefault(Locale.Category.FORMAT); You may reset the locale default as follows: Locale.setDefault(new Locale ("en", "US")); If you don't want to reset the default locale, you may set the locale as follows: BindyCsvDataFormat bindy = new BindyCsvDataFormat(PurchaseOrder.class); bindy.setLocale(Locale.US.getCountry()); from("direct:toCsv") .marshal(bindy) ... In this case, Camel resets the decimal format symbols in AbstractNumberFormat as follows: if (locale != null) { this.format.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(locale)); }
answers question: http://stackoverflow.com/q/26828777
upvote count: 1

http://stackoverflow.com/comment/42013980
comment on: http://stackoverflow.com/a/26711129
type: AnswerComment
score: 0
type: Comment
has text: I m getting exception `Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7` if I call it as `byte[] b=Example.hexStringToByteArray("0xCFF0021");`

http://stackoverflow.com/a/26795958
type: Answer
has body: Your teacher right, you don't have to call the main again, just enhance your algorithm, and you will get a better code. Perhaps something like this : //import library import java.io.IOException; import java.util.Random; import java.util.Scanner; //file name public class GuessingGame { // Main method, throws input and output error. public static void main(String[] args) throws IOException { // inputs for random number and switch statements Scanner inRn = new Scanner(System.in); Scanner inSw = new Scanner(System.in); // variables for the loop, random number, character, counter and input int guess = 0; int rnd; int num = -1; char decision = 'Y'; // random number generator Random random = new Random(); rnd = random.nextInt(100) + 1; // loops the user input for the guess do { if (num != rnd) { try { // prompt the user System.out .println(" Please guess a number between 1-100. Press 0 to give up."); num = inRn.nextInt(); } // catches input errors catch (Exception e) { System.out.println("You can only enter numbers!"); inRn.next(); continue; } // if statements if (num == 0) { // when user types '0' it ends the program System.out.println("You gave up after " + guess + " try(s) .... Closing program ..."); System.exit(0); } else if (num &gt; rnd) { System.out.println("The number is too big!"); guess++; } else if (num &lt; rnd) { // prints 'too small', adds to counter 'guess' System.out.println("The number is too small!"); guess++; } else { // prints correct, adds to counter, dsiplays # of guesses and // ends loop System.out.println("You guessed the right number!!: " + rnd); guess++; System.out.print(" # of guesses: " + guess + " -"); } } else { // prompt the user if they want to play again System.out.println(" Would you like to play again? &lt;Y/N&gt;"); decision = inSw.nextLine().charAt(0); // switch statements switch (decision) { case 'N': case 'n': System.out.println("Bye!"); // exits the program completely System.exit(0); break; case 'Y': case 'y': rnd = random.nextInt(10…
score: 0
answers question: http://stackoverflow.com/q/26795053

http://stackoverflow.com/a/26742894
accepted answer of: http://stackoverflow.com/q/26742797
upvote count: 1
has body: I would suggest putting a class on all td that has a first name and last name like: Peter Smith 35 HR Then calling your JSoup select within the for loop like: Element firstNames= value.select(".first-name"); Element lastNames= value.select(".last-name"); Or something along those lines. The point is, select using a class instead would be better and would insure you get nothing but the names. If you don't control the input then you can also use the selector for: Element firstNames= value.select("td:eq(0)"); Element lastNames= value.select("td:eq(1)"); However this requires that you are sure the information is always in the right order.
has comment: http://stackoverflow.com/comment/42071871
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42071940
type: Answer
answers question: http://stackoverflow.com/q/26742797
score: 1

http://stackoverflow.com/comment/125086444
score: 0
type: Comment
has text: It should be noted that this approach is measurable slower than map(..).filter(..)
type: AnswerComment
comment on: http://stackoverflow.com/a/26783982

tcp
type: Tag
tags question: http://stackoverflow.com/q/26722727
tags question: http://stackoverflow.com/q/26751624
tags question: http://stackoverflow.com/q/26830235
tags question: http://stackoverflow.com/q/26789754
tags question: http://stackoverflow.com/q/26689149
tags question: http://stackoverflow.com/q/26795236
tags question: http://stackoverflow.com/q/26765206
tags question: http://stackoverflow.com/q/26774425
tags question: http://stackoverflow.com/q/26755157
tags question: http://stackoverflow.com/q/26696327
tags question: http://stackoverflow.com/q/26735753
tags question: http://stackoverflow.com/q/26778807
tag name: tcp
tags question: http://stackoverflow.com/q/26746082
tags question: http://stackoverflow.com/q/26689505

http://stackoverflow.com/q/26714004
possible better answer: http://stackoverflow.com/a/26714061
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42018471
score: 1
tagged with: java
tagged with: eclipse
has title: Cannot find json file in project folder
has comment: http://stackoverflow.com/comment/42018493
answer count: 2
linked to: http://stackoverflow.com/q/17865427
upvote count: 1
accepted answer: http://stackoverflow.com/a/26729858
has answer: http://stackoverflow.com/a/26714061
favorite count: 0
has answer: http://stackoverflow.com/a/26729858
has body: My project setup looks like this: Now i try to reference the report.json file like this within the MainFrameTest.java: Template template = new JsonTemplate(Thread.currentThread(). getContextClassLoader().getResource("/report.json").toURI()); I also tried: Template template = new JsonTemplate(Thread.currentThread(). getContextClassLoader().getResource("report.json").toURI()); And the full path: Template template = new JsonTemplate(Thread.currentThread(). getContextClassLoader().getResource("C:/prohes/esc_print_test/report.json").toURI()); But i always get this error: java.lang.NullPointerException at esc_print_test.MainFrameTest.&lt;init&gt;(MainFrameTest.java:28) at esc_print_test.MainFrameTest.main(MainFrameTest.java:55) What do i wrong? Thanks
downvote count: 0
has comment: http://stackoverflow.com/comment/42047300

http://stackoverflow.com/comment/41964058
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26682656
has text: @ElliottFrisch That sets environment variables, not properties.

http://stackoverflow.com/a/26698076
has body: You can use java.util.Random to generate random things. However, keep in mind that, it is not secure, not really random. You can get random chars from the array S: String randomString = ""; Random rand = new Random(); for(int i=0;i&lt;=4;i++) { randomString += S[rand.nextInt(S.length())].charAt(0); } System.out.println(randomString);
score: 0
answers question: http://stackoverflow.com/q/26698043
type: Answer

http://stackoverflow.com/comment/41997854
score: 0
has text: URLEncoder works fine ! thanks!
comment on: http://stackoverflow.com/q/26702152
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42032422
type: QuestionComment
has text: It's not clear what you want to achieve. If two files are different, then what? If two files are the same, then what? If two files are the same size but different hashCodes? If the files are not the same size but have the same hashCode?
score: 0
comment on: http://stackoverflow.com/q/26720936
type: Comment

http://stackoverflow.com/comment/42162299
type: QuestionComment
has text: @August sort by name.
type: Comment
comment on: http://stackoverflow.com/q/26793651
score: 0

http://stackoverflow.com/comment/42078556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26746586
has text: "*How does a statement like this execute?*" It will not execute because it will not compile because of `System.out.println(x, y);`.
score: 0

http://stackoverflow.com/a/26758826
accepted answer of: http://stackoverflow.com/q/26758114
type: Answer
has body: It looks like you create a neverending redundancy within the following lines: Node temp = trav; (1) temp.next = travSort; (2) travSort = temp; (3) So temp==trav (1) but temp.next != trav.next but temp.next == travSort (2). However (3) sets travSort = temp Therefore travSort.next == temp.next == travSort which is the reason your while-loop never ends, because once entered travSort can never be null.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26758114

http://stackoverflow.com/comment/42113621
comment on: http://stackoverflow.com/q/26703733
score: 0
type: Comment
type: QuestionComment
has text: because of this, i call jmenoPromenne1.setSelectedItem(""); ;

http://stackoverflow.com/comment/42168495
type: Comment
has text: So I should convert my string to a byte?
comment on: http://stackoverflow.com/a/26764319
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42172387
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26772188
has text: I cant get what exactly i am doing wrong. Please some budy help me or please tell me how to retrieve twitter data without using flume in centos

jpanel
tags question: http://stackoverflow.com/q/26725029
tags question: http://stackoverflow.com/q/26796339
tags question: http://stackoverflow.com/q/26772490
tags question: http://stackoverflow.com/q/26692662
type: Tag
tags question: http://stackoverflow.com/q/26694426
tags question: http://stackoverflow.com/q/26702647
tags question: http://stackoverflow.com/q/26760367
tags question: http://stackoverflow.com/q/26683848
tags question: http://stackoverflow.com/q/26719260
tags question: http://stackoverflow.com/q/26814411
tags question: http://stackoverflow.com/q/26699300
tags question: http://stackoverflow.com/q/26747617
tags question: http://stackoverflow.com/q/26723764
tags question: http://stackoverflow.com/q/26707341
tags question: http://stackoverflow.com/q/26784502
tags question: http://stackoverflow.com/q/26749166
tags question: http://stackoverflow.com/q/26748506
tag name: jpanel
tags question: http://stackoverflow.com/q/26816649
tags question: http://stackoverflow.com/q/26712479
tags question: http://stackoverflow.com/q/26809495
tags question: http://stackoverflow.com/q/26827914

http://stackoverflow.com/comment/42018491
score: 1
has text: possible duplicate of [How to cast an Object to an int in java?](http://stackoverflow.com/questions/3661413/how-to-cast-an-object-to-an-int-in-java)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26713980

http://stackoverflow.com/comment/78976377
comment on: http://stackoverflow.com/q/26814945
has text: This maybe will or will not work for your case, but try ObjectAnimator.pause() method.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26746294
has comment: http://stackoverflow.com/comment/42099705
has comment: http://stackoverflow.com/comment/59366784
upvote count: 4
has body: I had a similar problem and resolved with this approach. In the web.xml overwrites the url pattern for the service implementation, like this: ServiceImpl org.example.ServiceImpl ServiceImpl /B/C/D.ws Like you I use the property address to set the service publish address This works for my in JBoss AS 6.1 (cxf 2.3.1) EDIT: To validate that this works correctly in JBoss EAP 6.2, create a simple web project based on jboss-eap-quickstarts/helloworld-ws/ as follows: Service Class: @WebService(serviceName = "HelloWorldService", portName = "HelloWorld", name = "HelloWorld", endpointInterface = "org.jboss.as.quickstarts.wshelloworld.HelloWorldService", targetNamespace = "http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld") public class HelloWorldServiceImpl implements HelloWorldService { @Override public String sayHello() { return "Hello World!"; } @Override public String sayHelloToName(final String name) { /* Create a list with just the one value */ final List<String> names = new ArrayList<String>(); names.add(name); return sayHelloToNames(names); } @Override public String sayHelloToNames(final List<String> names) { return "Hello " + createNameListString(names); } /** * Creates a list of names separated by commas or an and symbol if its the last separation. This is then used to say hello to * the list of names. * * i.e. if the input was {John, Mary, Luke} the output would be John, Mary & Luke * * @param names A list of names * @return The list of names separated as described above. */ private String createNameListString(final List<String> names) { /* * If the list is null or empty then assume the call was anonymous. */ if (names == null || names.isEmpty()) { return "Anonymous!"; } final StringBuilder nameBuilder = new StringBuilder(); for (int i = 0; i < names.size(); i++) { /* * Add the separator if its not the first string or the last separator since that should be an and (&) symbol. */ if (i != 0 && i != names.size() - 1) nameBuilder.append(", "); else if (…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59364464
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26741633
has comment: http://stackoverflow.com/comment/59364903
score: 4
has comment: http://stackoverflow.com/comment/59366408
answers question: http://stackoverflow.com/q/26741633
has comment: http://stackoverflow.com/comment/42080492
has comment: http://stackoverflow.com/comment/42090792
has comment: http://stackoverflow.com/comment/59366296
has comment: http://stackoverflow.com/comment/42079954
has comment: http://stackoverflow.com/comment/74144883

http://stackoverflow.com/comment/42187230
comment on: http://stackoverflow.com/q/26807051
type: Comment
type: QuestionComment
score: 2
has text: Well, if you don't know how to use a certain class, then read its JavaDoc first. For example your current Map: `HashMap<ArrayList<Activity>, String> map`. The keyword is stored in the `value` part. Does this sounds right? Woudln't this `HashMap<String, ArrayList<Activity>> map` make more sense? You could also take a look at [Guava Multimap](https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained#Multimap).

http://stackoverflow.com/q/26765950
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42112903
answer count: 3
possible better answer: http://stackoverflow.com/a/26766048
has answer: http://stackoverflow.com/a/26766048
downvote count: 0
has body: Is there a way of iterating a LinkedHashMap (which has a defined order) by using an index instead of a foreach loop? I need to access elements using index. The following code prints the entire map: public void print(Map&lt;String, Integer&gt; map) { for (Map.Entry&lt;String, Integer&gt; entryMap : map.entrySet()) { System.out.println(entryMap.getValue() + " = " + entryMap.getKey()); } } How can I do the same but access the elements using index instead? public void print(Map&lt;String, Integer&gt; map) { for (int i = 0; i&lt; map.size(); i++) { // getValue() and getKey() are undefined System.out.println(map.get(i).getValue() + " = " + map.get(i).getKey()); } } The following only returns the keys, but I also need the values: public String getByIndex(Map&lt;String, Integer&gt; map, int index) { List&lt;String&gt; keys = new ArrayList&lt;&gt;(map.keySet()); return (String) keys.get(index); }
has answer: http://stackoverflow.com/a/26766000
favorite count: 0
linked to: http://stackoverflow.com/q/13581997
tagged with: dictionary
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26766200
has comment: http://stackoverflow.com/comment/42112879
upvote count: 1
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/42113162
accepted answer: http://stackoverflow.com/a/26766200
has title: Getting Map Value Pairs Using Index

http://stackoverflow.com/comment/42528184
comment on: http://stackoverflow.com/q/26783540
has text: many thanks for the link to the code sample. Had a quick look on it and yes, this is probably not going to be easy. If these API are private to Oracle, it's probably quite risky to rely on that. Again, many thanks. Got some stuff to read now :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42180007
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26803373
score: 0
has text: What have you done so far?

http://stackoverflow.com/a/26777128
score: 2
has comment: http://stackoverflow.com/comment/42132966
has body: It's rather about which SE versions EE server can work with. Like here https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Installation_Guide/Java_Environments_Supported_By_JBoss_Enterprise_Application_Platform_61.html
has comment: http://stackoverflow.com/comment/42132484
downvote count: 0
answers question: http://stackoverflow.com/q/26776748
upvote count: 2
type: Answer

http://stackoverflow.com/q/26714263
type: UnansweredQuestion
has body: When I want to run jar from my gradle project it shows: Exception in thread "main" java.lang.NoClassDefFoundError: org/ini4j/InvalidFileFormatException My build.gradle in short: apply plugin: 'java' apply plugin: 'pmd' apply plugin: 'application' apply plugin: 'eclipse' version = "0.0.0" group= "grm" mainClassName = 'grm.bol.Launcher' repositories { mavenCentral() mavenLocal() } dependencies { compile group: 'org.ini4j', name: 'ini4j', version: 'latest.release' } jar { manifest { attributes "Main-Class": "grm.bol.Launcher" attributes "Class-Path": configurations.compile.collect { it.getName() }.join(' ') } } When I run in eclipse ini4j works fine without any worning. Also build gradle task is successfully. But I cannot run it even if generated manifest.mf looks like that: Manifest-Version: 1.0 Main-Class: grm.bol.Launcher Class-Path: ini4j-0.5.2.jar Somebody know the reason what is happening with manifest?
tagged with: java
tagged with: ini4j
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/42020047
has title: java.lang.NoClassDefFoundError: org/ini4j/InvalidFileFormatException by gradle
tagged with: manifest.mf
score: 0
has comment: http://stackoverflow.com/comment/42019760
has comment: http://stackoverflow.com/comment/42019015
has comment: http://stackoverflow.com/comment/42020015
answer count: 1
tagged with: executable-jar
has answer: http://stackoverflow.com/a/26714465

http://stackoverflow.com/a/26789398
type: Answer
has comment: http://stackoverflow.com/comment/42155196
has comment: http://stackoverflow.com/comment/42155231
score: 1
answers question: http://stackoverflow.com/q/26789125
has body: Note: There is nothing wrong with Elliot's answer, expect that it couples the work flow to the worker and passes object references to the worker, which it would otherwise not require (+1 to his answer) As an alternative to passing about references to classes which probably don't need to know or care about such things, you could use the SwingWorkers PropertyChangeListener support. This decouples the worker and makes it more reusable... CreateGUI worker = new CreateGUI(); worker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("state".equals(evt.getPropertyName())) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: prgBar.setInderminent(false); startTimer.start(); break; } } } }); worker.execute(); Which would simply run... public class CreateGUI extends SwingWorker&lt;Integer, Integer&gt; { @Override protected Integer doInBackground() throws Exception { // Working hard or hardly working... return ???; } } Just as a side note (as the worker name freaks me out), Swing is NOT thread safe, you should not create or modify UI elements from outside the Event Dispatching Thread... Updated... If all you want to do is chain the execution of your threads, then you could use a single threaded ExecutorService, for example... ExecutorService es = Executors.newSingleThreadExecutor(); es.submit(new CreateGUI()); es.submit(new StartTimer()); es.shutdown(); This ensures that StartTimer can't run until CreateGUI either finishes or fails...
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/26682945
type: Question
has comment: http://stackoverflow.com/comment/41964679
tagged with: jsp
has title: jspService method exceeds 65535 byte limit without business logic
tagged with: runtime-error
linked to: http://stackoverflow.com/q/7495985
has body: When creating a large page, a Summary of all choices made on the ten or more pages before it, I receive the following error: The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit From searching elsewhere, I can find this question: Byte limit Exceed problem when reloading a jsp page? but my problem is slightly different. I have no code in the page, beyond (several) c:forEach tags. It seems to work when I move one of the c:forEach blocks to another jsp and jsp:include it, but the other question implies that this shouldn't work. I want to make sure I'm not doing some heinous act of coding, so if there's a different solution, I'm open to hearing it. (I'll reiterate that there is NO business logic code inside this jsp, just c:forEach and c:if tags used strictly to determine if specific sections should be shown. The if tests are simple boolean checks that rely on the servlet to populate the boolean answer that the jsp checks.) For an example of the if statements in the Jsp that I'm talking about: Jsp: &lt;c:if test="${viewOnly==null}"&gt; &lt;div align="center"&gt; &lt;input type="button" name="editInfo" title="Update" id="Update" value="Update" class="button" /&gt; &lt;/div&gt; &lt;/c:if&gt; Java: if (request.getParameter("view") != null) { viewOnly = "Y"; } mv.addObject("viewOnly", viewOnly); If it helps, I'm using SpringMVC and Hibernate. (Some spring:message tags were removed from the jsp code and replaced with the actual message.)
has comment: http://stackoverflow.com/comment/41964662
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42068651

http://stackoverflow.com/q/26803003
has body: I have implemented asymmetric encryption in my project using "public key" to "encrypt" the message and "private key" to "decrypt" the message. Do we ever use "private key" to "encrypt" the message and and "public key" to "decrypt". If yes, can someone give me a use case of that and is this kind of cryptography also called "asymmetric encryption"
has comment: http://stackoverflow.com/comment/42180784
downvote count: 0
has answer: http://stackoverflow.com/a/76615535
has comment: http://stackoverflow.com/comment/42179271
has comment: http://stackoverflow.com/comment/42179986
accepted answer: http://stackoverflow.com/a/26803331
answer count: 3
tagged with: private-key
tagged with: public-key-encryption
possible better answer: http://stackoverflow.com/a/26803155
has answer: http://stackoverflow.com/a/26803155
favorite count: 0
has comment: http://stackoverflow.com/comment/42185622
tagged with: encryption
tagged with: cryptography
has title: Public key encryption vs private key encryption
type: AnsweredQuestion
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/26803331
tagged with: java
has comment: http://stackoverflow.com/comment/42183848
type: Question

http://stackoverflow.com/comment/42104993
type: QuestionComment
has text: Sounds like a problem with Jersey 1 jars with JAXB 2 API. See these similar questions: http://stackoverflow.com/questions/20286602/getting-root-cause-java-lang-abstractmethoderror-while-using-jersey-containerreq http://stackoverflow.com/questions/20079069/abstractmethoderror-on-uribuilder-when-upgrading-jersey-client-1-x-to-2-x http://stackoverflow.com/questions/23277429/exception-in-rest-jersey
type: Comment
comment on: http://stackoverflow.com/q/26755170
score: 0

http://stackoverflow.com/comment/42174123
comment on: http://stackoverflow.com/a/26800134
has text: i am implementing a cache, and my cache is an **ArrayList** containing int type of Arrays and this value '"dddddddd"' needed to be stored in one of the index. what should i do now?
type: AnswerComment
score: 0
type: Comment

gwt
tags question: http://stackoverflow.com/q/26806494
tags question: http://stackoverflow.com/q/26711428
tags question: http://stackoverflow.com/q/26753180
tags question: http://stackoverflow.com/q/26730838
tags question: http://stackoverflow.com/q/26749830
tag name: gwt
tags question: http://stackoverflow.com/q/26792794
type: Tag
tags question: http://stackoverflow.com/q/26758914
tags question: http://stackoverflow.com/q/26742442
tags question: http://stackoverflow.com/q/26806239
tags question: http://stackoverflow.com/q/26776872
tags question: http://stackoverflow.com/q/26745831
tags question: http://stackoverflow.com/q/26803294
tags question: http://stackoverflow.com/q/26738821
tags question: http://stackoverflow.com/q/26820248
tags question: http://stackoverflow.com/q/26716022
tags question: http://stackoverflow.com/q/26800981
tags question: http://stackoverflow.com/q/26753567
tags question: http://stackoverflow.com/q/26727633
tags question: http://stackoverflow.com/q/26826668
tags question: http://stackoverflow.com/q/26700890
tags question: http://stackoverflow.com/q/26825360
tags question: http://stackoverflow.com/q/26703765
tags question: http://stackoverflow.com/q/26701934

http://stackoverflow.com/comment/41982000
comment on: http://stackoverflow.com/q/26693220
score: 0
type: Comment
type: QuestionComment
has text: I have no idea where to start, and I have tried for about an hour a lot of different things but nothing has worked :/

http://stackoverflow.com/a/26781448
has comment: http://stackoverflow.com/comment/42141858
type: Answer
has comment: http://stackoverflow.com/comment/42141344
has comment: http://stackoverflow.com/comment/42140573
has body: your second try is the right way to detect the message, but your have to try for 3 seconds to find the element. It should look like this while (!elementFound || stillWithin3Seconds){ elementFound = findAlertByClassName() } assetTrue(elementFound) You have to look all the time. In your code you are sleeping. When the dialog appears in this time, you won't notice it.
has comment: http://stackoverflow.com/comment/42140830
answers question: http://stackoverflow.com/q/26758902
has comment: http://stackoverflow.com/comment/42140508
has comment: http://stackoverflow.com/comment/42140813
has comment: http://stackoverflow.com/comment/42140960
score: 0

http://stackoverflow.com/q/26777341
has answer: http://stackoverflow.com/a/26780171
has body: Currently I have the standard one: @DeclareParents(value = "(@moody.MyAttribute *)", defaultImpl = MoodyImpl.class) This will add my interface+implementation to any class with @MyAttribute I would like to do this for all classes that have this attribute AND/OR have a method with that attribute. So this class should also get my interface+implementation: class MyClass { @MyAttribute public void test() { } } Is that possible?
accepted answer: http://stackoverflow.com/a/26780171
type: AnsweredQuestion
tagged with: java
tagged with: aop
type: Question
score: 0
tagged with: aspectj
answer count: 1
has title: AspectJ type pattern for all types with a method with an attribute?

http://stackoverflow.com/q/26758708
linked to: http://stackoverflow.com/q/5554734
downvote count: 2
has body: I am having ArrayIndexOutOfBoundsException error for my getBuffer method, public class BufferPool { private LPQueue&lt;Buffer&gt; queue; private RandomAccessFile disk; private int blockSize; private int poolSize; private Buffer[] pool; public BufferPool(File file, int bufferNumber, int blockSize) throws IOException { this.blockSize = blockSize; queue = new LPQueue&lt;Buffer&gt;(bufferNumber); disk = new RandomAccessFile(file, "rw"); poolSize = ((int) disk.length() / blockSize); pool = new Buffer[poolSize]; } public Buffer getBuffer(int index) { if (pool[index] == null) { // &lt;&lt;----------here! pool[index] = newBuffer(index); } return pool[index]; } } Can you please help me to solve this problem out? This buffer pool is pool of the buffer to store the value of data to sort it later.. This get Buffer Gets a handle to a Buffer that represents the indexth block of the file that is backing this BufferPool. index is the index of the block we want to acquire. it returns a buffer handle to that block.
has answer: http://stackoverflow.com/a/26758782
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5554734
tagged with: java
tagged with: indexoutofboundsexception
type: Question
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/26758782
has title: Buffer ArrayIndexOutOfBoundsException error
answer count: 1
favorite count: 0
tagged with: buffer

http://stackoverflow.com/a/26810296
score: 0
answers question: http://stackoverflow.com/q/26809843
has comment: http://stackoverflow.com/comment/42234798
type: Answer
has body: Implement Cloneable. here is how: https://stackoverflow.com/a/4329993/2446277

http://stackoverflow.com/comment/42207961
comment on: http://stackoverflow.com/q/26815329
score: 0
type: Comment
type: QuestionComment
has text: Check your `Number.parseXXX` statements and adjust.

http://stackoverflow.com/a/26825279
answers question: http://stackoverflow.com/q/26825190
downvote count: 2
type: Answer
score: -2
has body: import java.util.ResourceBundle; ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName); rb.getString(DECLARATIVE_SENTENCE)
upvote count: 0

http://stackoverflow.com/q/26675725
has comment: http://stackoverflow.com/comment/41952115
has comment: http://stackoverflow.com/comment/41950753
has answer: http://stackoverflow.com/a/26676230
answer count: 6
has answer: http://stackoverflow.com/a/26675827
has answer: http://stackoverflow.com/a/26675841
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26675827
has comment: http://stackoverflow.com/comment/41951961
upvote count: 2
accepted answer: http://stackoverflow.com/a/26676230
has answer: http://stackoverflow.com/a/26675877
has answer: http://stackoverflow.com/a/26675809
has title: Java Programming - divisibility and counting?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41950696
tagged with: java
has comment: http://stackoverflow.com/comment/41950796
has body: I am a student trying to learn programming on my own, getting help from online sources and people like you. I found an exercise online to create a small program that will do this: Write a program that will read the numbers a and b (type long) and list how many numbers between a and b are divisible by either 2, 3 or 5. For example: a=11 b=30 The counter would be 14, since there are 14 numbers divisible by 2,3 or 5 in between: 12, 14, 15, 16, 18, 20, 21, 22, 24,25, 26, 27, 28, 30 This is what I have already tried, but it doesn't seem to work. I would need your guidance and help to finish this. Thank you for your time and your hard work in advance. import java.util.Scanner; public class V { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); for (long c = a; c &lt;= b; c++) { if (c%2 || c%3 || c%5) { System.out.println(c); } } } } CURRENT STAGE OF THE PROGRAM: import java.util.Scanner; public class Test2 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long count = 0; // counter for (long c = a; c &lt;= b; c++) { if (c % 2 == 0 || c % 3 == 0 || c % 5 == 0) { count++; System.out.println(c); } } } } There is still a thing to do: Now it lists me the numbers which are divisible by 2,3 or 5. But all I need is one single number that will count how many numbers there is.
has answer: http://stackoverflow.com/a/26675803
has comment: http://stackoverflow.com/comment/41951971
type: Question

http://stackoverflow.com/comment/42209567
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26819872
has text: Can you put your content in a fragment?

http://stackoverflow.com/comment/42190404
has text: yes, I did locate it using: locate getsp.class showed, among others "/usr/share/R/java/getsp.class" and therefore I used "export CLASSPATH=/usr/share/R/java"
comment on: http://stackoverflow.com/a/26807140
type: AnswerComment
score: 0
type: Comment

formatter
tags question: http://stackoverflow.com/q/26734378
type: Tag
tags question: http://stackoverflow.com/q/26803877
tag name: formatter

http://stackoverflow.com/q/26729067
type: Question
has title: How can I write query to get the following output in MySql
has answer: http://stackoverflow.com/a/26730048
tagged with: sql
upvote count: 1
answer count: 1
favorite count: 0
has body: Table Format and Data Requirement. Snapshot of the count of work with status "NEW" for each hour. Required output for the day 04/11/2014(between 04/11/2014 00:00:01 and 04/11/2014 23:59:59) for status "NEW" Output (Count of work with status new for each hour) Is it possible to get the output with a single query? It will be highly appreciated if you paste the query. I tried to take the count for each hour with group by for the hour. But, it doesn't count the between range. Also tried to executing multiple queries by looping in java. I don't prefer the last method. (looping in java). I wanted to know is it possible to with single execution of single mysql query.
type: UnansweredQuestion
tagged with: oracle-database
score: -3
downvote count: 4
has comment: http://stackoverflow.com/comment/42046894
tagged with: java
tagged with: mysql

apache-axis
tags question: http://stackoverflow.com/q/26746396
tag name: apache-axis
tags question: http://stackoverflow.com/q/26780917
tags question: http://stackoverflow.com/q/26750394
tags question: http://stackoverflow.com/q/26766366
type: Tag

http://stackoverflow.com/comment/42093844
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26755755
has text: you will definitly be able to call it via reflection

http://stackoverflow.com/comment/42154173
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26788431
score: 0
has text: @fge, I started using the regular map<int,int> (excuse my C++ like syntax), then the IDE warned my that SparseIntArray was more efficient. Regular maps can use Integer, which require some kind of boxing, while SparseIntArray is limited to keys and values of int types, it has less overhead.

http://stackoverflow.com/q/26741582
type: AnsweredQuestion
tagged with: singleton
has body: public class A {} // 1. suppose Test is definitely a singleton, here skip singleton default impl // 2. Test field a (class A) has no dirty value issue, or does it? // 3. Singleton Object (ex, this sample) field assignment (in multi-threaded environment), has no race condition or deadlock issue, or does it? public class Test { private A a; public A get() { if (a == null) { a = new A(); } return a; } }
type: Question
score: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26741848
answer count: 1
tagged with: java
has title: Java: Is this Singleton Class variable assignment thread safe?
linked to: http://stackoverflow.com/q/16106260
has answer: http://stackoverflow.com/a/26741848
duplicate of: http://stackoverflow.com/q/16106260
has comment: http://stackoverflow.com/comment/42069037

http://stackoverflow.com/a/26704887
has comment: http://stackoverflow.com/comment/42022869
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26704813
accepted answer of: http://stackoverflow.com/q/26704813
has comment: http://stackoverflow.com/comment/42002984
upvote count: 2
has comment: http://stackoverflow.com/comment/42005261
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42003067
has body: The Material TextAppearance classes are part of Android L. You need to target API level 21 for your build (and make sure those SDK's are installed.)

http://stackoverflow.com/q/26821736
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42213197
type: Question
possible better answer: http://stackoverflow.com/a/26822064
has answer: http://stackoverflow.com/a/26821851
has answer: http://stackoverflow.com/a/26822064
has comment: http://stackoverflow.com/comment/42213108
has comment: http://stackoverflow.com/comment/42212883
score: -2
has comment: http://stackoverflow.com/comment/42212893
tagged with: inheritance
has title: Why won't my Test class pull the main class correctly?
has comment: http://stackoverflow.com/comment/42213227
answer count: 2
has body: Thank you for assisting me. I have written a Main class that I am able to compile and run. The problem I have is I can run the Test class using the display method.(not pulling correctly to new class) I have to create the Test class with 3 objects one with small value, large value, and retain value. I must use setRadius() method. Any guidance you can provide would be very helpful. public class Circle { public static void main(String[] args) { //call constructor and method Circle myCircle = new Circle(); myCircle.display(); } //set fields double radius; double diameter; double area; //create constructor set radius &amp; compute diameter and area. public Circle() { radius= 1; diameter = 2 * radius; area = Math.PI * (radius * radius); } //set radius, diameter, and area public void setRadius() { radius= 1; diameter = radius * radius; area = Math.PI * (radius * radius); } //return radius public double getRadius() { return radius; } //write display public void display() { System.out.println("The radius is " + radius); System.out.println("The diameter is " + diameter); System.out.println("The area is " + area); } } public class TestCircle { public static void main(String[] args) { Circle circleA = new Circle(); circleA.setRadius(); System.out.println("Circle A: " + circleA.setRadius()); Circle circleB = new Circle(); circleB.setRadius(); System.out.println("Circle B: " + circlB.setRadius()); } }
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42213217
accepted answer: http://stackoverflow.com/a/26821851
has comment: http://stackoverflow.com/comment/42212933
tagged with: constructor
has comment: http://stackoverflow.com/comment/42212977
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42212925

http://stackoverflow.com/comment/41964726
comment on: http://stackoverflow.com/a/26682255
score: 0
type: AnswerComment
has text: I believe its only related to the fact that you can synchronized on a single object and modify many shared variables in that scope, where as a volatile member is singular by definition. This can result in more writes to memory. I find it hard to construct a situation where it would matter, and its something you would almost never have to account for, but the statement volatile is not more expensive than synchronized isnt *quite* true. And thats not considering JIT...
type: Comment

http://stackoverflow.com/q/26702185
score: 0
has comment: http://stackoverflow.com/comment/42003786
answer count: 1
has body: I'm creating a Networking Utilities package, to make it easier to create network applications, like chat applications, games etc. I wonder if it's possible to, in the server thread, look for packets all the time, without blocking the thread? I want to do this, because, for example, when I'm going to create a multiplayer server, I don't want the whole server to be blocked and unplayable because the server is looking for packets that tells the server that someone is connecting. What's the best way of solving this? To put the joining detection in a separate thread? Also; how many threads can you run in a single application? Should you try to hold the amount of threads down as much as possible? Is 4 threads too much?
has answer: http://stackoverflow.com/a/26775240
accepted answer: http://stackoverflow.com/a/26775240
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/48032778
type: Question
has title: Java networking - Look for packets without blocking the thread?
has comment: http://stackoverflow.com/comment/42011011
tagged with: network-programming

http://stackoverflow.com/a/26825472
has body: Hi Since you are creating a new progressDialog every time therefore it is not getting dismissed. Create only one and keep variable at common place . For example @Override protected void onPreExecute() { super.onPreExecute(); if(progressDialog!=null){ progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setMessage(getString(R.string.message)); progressDialog.setIndeterminate(true); progressDialog.show(); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26825353

http://stackoverflow.com/comment/42098485
score: 0
has text: See http://stackoverflow.com/a/11032063/1002790 and http://stackoverflow.com/a/14396503/1002790
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26758300

http://stackoverflow.com/a/26766000
has comment: http://stackoverflow.com/comment/42112931
score: 0
type: Answer
has body: One of the possible workarounds would be to put all keys also into ArrayList where they can be accessed using index. Direct access seems not possible because keySet returns a set that does not support the indexed access.
has comment: http://stackoverflow.com/comment/42112908
answers question: http://stackoverflow.com/q/26765950

http://stackoverflow.com/a/26827945
downvote count: 0
has comment: http://stackoverflow.com/comment/42247607
type: Answer
upvote count: 2
has body: I don't think it is a good idea, as Vaadin is a server side framework, so every action you do goes to the server, and from there on it has to make another rest service call to another server from where you have to get data and render it. I would rater suggest you to try some client side frameworks like ExtJS, Jquery, Angular JS, GWT etc... You render your UI on the client side using these frameworks and any action which requires data ops like fetching data or perform transactions you can make a rest service call to the server side. Using this approach you can avoid another redirection. Now a days you the concept of RWD is getting popular, I think this would be a great choice for your use case. Build once deploy on any device :) BTW, this is purely my opinion.
accepted answer of: http://stackoverflow.com/q/26822963
score: 2
answers question: http://stackoverflow.com/q/26822963
type: AcceptedAnswer

http://stackoverflow.com/comment/42116389
comment on: http://stackoverflow.com/q/26743299
has text: @DaveSyer In the other example, using the -Dloader.main=.. It still picks up the main of regular spring-boot Webservlet class used to start the web-app as normal. Now that class does have to be defined in the pom as a property "start-class" since otherwise the jar won't build. It error's out and says it can't determine which "main" to use. I do not have a PropertiesLauncher created anywhere that I know of.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26721846
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26721810
has body: Youre passing in the parameter but checking the request attribute (assuming that the outer quotes are a question typo). Based on the information you provided, the initial request attribute was only available in the JSP but not any subsequent servlet. Try System.out.println(request.getParameter("description"));
has comment: http://stackoverflow.com/comment/42051988
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26721810

http://stackoverflow.com/comment/86598808
type: Comment
has text: For those who are wondering where "Region and Language" is, click on start and type "Region and Language" :)
comment on: http://stackoverflow.com/a/26749631
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42143917
has text: The file types are all jars. not sure what you are asking.
type: AnswerComment
comment on: http://stackoverflow.com/a/26782471
type: Comment
score: 0

http://stackoverflow.com/q/26673121
downvote count: 0
answer count: 1
has title: Resizeble Dialog in Java SWT
has answer: http://stackoverflow.com/a/26673546
favorite count: 0
tagged with: swt
has body: I have a Composite(container) which is inside another composite(Dialog area). The container contains some UI elements. How can I either make the size of the dialog bigger or make it resizeable. Here is my code protected Control createDialogArea(Composite parent) { setMessage("Enter user information and press OK"); setTitle("User Information"); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Label lblUserName = new Label(container, SWT.NONE); lblUserName.setText("User name"); txtUsername = new Text(container, SWT.BORDER); txtUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtUsername.setEditable(newUser); txtUsername.setText(name); return area; }
accepted answer: http://stackoverflow.com/a/26673546
tagged with: jface
tagged with: composite
type: AnsweredQuestion
tagged with: dialog
upvote count: 5
tagged with: java
type: Question
score: 5

http://stackoverflow.com/a/26838344
has comment: http://stackoverflow.com/comment/42277035
downvote count: 0
score: 1
has body: Reducer runs on the outputs of the Mappers, so no information about the input files is available in the Context there. Now to identify the input directory inside reduce you just need to tag the outValue in map using the code you shared, joining is irrelevant here. Eg : MAP String tag = (FileSplit)context.getInputSplit()).getPath() .getParent().getName().toString(); context.write(outKey, new Text(tag + "_" + value.toString)); If you're interested in the fileName itself (which should be the case indeed), remove the getParent() call. REDUCE String metaFileName = "meta.dat"; for(Text value : values){ String[] tagVal = value.toString().split("_",2); if(strVal[0].equals(metaFileName){ // process the meta file here // strVal[1] contains the actual value } else { // process data files } } This should solve your problem. One suggestion here, you may take advantage of the MultiOutputs api to write to different types of file from reducer. Otherwise after the job is over, it will be really hard to identify the metaFile(which will be distributed among several output files).
has comment: http://stackoverflow.com/comment/42302786
upvote count: 1
has comment: http://stackoverflow.com/comment/42315539
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42274139
accepted answer of: http://stackoverflow.com/q/26825926
type: Answer
answers question: http://stackoverflow.com/q/26825926

http://stackoverflow.com/comment/42054224
comment on: http://stackoverflow.com/a/26731074
has text: Which string have you tried. I dont see why any number sould remain.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42144415
comment on: http://stackoverflow.com/q/26783408
type: Comment
type: QuestionComment
has text: It appears to only be pulled in at that single place. The webapp pulls in jackson-mapper-asl which pulls in jackson-core-asl.
score: 0

http://stackoverflow.com/comment/42004041
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26705467
has text: re:"Why don't you convert the arrays to ints". This is a pretty stock homework problem. The inputs can be of an length, so you can't assume that the numbers will fit into an int (or into a long even, which most profs will have a specific testcase for). If it was homework, one just use the BigInteger class, though it would defeat the point.
type: Comment

http://stackoverflow.com/comment/42036641
has text: Is there a guarantee that `numbers.length` is always less than or equal to `lowerCounter` and `higherCounter`? Otherwise, it will access a higher index on those array which doesn't exist, which will result in `ArrayIndexOutOfBoundsException`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26723448

http://stackoverflow.com/comment/42286979
has text: Just a question: why do you want to do that?
comment on: http://stackoverflow.com/q/26783613
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42043585
comment on: http://stackoverflow.com/q/26727502
score: 1
has text: What specifically doesn't return a value? You can't expect anyone to pour through a wall of code without a hint of where to start looking for the problem. Could you please further explain what isn't working?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42057483
score: 0
type: Comment
type: QuestionComment
has text: But that part of the question should go on `Code Review`. http://codereview.stackexchange.com
comment on: http://stackoverflow.com/q/26735519

http://stackoverflow.com/comment/42056307
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26734688
score: 0
has text: Do you want to make your Rectangle bigger or smaller?

http://stackoverflow.com/q/26760393
score: 1
tagged with: java
has body: I am trying to add an Image above a Swipe Tab Like in the Image below ! I tried adding this: getActionBar().setIcon(R.drawable.ic_launcher); and adding it in my viewpager xml above the viewpager but it didn't work any idea how to do that?
tagged with: eclipse
type: Question
downvote count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26760791
answer count: 1
has title: how to add an image above swipe tab?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26760791
tagged with: android-actionbar
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/42067403
has text: Its a function that each toggle button and the plus/minus button will call in the end of their onclicklistener.
type: AnswerComment
comment on: http://stackoverflow.com/a/26726650
score: 0
type: Comment

http://stackoverflow.com/comment/42063698
type: QuestionComment
type: Comment
has text: add main method in that class and run that class in debug mode.
comment on: http://stackoverflow.com/q/26738906
score: 0

http://stackoverflow.com/q/26804044
type: Question
tagged with: jsoup
possible better answer: http://stackoverflow.com/a/26807607
has answer: http://stackoverflow.com/a/26804508
has answer: http://stackoverflow.com/a/26807607
has answer: http://stackoverflow.com/a/26819353
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/26819353
favorite count: 0
has body: I'm trying to gather the images of a list of articles using the Jsoup library from this url. When an article hasn't an image embedded I use a standard picture. Here is what I do: for(Element img : document.select(".rullo .rullo-item .lazy&gt;a img[src]")) { String imageMainUrl = img.attr("src"); if(img.attr("src") == null || img.attr("src").equals("") || img.attr("src").isEmpty()){ images.add(bmp); } else { String newString = imageMainUrl.replace("data:image/gif;base64,", ""); byte[] decodedString = Base64.decode(imageMainUrl, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); images.add(bitmap); } } But the problem is that it never enter in the if section; how can I know if the element is empty or null? Thanks!
tagged with: android
upvote count: 1
type: AnsweredQuestion
has title: how to know if the Element class is empty or null in Jsoup
score: 1
tagged with: java

http://stackoverflow.com/q/26738464
has answer: http://stackoverflow.com/a/26739286
has answer: http://stackoverflow.com/a/69482709
tagged with: java
has title: Create multiple beans from one method in @Configuration class
has answer: http://stackoverflow.com/a/78279958
has comment: http://stackoverflow.com/comment/42063120
downvote count: 0
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/42062952
has answer: http://stackoverflow.com/a/26743044
has comment: http://stackoverflow.com/comment/42064849
has comment: http://stackoverflow.com/comment/42064393
answer count: 4
score: 8
type: UnansweredQuestion
has body: I am Spring for DI and am NOT using XML. Based on configuration (eg. an xml/properties file), I am looking to create a number of beans (exact number is determined by the configuration) of a specific type to put in my context so that they can be autowired into classes. I would autowire by: @Autowired public MyClass(List&lt;MyType&gt; types) I am looking at using an class annotated with @Configuration. So I can do something like this: @Configuration public MyConfigurationClass { @Autowired public void configure(ApplicationContext context) { // register stuff here } } ...but it doesn't "feel" right... What is the "Spring" way to achieve this? EDIT: Imagine this code, where To and Ty are just empty class definitions. @Configuration public class Config { @Bean public Collection&lt;Ty&gt; tyList() { return new ArrayList&lt;Ty&gt;() {{ this.add(new Ty()); // could be any number of Ty instances. }}; } @Bean public To to(Collection&lt;Ty&gt; tylist) { return new To(); } }
has comment: http://stackoverflow.com/comment/42063476
tagged with: spring
type: Question

http://stackoverflow.com/q/26723341
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26425002
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26723584
has body: I want to make possible that any file inside my project can be readable by any user, considering that they wont have the same directory as me. So i have this: String filme = "somefile.txt" String datastr = ""; reader = new BufferedReader( new FileReader("C:/Path"+filename)); String line = reader.readLine(); while( line != null) { datastr += line + "\n"; line = reader.readLine(); } Any help would be appreciated. Thanks in advance
has comment: http://stackoverflow.com/comment/42036361
answer count: 1
favorite count: 0
tagged with: path
linked to: http://stackoverflow.com/q/2914375
has title: How can I read a file txt that is inside the project?
has answer: http://stackoverflow.com/a/26723584
upvote count: 2
linked to: http://stackoverflow.com/q/320542
tagged with: file
downvote count: 1

http://stackoverflow.com/q/26747198
has body: I realize this isn't specifically a Java programming question, but it IS about how to run specifically Java, so please don't make this off topic. I'm working on a game, and I'm using Java as the programming language. I'd like to be able to "package" what I've been working on into either a .zip file or a setup.exe or a .msi install package, so I can send it to my friends to try it out. This is my question: How can I package a java based application for the common consumer, so that the end user only needs to install and run the game? The Problem: Running a java program requires a Java JRE to be installed. When I ask my friends to go to java.sun.com (oh, the good old days), they get redirected to Oracle, which gives about 150 links, NONE of them lead straight to the JRE. I have to click 2 links (if I know exactly what I'm looking for), and accept a license agreement longer that the longest filibuster in US history that I can't be bothered to read, and then they get to install the JRE, maybe, if their download servers don't bug out. Once that's done, they can open a command prompt, go to the directory where they've downloaded my game, and type: javaw -Dcharset.UTF-8 -d64 -Xms2g -Xmx4g -jar %INSTALL_DIR%/bin/mygame.jar mygame.Main -c %USER_DIR%/config/config.xml I can solve the problems above a developer, cause Eclipse manages half of it, and I know how to fix problems. Most Windows installer creators I've seen are just plain terrible. Is there an open source installer / patcher for Java Games? or something like that? If not, who's up for making one :) -Kai PS: Again, I realize this isn't technically a Java programming question, BUT it is a question directly related to Java and OS compatibility, and it's a huge gap that simple googling doesn't answer. Mods, please don't class this offtopic: Java's nature as a programming language may make it OS independent, but distribution of a Java application in the real world is a real hurdle, enough that it makes it a problem for th…
has comment: http://stackoverflow.com/comment/42080138
has title: Writing a game in Java... how do I get from running a command line to a Windows .exe?
tagged with: installation
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42079443
type: Question
downvote count: 0
favorite count: 0
tagged with: windows

http://stackoverflow.com/a/26718621
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42027700
score: 5
type: AcceptedAnswer
has body: The semicolon terminates your loop body; and then you have an anonymous block. Remove the semicolon. And your test should be something like, for (int index=0; index &lt; allowed.length; index++) // ; Unless you need index again later. Additionally, you can also print an array without a loop using Arrays.toString(Object[]) and something like System.out.println(Arrays.toString(allowed));
accepted answer of: http://stackoverflow.com/q/26718580
answers question: http://stackoverflow.com/q/26718580

http://stackoverflow.com/comment/42034151
has text: First of all, [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
comment on: http://stackoverflow.com/q/26722140
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/42079376
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26747132
has text: this code is impossible to read, which is most likely why you have made a mistake. Please learn to use an IDEA and the auto format functionality. Never post unformatted code here.

http://stackoverflow.com/comment/42106858
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26762640
type: AnswerComment
has text: @Narmer He's parsing 31/03/2013. The change didn't happen until 31/03/2013, 02:00 AM. So in 2013 he has the exact 30*24 hours, while in 2014 he has 1 hour less as the change happened on 3/30/2014.

http://stackoverflow.com/q/26733858
has body: I´ve got a project and I want to change the value of the progressbar with a call from another class. How could I implement this? static class ButtonActionListener implements ActionListener { @Override public void actionPerformed( ActionEvent e ) { new Thread( new Runnable() { @Override public void run() { for ( int i = 1; i &lt;= bar.getMaximum(); ++i ) { final int j = i; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { bar.setValue( j ); } } ); } } } ).start(); } }
tagged with: java
tagged with: jprogressbar
type: Question
has comment: http://stackoverflow.com/comment/42054452
has title: Change the jprogressbar in an other class
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26734125
has comment: http://stackoverflow.com/comment/42054753

http://stackoverflow.com/a/26806608
type: Answer
answers question: http://stackoverflow.com/q/26805435
has body: You might have another commit or rollback elsewhere in your code that's called before that commit. You might have multiple sessions open, and the one you're trying to commit isn't a multi-statement transaction. It's also worth checking for updates to the XCC jars and the server.
score: 0

http://stackoverflow.com/a/26829407
score: 0
has body: "in a class" does not quite describe what you'd like to achieve. The request holds the context of a portlet, the portlet class itself doesn't hold any members by design. If that portlet calls some other functionality, you might need to explicitly pass the parameter along, after extracting it from the request (as long as you have access to the request). A bit of sample code, as well as the underlying problem that you're trying to solve, would help quite a lot.
type: Answer
answers question: http://stackoverflow.com/q/26777941
has comment: http://stackoverflow.com/comment/42227903

http://stackoverflow.com/q/26762897
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/42107531
has comment: http://stackoverflow.com/comment/42107629
has comment: http://stackoverflow.com/comment/42107277
tagged with: console
has comment: http://stackoverflow.com/comment/42107070
tagged with: system.out
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42108026
has body: I have a project where I must send strings via terminal but I've detected that strings like "ç" or "ñ" are not displaying in terminal, they are replaced by "?" I´ve searched and tried this options and none of them resolves... Terminal image: Eclipse out: import java.io.*; public class Main { public static String toutf8(String s, int c) { try{ return (c &gt; 0) ? new String(s.getBytes("ISO-8859-1"),"UTF-8") :new String(s.getBytes("UTF-8"),"ISO-8859-1") ; } catch (java.io.UnsupportedEncodingException e) { return null; } } public static void main(String[] args) { // TODO Auto-generated method stub String co = "ç´+`qa-a.d,alnk123"; String iso; try { iso = new String(co.getBytes(),"ISO-8859-1"); String utf = new String(co.getBytes(),"UTF-8"); pt("Cadena original: " + co); pt("UTF-8:" + toutf8(co,1)); pt("Normal: " +toutf8(co,0)); pt("--------------------------------------"); pt("Intento contra getBytes:"); pt("Cadena original: " + co); pt("UTF-8: " + utf); pt("ISO-8859-1: " + iso ); pt("--------------------------------------"); pt("Intento con getBytes #2"); gb(co); pt("--------------------------------------"); pt("Intento con PrintWriter"); pw("Pw: " + utf); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } static void pt(String s){ System.out.println(s); } static void pw(String s){ PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); out.print(s); } static void gb(String s) throws UnsupportedEncodingException{ byte[] x = s.getBytes("UTF-8"); pt(x.toString()); } }
type: Question
has title: System.out.print and UTF-8 crashes in terminal and not in IDE (Eclipse)

http://stackoverflow.com/comment/41982622
comment on: http://stackoverflow.com/a/26693523
type: Comment
has text: @user3352472 That is different problem. But maybe before casting check if `getAttribute` returned `null`. You can first store result of `getAttribute` in `Object` reference like `Object tmp = session.getAttribute("yourAttribute");` and then depending on `if (tmp==null)` create `User user` using casting or not.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27089359
accepted answer of: http://stackoverflow.com/q/26683225
downvote count: 0
answers question: http://stackoverflow.com/q/26683225
score: 1
type: AcceptedAnswer
upvote count: 1
has body: Weblogic on very rare instances retains the old deployed file(of course it also depends on how the file was deployed) in the staging directory. Generally if there are inssues related to one weblogic server and not the other, stop the managed servers, deleting the tmp, stage or just moving it to a new directory and restarting the managed server makes the managed server pull the latest file and unzips it(stage keeps the war/ear file and tmp has the unzipped version). That most often fixes the issue.
type: Answer

http://stackoverflow.com/a/26730827
score: 5
accepted answer of: http://stackoverflow.com/q/26730778
upvote count: 5
answers question: http://stackoverflow.com/q/26730778
has body: It's not that straight-forward. You need a Class&lt;T&gt; that will hold the generic type after type erasure. Then, you have to invoke Class#getDeclaredConstructor(Class&lt; ? &gt; .. params) to trigger the desired constructor and create new instance dynamically. For example: public abstract class AbstractClass&lt;T extends MyClass&gt; { public AbstractClass(Class&lt;T&gt; clazz) { T t = clazz.getDeclaredConstructor(String.class).newInstance("test"); } }
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26715644
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26769281
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/26769281
type: Question
accepted answer: http://stackoverflow.com/a/26765887
answer count: 2
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/42112686
downvote count: 0
has body: I'm using Simple framework to deserialize an xml on my android app . The issue is on a portion of the xml because I can get the objects of the other portions of it . Here is the part of the xml that I struggle with : <webtv name="channelname" date="2014-10-31"> http://vodflash.channelname.com/tv_conn/1/country/ http://vodflash.channelname.com/tv_conn/1/country/pic/320x180/ http://vodflash.channelname.com/tv_conn/1/country/pic/160x90/ GB;IE Here is my XmlMapper class : @Root(name="webtv", strict = false) public class XmlModelMapper { public ConfigObject getConfigObjects() { return configObject; } @Element(name="config") public ConfigObject configObject = new ConfigObject(); @ElementList(name = "itemList") private List<Videos> itemList = new ArrayList<Videos>(); public List<Videos> getItemList() { return itemList; } @ElementList(name = "chaineList") private List<Chaine> chaineList = new ArrayList<Chaine>(); public List<Chaine> getChaineList() { return chaineList; } } If I change my mapper class to this : @Root(name="webtv", strict = false) public class XmlModelMapper { public List<ConfigObject> getConfigObjects() { return configObject; } //change is here using a list not an object @ElementList(name="config") public List<ConfigObject> configObjects = new ArrayList<ConfigObject>(); @ElementList(name = "itemList") private List<Videos> itemList = new ArrayList<Videos>(); public List<Videos> getItemList() { return itemList; } @ElementList(name = "chaineList") private List<Chaine> chaineList = new ArrayList<Chaine>(); public List<Chaine> getChaineList() { return chaineList; } } and the log the size of the List I get 4 which is correct , but how to get each object in a distinct way including the extension (attribute) Please help me solving this issue . Thanks
favorite count: 0
tagged with: simple-framework
has answer: http://stackoverflow.com/a/26765887
has title: Correct way to parse XML using Simple Framework
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42008903
type: Comment
has text: I understand the constructors I created, but I do not understand the boolean methods
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26708212

http://stackoverflow.com/a/26718505
answers question: http://stackoverflow.com/q/26718422
has body: This is a good start: public class MyComparator extends Comparator&lt;Date&gt; { public int compare(Date o1, Date o2){ return o1.getTime() - o2.getTime(); } } For example: TreeSet&lt;Date&gt; ts = new TreeSet&lt;Date&gt;(new MyComparator()); ts.add(new Date(98796541)); ts.add(new Date(59586541)); System.out.println("Earlier is " + ts.first());
type: Answer
score: 0

http://stackoverflow.com/comment/42051536
score: 1
comment on: http://stackoverflow.com/q/26732074
type: Comment
type: QuestionComment
has text: Show your code. How did you create the JDBC connection, what error did you get?

http://stackoverflow.com/comment/42143773
score: 1
type: Comment
type: QuestionComment
has text: it would be helpful if you provide details on something that you have tried
comment on: http://stackoverflow.com/q/26783278

http://stackoverflow.com/comment/42350785
has text: But we have to add throws Myexception in front of the function division, because we have throw, isn't it ?
type: Comment
comment on: http://stackoverflow.com/a/26808450
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42188132
comment on: http://stackoverflow.com/q/26807684
has text: Pls @Snowman what is SO ?, sorry I am a new here
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26719773
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42217342
has comment: http://stackoverflow.com/comment/42150727
favorite count: 0
has comment: http://stackoverflow.com/comment/42036794
has comment: http://stackoverflow.com/comment/42211056
has title: how to connect FBChat with android app
has comment: http://stackoverflow.com/comment/42154336
tagged with: android
has answer: http://stackoverflow.com/a/26824200
score: -1
has comment: http://stackoverflow.com/comment/42217298
type: UnansweredQuestion
has body: I want to connect FBChat with my app there is a code that im using to connect plz bt it is not connecting plz give me any solution. There is no any error but" Unfortunately app has stopped" FBConsoleChatApp.java package com.fb.xmppchat.app; import android.util.Log; import android.widget.Toast; import com.fb.xmppchat.helper.CustomSASLDigestMD5Mechanism; import com.fb.xmppchat.helper.FBMessageListener; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.Collection; import javax.net.ssl.SSLContext; import org.apache.commons.collections.BidiMap; import org.apache.commons.collections.bidimap.DualHashBidiMap; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.ChatManager; import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode; import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.Roster; import org.jivesoftware.smack.RosterEntry; import org.jivesoftware.smack.SASLAuthentication; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Presence; public class FBConsoleChatApp { public static final String FB_XMPP_HOST = "chat.facebook.com"; public static final int FB_XMPP_PORT = 5222; private ConnectionConfiguration config; private XMPPConnection connection; private BidiMap friends = new DualHashBidiMap(); private FBMessageListener fbml; public void connect() throws XMPPException { ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); config.setSecurityMode(SecurityMode.required); config.setRosterLoadedAtLogin(true); config.setTruststorePath("/system/etc/security/cacerts.bks"); config.setTruststorePassword("changeit"); config.setTruststoreType("bks"); config.setSendPresence(fal…
downvote count: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/42225330
has text: see [this] (https://code.google.com/p/promisedata/source/browse/trunk/npr/nrp-classic/example.txt) top few lines are some variables i need to collect , and i need to group data from 9th line and below
score: 0
comment on: http://stackoverflow.com/q/26828793
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42032482
score: 0
has text: You should try some print debugging to make sure you are entering your while loops properly and that the values are what you expect.
type: QuestionComment
comment on: http://stackoverflow.com/q/26721259
type: Comment

http://stackoverflow.com/a/26783982
upvote count: 15
has comment: http://stackoverflow.com/comment/125086444
has body: As already pointed out in the comments the stream will be processed in one pass, so there isn't really a need to change anything. For what it's worth you could use flatMap and let parse return a stream: Stream&lt;Result&gt; parse(String _line) { .. code here Result _result = new Result(). if (/* line is not needed */) { return Stream.empty(); } else { /** parse line into result */ return Stream.of(_result); } } public Stream&lt;Result&gt; parseFile(Path _file) { return Files.lines(_file) .flatMap(this::parse); } That way you won't have any null values in the first place.
answers question: http://stackoverflow.com/q/26779676
accepted answer of: http://stackoverflow.com/q/26779676
type: AcceptedAnswer
downvote count: 0
score: 15
type: Answer

http://stackoverflow.com/comment/42214640
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26818028
has text: However, is there any advice if I don't know any C or C++ at all? It might take a while to teach myself the language and I currently don't have that kind of time.
type: AnswerComment

http://stackoverflow.com/q/26745801
answer count: 0
tagged with: java
upvote count: 1
type: Question
tagged with: mongodb
has body: is it possible to add a @DBRef to a list which make a reference to himself. I think a example can explain my question: @Document(collection = "user") public class User { @Indexed(unique = true, direction = IndexDirection.DESCENDING, dropDups = true) private final String uname; ... @DBRef private List&lt;User&gt; contacts; // &lt;-- The Problem ... (Getter / Setters, etc.) } If I run the code the console give me the error: Caused by: com.mongodb.MongoException$DuplicateKey: { "serverUsed" ... Is it possible to fix my code or do I have to create a new Document for the reference? EDIT: I have a strange problem now. For testing I out commented the contacts variable in the user class. @Document(collection = "user") public class User { @Id private final String uid; @Indexed(unique = true, direction = IndexDirection.DESCENDING, dropDups = true) private final String uname; ... //private List&lt;String&gt; contacts; @DBRef private Role role; ... } But the error shows: duplicate key error index: test.user.$contacts.uname dup key: { : null }" , "code" : 11000} Where comes the $contacts.uname from if the contacts list is out commented? I already restart the mongodb server and delete my collections.
has title: Spring mongodb @DBRef on itself
downvote count: 0
score: 1
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/26712307
has answer: http://stackoverflow.com/a/26712351
type: Question
has answer: http://stackoverflow.com/a/26712585
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42015671
has title: What happens when a method returns null
type: UnansweredQuestion
has body: I am new to Java, and need to figure out process when a method return null and reference variable. Here is the code of the method: public Lot getLot(int lotNumber) { if((lotNumber &gt;= 1) &amp;&amp; (lotNumber &lt; nextLotNumber)) { // The number seems to be reasonable. Lot selectedLot = lots.get(lotNumber - 1); // Include a confidence check to be sure we have the // right lot. if(selectedLot.getNumber() != lotNumber) { System.out.println("Internal error: Lot number " + selectedLot.getNumber() + " was returned instead of " + lotNumber); // Don't return an invalid lot. selectedLot = null; } return selectedLot; } else { System.out.println("Lot number: " + lotNumber + " does not exist."); return null; } } What happens when a method returns null and reference variable, while having a class data type? Please explain in easy words.
tagged with: java
has answer: http://stackoverflow.com/a/26712444

http://stackoverflow.com/q/26815887
upvote count: 2
has body: I've moved from eclipse to intellij (13.1.4) . However - when I'm hovering a word , it doesn't offer nothing : Isn't intellij offers its own tooltip , signature , something ??? I'm not talking about the documentation window where you can see by ctrl+Q Currently - The only things I see is when I press ctrl + hover a word : Or via ctrl+Q : (I know I can also set it show when hover) Question Is there any setting which I don't know about which shows a tooltip or some information when hovering?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42212074
score: 1
tagged with: java
has title: IntelliJ IDE hover - offers nothing?
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26816037
has comment: http://stackoverflow.com/comment/42212080
has answer: http://stackoverflow.com/a/26816037
tagged with: intellij-idea
tagged with: jetbrains-ide
answer count: 2
has answer: http://stackoverflow.com/a/26820925
favorite count: 0
accepted answer: http://stackoverflow.com/a/26820925

http://stackoverflow.com/a/26711576
has comment: http://stackoverflow.com/comment/42014902
has comment: http://stackoverflow.com/comment/42091880
downvote count: 0
has comment: http://stackoverflow.com/comment/42018746
has comment: http://stackoverflow.com/comment/42025439
has body: you do not need to store every T(i), you only need to store 3 values T(i-1), T(i-2), T(i-3). While looping over i, check if the current i should be part of your output, if so put it out immediately or save it to an "output"-array. edit: this part is quite inefficient. You check in every iteation EVERY needed output. for (int k = 0; k &lt; arr.length; ++k) { if (count == arr[k]) T[k] = temp[i]; else if (arr[k] == 1) T[k] = 1; else if (arr[k] == 2) T[k] = 3; else if (arr[k] == 3) T[k] = 3; else if (arr[k] == 4) T[k] = 1; } so your code runs in time (max*arr.length) you can reduce it to only (max). Use a HashMap with key=neededPosition (=count) value=position in arr Init the map like this: Map&lt;Long, Integer&gt; map = new HashMap&lt;Long, Integer&gt;(); for (int i = 0; i &lt; arr.length; i++) { map.put(arr[i], i); } if (map.containsKey(count)) { T[map.get(count)] = temp[i] } check the values 1-4 just once after the whole thing!
has comment: http://stackoverflow.com/comment/42015698
score: 4
has comment: http://stackoverflow.com/comment/42018908
answers question: http://stackoverflow.com/q/26711407
type: Answer
upvote count: 4

http://stackoverflow.com/comment/42107073
type: Comment
has text: I just added the thirdMove code to my original post. Please forgive my redundant code. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26762536

http://stackoverflow.com/comment/42206398
type: Comment
type: QuestionComment
has text: you asked this question before, you need go to Parse forum to find your problem , this is not a good place for asking this question
comment on: http://stackoverflow.com/q/26818104
score: 0

http://stackoverflow.com/comment/42213140
has text: My void type on setRadius is not allowed system.out.println
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26821851

http://stackoverflow.com/comment/42065838
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26738862
has text: @njzk2 i get "java.lang.NullPointerException" i use that

http://stackoverflow.com/comment/42428667
type: AnswerComment
score: 0
type: Comment
has text: It should fix it. If it doesn't we will figure out. Lets start from something atleast?
comment on: http://stackoverflow.com/a/26861228

http://stackoverflow.com/a/26683065
has comment: http://stackoverflow.com/comment/41964706
type: Answer
has comment: http://stackoverflow.com/comment/41964692
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26682967
has body: Since your elements appear to be Comparable, you can do two things: Use Collections.sort to sort them in ascending order (lowest to highest), Then use Collections.reverse to reverse the order. Both of these operations modify the list in place. If this is undesirable, copy the contents of the list to an intermediate list and modify that. Collections.sort(sortedList); Collections.reverse(sortedList); You could copy the contents to an intermediate list, and mutate that as well: List&lt;Rational&gt; sortedList = new ArrayList&lt;Rational&gt;(); for(Rational rational : list) { sortedList.add(rational); } Collections.sort(sortedList); Collections.reverse(sortedList);
downvote count: 0

http://stackoverflow.com/comment/42072570
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26739765
has text: @StackFlowed Tigerus bump! - if I do System.out.println(p); i don't get null - would be very grateful of some help! :)

http://stackoverflow.com/comment/42066458
type: Comment
has text: [com.sun.javafx.css.StyleManager](http://grepcode.com/file/repo1.maven.org/maven2/net.java.openjfx.backport/openjfx-78-backport/1.8.0-ea-b96.1/com/sun/javafx/css/StyleManager.java) seems to be part of OpenJDK and not found on Oracle's JDK. Mixing these implementations can be tricky. Maybe you can uninstall the JDKs and leave only one.
type: QuestionComment
comment on: http://stackoverflow.com/q/26679385
score: 0

http://stackoverflow.com/comment/42168116
type: Comment
comment on: http://stackoverflow.com/q/26796986
score: 0
type: QuestionComment
has text: @ScaryWombat what in eclipse?does it act different in different ide?

http://stackoverflow.com/q/26815838
tagged with: arraylist
has answer: http://stackoverflow.com/a/26816005
accepted answer: http://stackoverflow.com/a/26816005
score: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42202661
has comment: http://stackoverflow.com/comment/42202847
type: AnsweredQuestion
tagged with: list
tagged with: java
type: Question
has body: I have an xml like this one: <?xml version="1.0" encoding="UTF-8"?> qwe 1 asd 1 asdfg 1 asdfg 4 zxc 2 AAAA 1 BBBB 1 CCCC 13 DDDD 12 EEEE 21 CCCC1111 13 DDDD1111 12 EEEE1111 21 G 1 H 13 I 12 Now I want to print it out in the "same" structure. I created a method, but the output differs from expectes: Run. class public class Run { public static void itarate(List list){ for (int i = 0; i<list.size(); i++){ System.out.println(list.get(i).getDesc() + " x " + list.get(i).getQty()); if (list.get(i).getListParts() != null){ System.out.print(" -- "); itarate(list.get(i).getListParts()); } } } public static void main(String[] args) { Converter converter = new XML_Converter(); Plane plane = converter.readFile(); //System.out.println(plane); List parts = plane.getPlaneParts(); itarate(parts); } } The output: qwe x 2 AAAA x 1 BBBB x 1 CCCC x 13 DDDD x 12 EEEE x 21 CCCC1111 x 13 DDDD1111 x 12 EEEE1111 x 21 G x 1 H x 13 I x 12 but I actually want something like: qwe x 2 AAAA x 1 BBBB x 1 CCCC x 13 DDDD x 12 EEEE x 21 CCCC1111 x 13 DDDD1111 x 12 EEEE1111 x 21 G x 1 H x 13 I x 12 XML To object Class: public class XML_Converter{ private String filePath = "D:\\file.xml"; private File file = new File(filePath); @Override public Plane readFile() { try { JAXBContext jaxbContext = JAXBContext.newInstance(Plane.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Plane plane = (Plane) jaxbUnmarshaller.unmarshal(file); return plane; } catch (JAXBException e) { System.out.println("Unable to load file. Try again."); } return new Plane(); } Plane class @XmlRootElement public class Plane { private List planeParts = null; @XmlElement(name="part") public List getPlaneParts() { return planeParts; } public void setPlaneParts(List planeParts) { this.planeParts = planeParts; } @Override public String toString() { return "Plane [planeParts=" + planeParts + "]"; } } Parts.class public class Part { private String desc; private int qty; private List listParts = null; @XmlElement(name=…
has comment: http://stackoverflow.com/comment/42203193
has title: order a list like in xml schema java
answer count: 1

http://stackoverflow.com/comment/42165551
type: AnswerComment
score: 0
type: Comment
has text: This gets really complicated for such a simple task. Now I definetly would recommend to use a library. Provided an example in my answer.
comment on: http://stackoverflow.com/a/26779564

http://stackoverflow.com/comment/42071525
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26740415
has text: Why would having 5000 objects prevent you from using this approach?
score: 0

http://stackoverflow.com/q/26811079
answer count: 3
type: UnansweredQuestion
has body: I got a question. Is there a simple solution to iterate over the list that is inside of a list and inside of a list again? So my point is I have few of lists inside of each other (based on xml unmarshall) and I sometimes do not know how deep is the structure. Exsample: class Car{ private List&lt;Door&gt; } class Door{ private List&lt;Parts&gt; } class Parts{ private List&lt;Some1&gt; } } class Some1{ private List&lt;Some2&gt; } So how can iterate from Car to Some2 without knowing if there is a list or is empty in a "good way"? I mean without 5-times nested "for" loops mixed up with another 6 "if's".
has answer: http://stackoverflow.com/a/26811524
has comment: http://stackoverflow.com/comment/42194711
has comment: http://stackoverflow.com/comment/42194712
has answer: http://stackoverflow.com/a/26811818
has comment: http://stackoverflow.com/comment/42194680
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42194666
has title: Iterate list inside list inside list java
has answer: http://stackoverflow.com/a/26811113
tagged with: list
tagged with: java

content-disposition
tags question: http://stackoverflow.com/q/26719754
type: Tag
tag name: content-disposition

http://stackoverflow.com/comment/42053203
comment on: http://stackoverflow.com/a/26733084
type: Comment
has text: No. October is represented by 9. Since January starts from 0.
type: AnswerComment
score: 4

http://stackoverflow.com/q/26692689
has title: Java calculator using switch case
tagged with: java
has comment: http://stackoverflow.com/comment/41980955
has answer: http://stackoverflow.com/a/26692721
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26692757
has comment: http://stackoverflow.com/comment/41980964
tagged with: calculator
has comment: http://stackoverflow.com/comment/41980975
type: UnansweredQuestion
score: 0
has body: My requirement - calc method should take two numbers from main, and calc will perform all the operations. Everything goes fine until a problem occurs in switch command. I get the error "choice cannot be resolved to a variable". import java.util.Scanner; public class Learn { public static void main(String args[]) { int firstnumber, secondnumber, choice; System.out.println("1- Add"); System.out.println("2- Sub"); System.out.println("3- Div"); System.out.println("4- Mul"); System.out.print("Enter your choice -"); Scanner var = new Scanner(System.in); choice = var.nextInt(); System.out.print("Enter first number -"); firstnumber = var.nextInt(); System.out.print("Enter second number -"); secondnumber = var.nextInt(); calc(firstnumber, secondnumber); } public static void calc(int x, int y) { int c; switch (choice) { case 1: c = x + y; System.out.print("Output-" + c); break; case 2: c = x - y; System.out.print("Output-" + c); break; case 3: c = x / y; System.out.print("Output-" + c); break; case 4: c = x * y; System.out.print("Output-" + c); break; } } } What am I missing, and how can I fix this?

http://stackoverflow.com/comment/42122112
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26770904
has text: Renaming does work, but it is ugly, because I use the variables many times in the initializer block, and they would be more meaningful with their proper names. I was wondering if there was something better.
score: 0

http://stackoverflow.com/comment/41963566
type: AnswerComment
has text: Thank you, that was the clearest explanation I've seen so far.
comment on: http://stackoverflow.com/a/26679752
type: Comment
score: 1

http://stackoverflow.com/comment/42089179
score: 0
type: AnswerComment
type: Comment
has text: I liked your answer but edited a little. And up vote. :)
comment on: http://stackoverflow.com/a/26752808

http://stackoverflow.com/comment/42217516
comment on: http://stackoverflow.com/q/26824108
has text: We're confused about where you need "minimum bytes taken". When you write to a file, you can write an integer in as many bytes as you want - 1, 2, 4, 6, 27. You just need enough bytes to represent the number, *and* you need to somehow know how many bytes the number occupies when you read it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41970477
comment on: http://stackoverflow.com/a/26686098
type: Comment
has text: Well, I compiled your program and ran it. Yes the problem is that line. When it hits the first operator, the next will be empty because the char is an operator (since it's recursive, that operator will be the FIRST char at the index for that particular recursive call). You need to make next a member instead of a local var. But then after that there's an array out of bounds error, so look into that next. Your code is not very clear. I would write down on paper the algorithm you're using and try to clarify it. Then do the coding.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26827345
has comment: http://stackoverflow.com/comment/42222959
score: 1
tagged with: java
has body: I am developing a webapp running on Tomcat7, and using maven for dependencies/automated builds. Yesterday I started using the sass-maven-plugin, which is great. Its goal sass:update-stylesheets processes sass files and outputs css. Unfortunately, I can't have it executed during the webapp packaging. I am pretty new to maven too, so I might have missed something. Here's my understanding : when I type mvn tomcat7:deploy, maven executes the deploy goal defined in the tomcat7 plugin this plugin goes through some phases of the development lifecycle. More specifically, as mentioned in the doc, it "invokes the execution of the lifecycle phase package prior to executing itself." if I map the goal sass:update-stylesheets to the package phase in , it should be executed everytime I deploy/redeploy my app. When I run mvn sass:update-stylesheets independently of tomcat7:deploy, everything is smooth. sass-maven-plugin gets the .scss files from src/main/resources, processes them and places the output in src/main/webapp/resources, where I want it to be to be deployed with my webapp. Unfortunately, if I don't run the command prior to tomcat7:deploy, I don't get any css for my pages. What did I get wrong? Also, is there any way I could map the sass:update-stylesheets to the phase process-resources, for instance, which would make more sense? Lastly, if this all works, will Eclipse's incremental build pick it up? Here's my pom.xml (the relevant parts) ... org.apache.tomcat.maven tomcat7-maven-plugin 2.2 ... org.jasig.maven sass-maven-plugin 1.1.1 generate-css package update-stylesheets true ${basedir}/src/main/resources ${basedir}/src/main/webapp/resources Thanks in advance for your help.
has comment: http://stackoverflow.com/comment/42222614
has comment: http://stackoverflow.com/comment/42222978
has comment: http://stackoverflow.com/comment/42222781
tagged with: eclipse
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42222885
has comment: http://stackoverflow.com/comment/42222552
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26827624
has comment: http://stackoverflow.com/comment/42222731
has comment: http://stackoverflow.com/comment/42222660
has comment: http://stackoverflow.com/comment/42222846
has comment: http://stackoverflow.com/comment/42222729
favorite count: 0
has title: How to bind SASS plugin goal to tomcat7 deploy phase (maven)
has comment: http://stackoverflow.com/comment/42222836
has comment: http://stackoverflow.com/comment/42223007
has comment: http://stackoverflow.com/comment/42222797
has comment: http://stackoverflow.com/comment/42222676
tagged with: maven
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26827624
type: AnsweredQuestion
tagged with: sass

http://stackoverflow.com/comment/42217074
type: AnswerComment
has text: So I take you never use 3rd party libraries, because you can do that yourself to? All it says to me (IMHO) is lack the understand of what the API is and how it can be used. You don't even need to use the inbuilt layout managers, you could use something like MigLayout, which is highly favoured for its high level of flexibility...
type: Comment
comment on: http://stackoverflow.com/a/26822662
score: 0

http://stackoverflow.com/comment/41986525
type: QuestionComment
comment on: http://stackoverflow.com/q/26695491
score: 0
has text: The overridden endit does call super.endit but it also does a load of other stuff first - which is definately not being run (breakpoints don't fire etc. etc.).
type: Comment

http://stackoverflow.com/a/26775939
answers question: http://stackoverflow.com/q/26743906
score: 3
has body: I'd recommend you start with expression evaluation using the Shunting-yard algorithm. It's very easy to implement using 1 or 2 stacks (depending upon whether you output RPN notation or execute immediately). I've used the shunting-yard algorithm for several little interpreters for math expressions (discussion). For functions, of course you'll need to define a structure to hold all the function's information like number of variables, local variable names, and some representation of the function's code which can be executed. If you use a call stack, you can push the local arguments on to the stack. You will then need to "compile" the executable representation so it uses stack offsets instead of the variable names. Alternately, you can use a stack of hash-tables as a namespace stack. You will then need to lookup variables in each hash-table from the top down until the variable is found. With either of these ways, local variables will obscure global variables with the same name (which is what you want). With the shunting-yard algorithm, you will need to perform some book-keeping in response to the parentheses. So, with your example PRINT whatever(5, 6) PRINT is presumably recognized as a statement-type which executes the following expression and then prints the result. So you'll see this expression as several distinct tokens. whatever ( 5 , 6 ) whatever can be discovered to be a function-name if it was previously defined. But if you want to allow functions as first-class citizens, this still might not be a function-call until you see the parens. (Maybe you want to just print the code of the function.) An identifier followed by a left paren ( however, is clearly the start of a function call. We then need to recursively evaluate each comma-delimited expression, and arrange for these results to be used as the arguments to the function. With the call-stack method, just push the two results. With the namespace stack, define the two variables and push the hash-table. Then call…
upvote count: 3
has comment: http://stackoverflow.com/comment/42175759
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42192253
type: Answer
accepted answer of: http://stackoverflow.com/q/26743906

http://stackoverflow.com/comment/42146872
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26773829
has text: I'm not asking about your code. I'm asking about the result you want if those cases happen.

http://stackoverflow.com/q/26689006
has title: My JFrame always becomes a few pixels too big.
has answer: http://stackoverflow.com/a/26689041
has body: I am working on this game in Java, and I just rewrote all my window related code from being based on java.awt to javax.swing. Soon after, I realized that things were a bit more complicated now, and so i did some research and and found out how to draw things, how to set the size of a JFrame, etc. But for some reason, the size of my JFrame always goes 10 pixels beyond the size I've specified it to become. In this case, I wanted it to be 640 by 640 pixels. Here's my code: package chrononaut; import java.awt.*; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; @SuppressWarnings("serial") public class GameJFrame extends JFrame { //Background color: static Color bgrCol = new Color(12, 4, 64); //Size: final static int size = 640; //The component that does the actual drawing: static GameJComp drawingComp = new GameJComp(); //Constructor: public GameJFrame() { //Calling super() and setting the title: super("Chrononaut"); //Setting icon image: try { Image icon = ImageIO.read(getClass().getResource("/icon/icon 1.png")); setIconImage(icon); } catch (IOException e) {} //make it closable: setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Setting the size: Container c = getContentPane(); Dimension d = new Dimension(size, size); //for some reason, it goes 10 pixels beyond the given values c.setPreferredSize(d); pack(); //Adding the drawing component to the content pane: getContentPane().add(drawingComp); //Making sure the window size stays constant: setResizable(false); //Centering position: Toolkit tk = Toolkit.getDefaultToolkit(); Dimension s = tk.getScreenSize(); setLocation(s.width/2-getWidth()/2, s.height/2-getHeight()/2); //Background color: setBackground(bgrCol); //Make it visible: setVisible(true); } public void drawAll() { drawingComp.drawAll(); } public void closeGame() { dispose(); System.exit(0); } } When I run it, the space inside the borders of the JFrame appears to have a size of 650 pixels, not 640, even when I call setPreferredSize(d).…
favorite count: 0
tagged with: size
type: AnsweredQuestion
score: 3
tagged with: jframe
upvote count: 3
accepted answer: http://stackoverflow.com/a/26689041
tagged with: swing
type: Question
tagged with: dimension
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/a/26751263
answers question: http://stackoverflow.com/q/26744379
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: The classes directory itself must be in the classpath. Not all its files: java -cp /path/to/WAR/WEB-INF/lib/*:/path/to/WAR/WEB-INF/classes
accepted answer of: http://stackoverflow.com/q/26744379
type: Answer

http://stackoverflow.com/q/26767180
tagged with: sql-server
has answer: http://stackoverflow.com/a/26782733
tagged with: eclipselink
downvote count: 0
has comment: http://stackoverflow.com/comment/42115645
has comment: http://stackoverflow.com/comment/42119212
favorite count: 0
has answer: http://stackoverflow.com/a/26767520
type: UnansweredQuestion
has title: EclipseLink record insert returns wrong id
upvote count: 1
tagged with: scope-identity
score: 1
tagged with: java
has body: MSSQL(2008) and EclipseLink(2.4) I'm inserting into a table with a trigger which does an insert into another table When this happens EclipseLink returns the id of the record inserted into the other table by the trigger. I assume I can get the correct id by getting EcliipseLink to use SCOPE_IDENTITY() instead of @@IDENTITY. The question is how to do this? I need a solution for EclipseLink (JPA), I know how to get the id using sql.
type: Question
answer count: 2

http://stackoverflow.com/a/26736851
answers question: http://stackoverflow.com/q/26736503
upvote count: 2
has comment: http://stackoverflow.com/comment/42060129
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42061440
has body: First of all, you have nested forms, which you should get rid of. As for question you should inspect the specific html element (for example by using firebug) to find out the id of it.
downvote count: 0

http://stackoverflow.com/a/26739608
has comment: http://stackoverflow.com/comment/42105417
downvote count: 0
has comment: http://stackoverflow.com/comment/42087973
has comment: http://stackoverflow.com/comment/42065423
type: Answer
has comment: http://stackoverflow.com/comment/42065167
answers question: http://stackoverflow.com/q/26739357
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42065292
has body: Instead of passing World with every Bug-method as a parameter, you can also just do it once in a Bug's constructor and save it in a variable-field of ABug, like so: In Main: public static void main(String[] args){ AWorld world = new AWorld(...); ABug[] bugs = new ABug[amount]; for(int i = 0; i &lt; amount; i++) bugs[0] = new ABug(..., world); } In ABug: private AWorld world; public ABug(..., AWorld w){ this.world = w; ... } public void someMethodNeedingWorld(...){ world.methodYouNeedFromWorld(); ... } You can also try what #StackFlowed said and make AWorld a Singleton: In AWorld: private static AWorld instance; private AWorld(){ } // private constructor for Singleton pattern public static AWorld getInstance(){ if(instance == null) instance = new AWorld(); return instance; } In Main: public static void main(String[] args){ ABug[] bugs = new ABug[amount]; for(int i = 0; i &lt; amount; i++) bugs[0] = new ABug(...); } In ABug's methods where you need AWorld: public void someMethodNeedingWorld(...){ AWorld.getInstance().methodYouNeedFromWorld(); ... } Personally I would go for the Singleton pattern, since this is what they are designed for. This also makes sure you only have a single AWorld instance during your entire application. (If you want to be able to create multiple Worlds at some state, I would suggest the first method.) EDIT: If you want to make future adjustments by having multiple AWorlds in the same application, or use UnitTests, the Singleton Pattern isn't a very good idea, since it can only work with 1 AWorld-instance at a time, doesn't matter if its a UnitTest or not. So in that case, I recommend the first option, by just sending the AWorld object to the ABug's constructor and saving it in ABug, instead of sending it as parameter with every method of ABug. Still, if you never want to use UnitTests or make adjustments (can't recommend that, but it's up to you..), the Singleton Pattern could be used here.

http://stackoverflow.com/comment/42075568
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26744636
type: QuestionComment
has text: It's the server that produces the error, not the client's POST request. How does the REST end-point look like? Have you tried to perform the request using a REST client like Postman (http://www.getpostman.com/)?

http://stackoverflow.com/a/26746776
has comment: http://stackoverflow.com/comment/42096291
type: Answer
answers question: http://stackoverflow.com/q/26737144
has body: javafx.net.ssl.keyStore That should be javax.net.ssl.keyStore Same for the other three. You need to put these files elsewhere. Your user directory won't be there on the target machines. And of course you need to set these properties before creating any remote objects that rely on them.
has comment: http://stackoverflow.com/comment/42090260
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42101936
accepted answer of: http://stackoverflow.com/q/26737144

http://stackoverflow.com/comment/42110422
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26764771
score: 1
has text: ... and the error, please

http://stackoverflow.com/comment/42219985
score: 0
has text: Are you sure the full dataset is getting returned in the first place?
comment on: http://stackoverflow.com/q/26825792
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26673790
answers question: http://stackoverflow.com/q/26673581
downvote count: 1
score: 3
has body: The reason why you don't find any software that is able to extract page numbers from a PDF is simple: the concept of a page number doesn't exist in PDF. Allow me to predict your response. *"Wait a minute!" you say, "When I open a PDF in Adobe Reader, I can clearly see a page number in the document!" Well yes, you can see that page number with your eyes and your human intelligence, but to a machine that number is just some text drawn on a canvas. A machine consuming the document has no idea what all the glyphs and lines and shapes on a page are about. Hence, software can not give you the page number you see as a human. A machine doesn't know where to look! If you know something about PDF, I can predict your next reply. "Wait a minute!" you say, "What about Tagged PDF? Doesn't Tagged PDF mean that the semantics of a document are stored along with the representation?" Well yes, when a PDF is tagged a snippet of text knows that is is part of a title, or a paragraph, or a list,... But Tagged PDF is there to define the structure of the real content. Page numbers however, are not part of the real content. They are marked as artifacts along with headers, footers and other items on a page that are not considered being real content. There is no way to distinguish page numbers. "Then what are these page labels about?" you ask. Well, page labels are optional. They are present in some PDFs that are well conceived, but they will be absent in a large majority of the PDFs you'll find in the wild. This is the long answer. The short answer is simple: You are asking for something that is impossible (in general, not only with iText, Tika, PdfBox, or any other tool you might try).
accepted answer of: http://stackoverflow.com/q/26673581
upvote count: 4
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42200826
type: Comment
has text: Please wrap your logcat by code
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26814614

http://stackoverflow.com/q/26683059
type: UnansweredQuestion
has body: I am using Powershell to run a script which updates a website by calling its main update utility class which calls other classes. The problem is it runs the first Class (UpdateDBTableType1) but not the others. If I run the class in eclipse it calls all Update Classes in sequence as expected. What could be the problem? Powershell Script: java -classpath 'lib\*;.' UpdateWebsite | tee-object -filepath "F:\Java Workspace\UpdateWebsiteOutput\log.txt" Main Utility Class: public class UpdateWebsite { public static void main(String[] args) throws Exception { UpdateDBTableType1.main(arguments); UpdateDBTableType2.main(arguments); UpdateSiteMap.main(arguments); CreateImages.main(arguments); } }
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: powershell
has comment: http://stackoverflow.com/comment/41966406
has title: Running a Java Class which runs other class
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41965326

http://stackoverflow.com/comment/42198507
has text: What? What do you mean by _all memory filled up with a high precision number_? Please give an example.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26813322
type: QuestionComment

http://stackoverflow.com/q/26769989
has answer: http://stackoverflow.com/a/59501921
has body: In a Spring MVC app using Hibernate and JPA. Hibernate is creating an excessively complex query with 78 joins when only a small number of joins should be necessary. I am using InhertanceType.JOINED. To simplify the problem and experiment, I commented out lots of properties in the relevant entities, and I also cut and pasted code from parent classes into subclasses in order to reduce the amount of inheritance. This reduced the number of tables that should be included in joins to 8. But yet when I try an EntityManager.persist() on one of the entities, hibernate generates joins that should not be included. How can I isolate the problem in my code? You can view a class diagram of the 8 to 12 classes that should be included in joins by clicking on this link. It is a JPEG file that you can enlarge in your browser by clicking on it. There are only 8 to 12 classes that might be included in joins, but Hibernate is including an additional 12 unrelated tables in the joins, which is completely unnecessary. Why? Here is a list of the Entities that should not be included in the joins: PQ QTY ANY_ SXCMPQ IVLPQ BXITIVLPQ HXITPQ PPDPQ SXCMPPDPQ IVLPPDPQ IVXBPPDPQ IVXBPQ Here is a list of Entities that should be included in the joins: Person LivingEntity rimEntity Role CD TS II EN Here is the DAO method that is throwing the problem: @Override public void saveRIMPerson(Person myperson) throws DataAccessException{ if (myperson.getHppid() == null) {this.em.persist(myperson);}//EXCESSIVE SQL CREATED HERE else {this.em.merge(myperson);} } Here are the joins in the resulting SQL: Hibernate: select `lots of properties` from rim_entity person0_ left outer join CD cd1_ on person0_.classCode_HJID=cd1_.HJID left outer join TS ivlts2_ on cd1_.VALID_TIME_HXITCE_HJID=ivlts2_.HJID left outer join II ids3_ on person0_.hppid=ids3_.ids_entity_HJID left outer join CD cd4_ on person0_.administrativeGenderCode_HJID=cd4_.HJID left outer join TS ts5_ on person0_.birthTime_HJID=ts5_.HJID left outer join PQ …
has title: Hibernate generating excessive number of joins in select query
has answer: http://stackoverflow.com/a/26773917
accepted answer: http://stackoverflow.com/a/26773917
score: 1
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/59501921
tagged with: jpa
downvote count: 1
linked to: http://stackoverflow.com/q/438146
favorite count: 0
has comment: http://stackoverflow.com/comment/42120694
has comment: http://stackoverflow.com/comment/42120664
has comment: http://stackoverflow.com/comment/42148953

http://stackoverflow.com/comment/42230203
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26831798
has text: Check if you did like it https://github.com/angelozerr/angularjs-eclipse/wiki/Getting-Started
score: 0

http://stackoverflow.com/a/63156157
has body: Here, is a method to convert a given Queue to Stack: public static void QueueStack(Queue<Integer> queue){ Stack<Integer> stack = new Stack<>(); for(Integer in: queue){ stack.push(in); } //Here, the output would be same as you inserted elements.As stack uses iterator which prints elements as they are inserted(a bug in stack iteration) System.out.println("Stack: "+stack); //You can use java 8 for-each style as well. stack.forEach(System.out::println); //If you want to traverse stack in LIFO manner.. while(stack.isEmpty){ System.ou.println(stack.pop()); } //For better performance ArrayDeque<>() is preferred! Deque<Integer> stack = new ArrayDeque<Integer>(); }
type: Answer
answers question: http://stackoverflow.com/q/26748947
score: 0

http://stackoverflow.com/q/26820462
tagged with: recursion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42212124
upvote count: 1
type: Question
has title: Java 1.8 recursive lambdas
has comment: http://stackoverflow.com/comment/42210813
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26821673
favorite count: 0
type: UnansweredQuestion
tagged with: lambda
has body: I do understand the forward reference error, but why do I have to go through the following to define n! ? I have commented out the errors and added the compiler errors I see. import java.util.function.Function; class Recursion { Function&lt;Integer, Integer&gt; factorial_lambda = null; int factorial_imp(int i) { if (i == 1) return 1; else return i * factorial_imp(i - 1); } /* Function&lt;Integer, Integer&gt; factorial_lambda = (i) -&gt; { if (i == 1) return 1; else return i * (factorial_lambda.apply(i - 1)); // error: self-reference in initializer }; */ public static void main(String[] args) { new Recursion(); } public Recursion() { /* Function&lt;Integer, Integer&gt; factorial_lambda = (i) -&gt; { return 1; }; // variable used in lambda expression should be final // or effectively final; // Function factorial_lambda = (i) -&gt; { ... //error: imcomparable types: Object and int if (i == 1) //error: bad operand types for binary operator '-' apply(i - 1) */ factorial_lambda = (i) -&gt; { if (i == 1) return 1; else return i * (factorial_lambda.apply(i - 1)); }; System.out.println(factorial_imp(5)); System.out.println(factorial_lambda.apply(5)); } }

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/26686917
tags question: http://stackoverflow.com/q/26731745
tags question: http://stackoverflow.com/q/26732707
type: Tag

http://stackoverflow.com/q/26793175
has title: How do you prompt a user for an input in java
answer count: 5
accepted answer: http://stackoverflow.com/a/26793394
possible better answer: http://stackoverflow.com/a/26793241
has answer: http://stackoverflow.com/a/26793440
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26793375
downvote count: 0
tagged with: variables
has answer: http://stackoverflow.com/a/26793435
favorite count: 0
tagged with: integer
tagged with: java.util.scanner
type: Question
upvote count: 2
has body: So I just started learning Java, its literally like my 1st day and I wanted to try to make a coinflip game. I already know a decent amount of JavaScript and so i was trying to apply that knowledge to Java. So everything has been working so far except one thing: Prompting a user for a choice. So read online that i have to import a scanner so i did that as you can see from my code. I also tried some code where you can have the user import a string but you can see a bit later in my program I change the variable userChoice into a number. So basically I just need help with this. If there is some way to have a variable type that can store both numbers or strings that would be best. But I'm totally open to other ways of doing this! Here is the code: package test; import java.util.Scanner; public class testclass { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("hi"); int bob; bob = (int) Math.floor(Math.random()*2); System.out.println(bob); System.out.println("Enter heads or tails?"); System.out.println("You entered "+ userChoice); if (bob == 0) { System.out.println("Computer flipped heads"); } else { System.out.println("Computer flipped tails"); } if(userChoice == "Heads") { userChoice = 0; } else { userChoice = 1; } if (userChoice == bob) { System.out.println("You win!"); } else { System.out.println("Sorry you lost!") } } }
has comment: http://stackoverflow.com/comment/42161497
tagged with: java
tagged with: import
has answer: http://stackoverflow.com/a/26793394
has comment: http://stackoverflow.com/comment/42162086
has answer: http://stackoverflow.com/a/26793241
has comment: http://stackoverflow.com/comment/42161507

http://stackoverflow.com/comment/42222413
has text: I have edited my question to show you an example of my code. Anyway, I do not understand if I need to rebuild it using map&Reduce paradigm or if there is a way to avoid that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26827173

http://stackoverflow.com/q/26795425
answer count: 1
downvote count: 0
has title: Adjusting page or limit from last.fm api in java eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/42219920
accepted answer: http://stackoverflow.com/a/26854868
tagged with: last.fm
has comment: http://stackoverflow.com/comment/42165177
has comment: http://stackoverflow.com/comment/42165591
upvote count: 1
has body: I`m Student I am using current last.fm Developer api at java eclipse. But the problem occurred during use. I wanted metadata values of a large amount. But result is only 50 pieces. I know that the default value is 50. So, I have adjusted Page or limit but the result still shows 50 pieces. What is reason? public static void main(String[] args) { String key="#########"; String tag = "ballad"; int limit = 100; int page = 2; int i = 1; Chart&lt;Artist&gt; I3 = Tag.getWeeklyArtistChart(tag, page, key); Iterable&lt;Artist&gt; tag3 = I3.getTopArtists(page, key); for (Artist artist : tag3) { System.out.println("["+i+"]"+""+artist.getName()); i++; } } result [1]Drake [2]Ellie Goulding . . . . [50]One Direction
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26854868
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41971460
score: 0
type: AnswerComment
has text: stmt.setDate(1, new java.sql.Date()) exists in my code . So where is the problem ?
type: Comment
comment on: http://stackoverflow.com/a/26686839

http://stackoverflow.com/comment/42126856
type: QuestionComment
comment on: http://stackoverflow.com/q/26733028
type: Comment
has text: Sounds good. Some way to listen to updates to the/some elements would be really helpful.
score: 0

http://stackoverflow.com/q/26745807
tagged with: jsoup
has answer: http://stackoverflow.com/a/26789709
tagged with: eclipse
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26746001
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26746032
has title: Building Android Library Project Using Jsoup Library
has body: I have a android library project(say SampleLibProject which generates a jar in bin as samplelibproject.jar) which uses Jsoup library to read href attribute from a tag. And In my android App, If I add reference of library using (Project Properties -> Android and browsing library project) App works OK without any issue as I dont require to copy Jsoup in my Android app libs. But If I add samplelibproject.jar in libs of Android App without Jsoup library I get an Exception that java.lang.NoClassDefFoundError: org.jsoup.Jsoup. So my question is how can I build SampleLibProject so that there will be no need of adding Jsoup jar in Android App? As I am not going to distribute sources of LibProject (I will just give samplelibproject.jar to clients ) and don't want to force them to include jsoup library in there android project. Thanks in advance.
tagged with: java
type: Question

http://stackoverflow.com/q/26763145
has title: How to write Unicode in java without displaying ASCII Code?
has comment: http://stackoverflow.com/comment/42107759
has comment: http://stackoverflow.com/comment/42108265
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26764021
type: Question
has comment: http://stackoverflow.com/comment/42108047
has comment: http://stackoverflow.com/comment/42108799
has comment: http://stackoverflow.com/comment/42108028
has body: I am trying to create a program which write only Urdu language characters. I am taking input from JtextArea and I want to show result in that jtextarea, where user will write their message means give input. The problem is that ASCII code also display with the unicode. I want to disable that ASCII code. What i do now? private void txt2KeyPressed(java.awt.event.KeyEvent evt) { String f; if(KeyEvent.VK_A=='A'){ f=txt2.getText()+"\u0627"; //Urdu language code "Alif" } jtextarea.setText(f); }
tagged with: netbeans
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26764021
answer count: 1
has comment: http://stackoverflow.com/comment/42107898

http://stackoverflow.com/comment/42052698
score: 3
comment on: http://stackoverflow.com/q/26732846
type: QuestionComment
has text: I guess you mean decrement if you want to count down.
type: Comment

http://stackoverflow.com/comment/42435697
type: Comment
has text: @WoW Apologies - I see what you mean. Check my edited answer.
comment on: http://stackoverflow.com/a/26929490
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42219280
score: 0
type: Comment
type: QuestionComment
has text: Give us the full and exact error message.
comment on: http://stackoverflow.com/q/26825306

http://stackoverflow.com/comment/41969471
comment on: http://stackoverflow.com/q/26685755
type: Comment
type: QuestionComment
score: 1
has text: There will be **no** memory leak or insufficient memory situation.

http://stackoverflow.com/q/26722789
score: -1
has comment: http://stackoverflow.com/comment/42036045
has comment: http://stackoverflow.com/comment/42035253
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/42036025
has comment: http://stackoverflow.com/comment/42035378
has comment: http://stackoverflow.com/comment/42035579
favorite count: 0
has answer: http://stackoverflow.com/a/26723179
tagged with: batch-file
has comment: http://stackoverflow.com/comment/42035917
has comment: http://stackoverflow.com/comment/42035927
tagged with: cmd
has comment: http://stackoverflow.com/comment/42046860
possible better answer: http://stackoverflow.com/a/26723558
has comment: http://stackoverflow.com/comment/42035685
has answer: http://stackoverflow.com/a/26723558
accepted answer: http://stackoverflow.com/a/26723179
downvote count: 1
type: AnsweredQuestion
has title: Running java script with bat, "java is not recognized as an internal command or external command"
has comment: http://stackoverflow.com/comment/42035612
has comment: http://stackoverflow.com/comment/42035638
tagged with: java
has body: Ok Guys Thank you for trying to debug me. I have a java script that i usually compile with this cmd javac -classpath jxl.jar;..C:\3DWIP\src\; GenerateExcel.java then I run it with this cmd. java -classpath jxl.jar;..C:\3DWIP\src\; GenerateExcel Model.STEPFILE jxl.jar being the JExcelAPI for writing an EXCEL file and C:\3DWIP\src\ is the folder where my Main() would be. This works perfectly. My problem is that I have a bat script that at some point is supposed to call the javac and the java and for example when it calls the following line java -classpath jxl.jar;..C:\3DWIP\src\; GenerateExcel Model.STEPFILE I get the famous "java is not recognized as an internal command or external command". This is my system path variables C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\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\IPT;C:\Program Files\Java\jdk1.7.0_67\bin;C:\3DWIP\src;C:\Program Files\Java\jdk1.7.0_67\lib\jexcelapi\jxl.jar;%JAVA_HOME%\bin This is my bat script @echo off set INPUTFILENAME=%~1 set INPUTFILENAME=%INPUTFILENAME:C:\GENERATOR\=% set CTWORKFLD=C:\GENERATOR\ set CTINSTDIR=C:\coretechnologie2014\evolution64 set CTSCRIPTFLD=C:\coretechnologie2014\evolution64\scripts set CTLIBPATH=C:\coretechnologie2014\evolution64\lib64 set EVOLPATH=%CTINSTDIR% set path=C:\Program Files\Java\jdk1.7.00_67\bin;%EVOLPATH%;%CTLIBPATH%;%CTLIBPATH%\lib3dx\intel_a\code\bin;%UGII_ROOT_DIR%; rmdir %CTWORKFLD%\out /s /q mkdir %CTWORKFLD%\out echo Processing file: %INPUTFILENAME% echo Exporting Images and Data "%CTINSTDIR%\evolution.exe" -batch "%CTSCRIPTFLD%\Compute_Properties_and_views.scp" "%CT…

http://stackoverflow.com/comment/41966753
type: QuestionComment
has text: Define "it doesn't work".
score: 0
comment on: http://stackoverflow.com/q/26684208
type: Comment

http://stackoverflow.com/comment/42137320
type: Comment
type: QuestionComment
score: 1
has text: Vote down huh!? How did you arrive at the conclusion my java home is not set to what your post is referring to? I am not asking for help as to how to set java home, come on... If you care to read you will at least understand that this is all about how Java Home is being read by maven.like seriously..... why do you downvote me over something you don't even understand?
comment on: http://stackoverflow.com/q/26776303

http://stackoverflow.com/comment/42038963
type: Comment
has text: im getting compile time error while trying with this.
comment on: http://stackoverflow.com/a/26724589
type: AnswerComment
score: 0

http://stackoverflow.com/q/26715215
score: 0
has title: how to change Mybean in "Type type = new TypeToken<List<Mybean>>(){}.getType()" to be a parameter?
answer count: 1
tagged with: generics
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42020966
has answer: http://stackoverflow.com/a/26719955
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I use below code to convert jsonString to collection. public static List&lt;Itembean&gt; getData(String jsonString){ Gson gson = new Gson(); Type type = new TypeToken&lt;List&lt;Itembean&gt;&gt;(){}.getType(); return gson.fromJson(jsonString, type); } The problem is there are serval beans, so how to modify those code to make it can be called by all than to copy/paste and modify the bean name.

http://stackoverflow.com/comment/42090214
comment on: http://stackoverflow.com/q/26752897
type: Comment
type: QuestionComment
has text: I hav(t)e to/will test on Win7, have to wait (multi_boot with WinXP/Win7/Win8)
score: 0

http://stackoverflow.com/comment/42168970
type: AnswerComment
has text: @BackSlash You can still `build` with maven, there is no problem with that, but as you wrote, you need to mark these dependencies as provided and not include in the application, but unfortunately configure it on the application server as library. You may try to change just the classloader in the application settings to Parent Last, but it rather not gonna solve your issue.
score: 0
comment on: http://stackoverflow.com/a/26785050
type: Comment

http://stackoverflow.com/q/26707520
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42007697
accepted answer: http://stackoverflow.com/a/26707641
has comment: http://stackoverflow.com/comment/42007582
upvote count: 0
tagged with: function
answer count: 1
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/42007580
has title: What is the most intuitive way to pull an int from an array?
has answer: http://stackoverflow.com/a/26707641
has comment: http://stackoverflow.com/comment/42007719
downvote count: 1
has comment: http://stackoverflow.com/comment/42007635
has body: So, I have an object in a class called "arrays": static arrays VideoGame = new arrays(arrays.product[9], arrays.price[9]); and a function: public static void getPrice(int price){ System.out.println("The cost is: " + price); } In my main file I call that function like this: arrays.getPrice(arrays.price[9]); Is there anything like arrays.getPrice(VideoGame.price); that lets you actually use the VideoGame object with the function? EDIT: I forgot to say that "arrays" is a class I made with functions that create arrays.
type: AnsweredQuestion
tagged with: object
tagged with: oop
tagged with: java

http://stackoverflow.com/comment/42172219
comment on: http://stackoverflow.com/a/26786466
type: AnswerComment
has text: @PeterJonsson instead of explaining your setup in words better show an SSCCE that demonstrates the problem - code is much clearer :-)
type: Comment
score: 1

http://stackoverflow.com/comment/42223406
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26827775
has text: displaying something different than the file contains seems very error-prone to me.

http://stackoverflow.com/comment/42098131
type: Comment
has text: I mean like use annotation @Column(nullable = true)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26754881

http://stackoverflow.com/a/26813730
type: Answer
score: 2
downvote count: 0
has body: The Spring application context stays open, and so even though your main thread is over, other threads are still available and runnable. Close out the context with context.close() to shut things down cleanly. Additionally, consider using Spring Boot for future programs. You'd still need to actively close the context to terminate the program automatically, but the setup is a good bit easier.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26813619
answers question: http://stackoverflow.com/q/26813619

http://stackoverflow.com/q/26739698
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/48256752
has body: once I start Eclipse telling him where solr is via `-Dsolr.home=D:\devel\apps\solr-4.3.1_master\ec2` starts solr but appears the following exception . 2014-11-04 16:50:50,711 INFO [main] CoreContainer - New CoreContainer 1552134420 2014-11-04 16:50:50,713 INFO [main] CoreContainer - Loading CoreContainer using Solr Home: 'D:\devel\apps\solr-4.3.1\ec2\' 2014-11-04 16:50:50,714 INFO [main] SolrResourceLoader - new SolrResourceLoader for directory: 'D:\devel\apps\solr-4.3.1\ec2\' 2014-11-04 16:50:50,716 INFO [main] SolrResourceLoader - Adding 'file:/D:/devel/apps/solr-4.3.1/ec2/lib/alista-solr-plugin-1.4.0_RC1.1-SNAPSHOT.jar' t o classloader 2014-11-04 16:50:50,717 INFO [main] SolrResourceLoader - Adding 'file:/D:/devel/apps/solr-4.3.1/ec2/lib/est-solr-lib-2.6.8.jar' to classloader 2014-11-04 16:50:50,718 INFO [main] SolrResourceLoader - Adding 'file:/D:/devel/apps/solr-4.3.1/ec2/lib/mysql-connector-java-5.1.33-bin.jar' to classl oader 2014-11-04 16:50:50,901 ERROR [main] SolrDispatchFilter - Could not start Solr. Check solr/home property and the logs 2014-11-04 16:50:50,929 ERROR [main] SolrException - null:java.lang.ExceptionInInitializerError at org.apache.solr.core.SolrResourceLoader.reloadLuceneSPI(SolrResourceLoader.java:205) at org.apache.solr.core.SolrResourceLoader.&lt;init&gt;(SolrResourceLoader.java:115) at org.apache.solr.core.SolrResourceLoader.&lt;init&gt;(SolrResourceLoader.java:250) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:380) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:358) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:326) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:124) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298) at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:119) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076) at o…
tagged with: solr
upvote count: 1
accepted answer: http://stackoverflow.com/a/30071688
type: Question
score: 1
tagged with: java
tagged with: tomcat6
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/30071688
has title: Check solr/home property and the logs . ClassCastException: class org.apache.lucene.analysis.icu.ICUFoldingFilterFactory

http://stackoverflow.com/comment/42201053
comment on: http://stackoverflow.com/q/26813619
score: 0
type: Comment
type: QuestionComment
has text: Instead of casting, just use a more specific type for your `context` variable.

http://stackoverflow.com/q/26769969
has comment: http://stackoverflow.com/comment/42120598
has answer: http://stackoverflow.com/a/26770072
downvote count: 0
has comment: http://stackoverflow.com/comment/42120433
accepted answer: http://stackoverflow.com/a/26770072
type: AnsweredQuestion
has body: I am practicing recursion and using a recursive helper method. In my helper method, an error appears saying that The method someMethod(K) in the type Tree is not applicable for the arguments (K, List, int). However, I do not want to use the someMethod(K k) method as I am trying to use the someMethod(K k, List&lt;K&gt; L, int n) helper method. How do I make Eclipse "know" that I'm trying to use the other method? Here's what I have thus far: public List&lt;K&gt; someMethod(K k) { List&lt;K&gt; L=new LinkedList&lt;K&gt;(); if (lookup(k) != null) { return someMethod(k, L, 0); } return L; } private List&lt;K&gt; someMethod(K k, List&lt;K&gt; L, int n) { if (this.k.compareTo(k) == 0) { L.add(this.k); return list; } if (this.k.compareTo(k) &lt; 0) { right.someMethod(k, L, n); //error here L.add(this.k); } if (this.k.compareTo(k) &gt; 0) { left.someMethod(k, L, n); //error here L.add(this.k); } } Edit: declarations for left and right: private Tree&lt;K, V&gt; left, right;
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42120702
has title: Recursion in helper methods (Java)
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26770067
has comment: http://stackoverflow.com/comment/42120390
tagged with: recursion
has comment: http://stackoverflow.com/comment/42120341
tagged with: helpermethods
tagged with: java
possible better answer: http://stackoverflow.com/a/26770067
has comment: http://stackoverflow.com/comment/42120438

http://stackoverflow.com/comment/42187344
has text: Looks like `org.jvnet.hyperjaxb3:hyperjaxb3-ejb-roundtrip:jar:0.6.0:compile` is referencing `org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile`. This will conflict with the newer JPA 2.1 API.
comment on: http://stackoverflow.com/a/26797709
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26722591
has title: printing wrong decimal
upvote count: 0
has body: arr[i]=s+t-Math.abs(s-j)/2; here is the line, s= 600 j = 631 t =60 , the answer should be 645.5 but it prints 645.0. arr[] is double
downvote count: 5
has answer: http://stackoverflow.com/a/26722668
favorite count: 0
has comment: http://stackoverflow.com/comment/42034859
has answer: http://stackoverflow.com/a/26722636
has answer: http://stackoverflow.com/a/26722704
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26722729
has comment: http://stackoverflow.com/comment/42034877
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/42034894
has comment: http://stackoverflow.com/comment/42034885
has answer: http://stackoverflow.com/a/26722637
type: Question

http://stackoverflow.com/q/26748398
answer count: 1
has body: I am trying to do client side encryption for the data I am sending to S3. I want to take encryption keys as input from the user. In what format should I take the key from the user. I tried to take input as the private key generated by ssh-keygen and tried reading it using the code mentioned at Get public key from private in Java. But I get the following error Exception in thread "main" java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:217) at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) I generated the key using ssh-keygen -t rsa
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8434428
tagged with: encryption
type: Question
tagged with: amazon-s3
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26928023
has title: In what format should I accept Encryption keys from user for S3 and how should I read it in Java

http://stackoverflow.com/a/69085602
score: 0
answers question: http://stackoverflow.com/q/26713082
has body: If too many connection opened within a short time can cause this. You should check in your processes. You may make system sleep for some time after some connection.
type: Answer

http://stackoverflow.com/a/26773112
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26773042
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26773042
type: Answer
has body: Use the following code: try { int playerNum = scanner.nextInt(); //futher code } catch (InputMismatchException nfe) { System.out.println("You have entered a non numeric field value"); } Scanner throws InputMismatchException when you enter string instead of integer. So very next time when you try to enter String it will throw the InputMismatchException exception, you could catch the exception and say you let user know that user has entered invalid input and let him retry.

http://stackoverflow.com/comment/41976564
score: 0
type: Comment
type: QuestionComment
has text: A basic video game, which is based on swing.
comment on: http://stackoverflow.com/q/26689875

http://stackoverflow.com/q/26698897
score: 0
has body: I want to check if the ball and a specific line (zijde) collide. I want to do this by making the line function of the line. Than check if the coordinates that come out of the function are equal to the ball's coordinates. This is the code i'm using so far and I don't know what I'm doing wrong. Zijde z is the line that the ball needs to collide with and has the functions getStartPoint (getStartPunt) and getEndPoint (getEindpunt). public Boolean CheckCollision(Zijde z) { /** * y = ax + b * a = delta y / delta x * b = y - ax */ double deltay = z.getEindpunt().getY() - z.getStartPunt().getY(); double deltax = z.getEindpunt().getX() - z.getStartPunt().getX(); double a = deltay / deltax; double b = z.getEindpunt().getY() - a * z.getEindpunt().getX(); double yf = a * this.x + b; return yf == this.y; }
answer count: 1
has title: How do I check the collision between a ball and a line
tagged with: collision
has answer: http://stackoverflow.com/a/26698926
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26698926

http://stackoverflow.com/comment/42156544
type: Comment
comment on: http://stackoverflow.com/a/26784636
has text: If you can find some commonality between the HSSF and XSSF Links Tables, open an enhancement request in the POI Bugzilla and ask for a common interface covering the two. That's the best way of getting a public class / method to support this!
score: 0
type: AnswerComment

http://stackoverflow.com/a/26811471
accepted answer of: http://stackoverflow.com/q/26811267
has comment: http://stackoverflow.com/comment/42195534
upvote count: 1
has body: My question is how exactly does Spring (the DispatcherServlet) decide which of these two methods to call? As you've guessed, it tries to disambiguate by using the @RequestMapping's other properties. The javadoc of RequestMapping#produces() states The producible media types of the mapped request, narrowing the primary mapping. The format is a single media type or a sequence of media types, with a request only mapped if the Accept matches one of these media types The handler which is most specific, ie. where most mappping properties are matched, will be chosen. In cases, where ambiguity exists, Spring will throw an exception. In your three scenarios, since application/xml is acceptable, the handler method with the appropriate produces will be used.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42195488
type: Answer
has comment: http://stackoverflow.com/comment/42215079
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26811267

http://stackoverflow.com/a/26988559
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26832008
answers question: http://stackoverflow.com/q/26832008
score: 1
has body: Runtime of WSO2 App Cloud is powered by WSO2 App Server. This issues was due to a class loading issues in the WSO2 App Server. We at WSO2 have fixed this issue and you should be able to try your code successfully now. BTW, next time when you want to tag WSO2 Cloud in a question, use the wso2cloud tag. It will help us to answer your questions quickly.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42160202
type: QuestionComment
has text: Create getter and setter for each of the student attributes. I believe that's what your teacher expect you to do
comment on: http://stackoverflow.com/q/26792298
score: 0
type: Comment

java-stream
tags question: http://stackoverflow.com/q/26817439
tags question: http://stackoverflow.com/q/26752919
tags question: http://stackoverflow.com/q/26783788
tags question: http://stackoverflow.com/q/26687937
tags question: http://stackoverflow.com/q/26684562
tags question: http://stackoverflow.com/q/26810375
tag name: java-stream
tags question: http://stackoverflow.com/q/26779676
tags question: http://stackoverflow.com/q/26812096
type: Tag
tags question: http://stackoverflow.com/q/26775395
tags question: http://stackoverflow.com/q/26721890
tags question: http://stackoverflow.com/q/26725296

http://stackoverflow.com/a/26779470
type: Answer
has body: You can try manually deployment of your web project. Create a war file of the dynamic web project and put that war file under webapps folder of your tomcat installation directory. Then restart the server and test in browser by entering localhost:8080/your_projectName If it runs then there is problem in eclipse.You can reconfigure server in your eclipse.
score: 0
answers question: http://stackoverflow.com/q/26777139

http://stackoverflow.com/comment/42230448
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26831984
has text: Marshalled as what? With what?

http://stackoverflow.com/a/26686839
downvote count: 0
has comment: http://stackoverflow.com/comment/41971460
has comment: http://stackoverflow.com/comment/41971415
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41971426
has comment: http://stackoverflow.com/comment/41971493
accepted answer of: http://stackoverflow.com/q/26686813
answers question: http://stackoverflow.com/q/26686813
has body: I don't see DATE_TIME_TOKEN_TAKEN=? in your query (the bind parameter), I think you wanted String sqlQuery = "UPDATE queue_in_progress SET DATE_TIME_TOKEN_TAKEN=?, " + "CE_PK=" + ce_pk + ", SERVICE_STATUS=1 WHERE CATEGORY_PK=" + Category_PK + " AND TOKEN_NO=" + Token_PK + " AND SERVICE_COUNTER=" + service_counter + " AND SERVICE_CENTER_PK=" + service_center;
type: AcceptedAnswer

http://stackoverflow.com/comment/42180538
type: AnswerComment
comment on: http://stackoverflow.com/a/26803438
has text: @UkoMelis you should pick up for a Java fundamentals book which can explain things to you way better than a narrowly scoped answer to your question. Try to limit your questions on StackOverflow to issues or challenges you are not able to overcome even after referring to standard text/books.
type: Comment
score: 1

http://stackoverflow.com/comment/42159978
type: Comment
has text: Whats funny is that `Arrays.asList(T... a)` doesnt actually return `java.util.ArrayList` it returns its own class that is also called `ArrayList` (`java.util.Arrays$ArrayList`). But if I was to guess as to why they didnt make the `ArrayList` class take an array was because it could cause confusion as to the mutable state of the array passed in the constructor.
score: 4
comment on: http://stackoverflow.com/q/26792175
type: QuestionComment

http://stackoverflow.com/a/26677859
accepted answer of: http://stackoverflow.com/q/26677751
score: 0
answers question: http://stackoverflow.com/q/26677751
type: AcceptedAnswer
type: Answer
has body: In your interface call to your activity, you assign the parameters you get from the call: public void passGBCenterIntValuesInterface(int xC_IInt, int yC_IInt) { xC_IInt = xCenterInt; &lt;-- RIGHT THERE yC_IInt = yCenterInt; &lt;-- RIGHT THERE dp.setCenterInt(xC_IInt, yC_IInt); }//--- END Interface call xCenterInt and yCenterInt are problably 0

http://stackoverflow.com/a/26727844
answers question: http://stackoverflow.com/q/26727812
upvote count: 70
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/99011482
has body: Try passing a lambda expression of type Supplier&lt;MeetingDoesNotExistException&gt; : Meeting meeting = meetingRepository.findByMeetingId(meetingId) .orElseThrow(() -&gt; new MeetingDoesNotExistException(meetingId));
score: 70
accepted answer of: http://stackoverflow.com/q/26727812
type: AcceptedAnswer

http://stackoverflow.com/comment/47037671
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26799398
has text: I'm having same problem as you. First thing is to make that you have a constructor for KafkaKeyDecoder that has one parameter of type kafka.utils.VerifiableProperties. In my case, I have this constructor or if I'm using StringDecoder or DefaultDecoder I'm getting same exception. I'm running dse 4.6.2 with spark 1.1.0 and kafka 0.8.0. I guess that there is something in class path that creates the issue, but I did not found yet what ...
score: 0

sql
tags question: http://stackoverflow.com/q/26701445
tags question: http://stackoverflow.com/q/26729067
tags question: http://stackoverflow.com/q/26742927
tags question: http://stackoverflow.com/q/26698351
tags question: http://stackoverflow.com/q/26797837
tags question: http://stackoverflow.com/q/26776904
tags question: http://stackoverflow.com/q/26806123
tags question: http://stackoverflow.com/q/26809532
tags question: http://stackoverflow.com/q/26831893
tags question: http://stackoverflow.com/q/26715533
tags question: http://stackoverflow.com/q/26809490
tags question: http://stackoverflow.com/q/26686813
tags question: http://stackoverflow.com/q/26759681
tag name: sql
type: Tag
tags question: http://stackoverflow.com/q/26698914
tags question: http://stackoverflow.com/q/26756785
tags question: http://stackoverflow.com/q/26731616
tags question: http://stackoverflow.com/q/26723376
tags question: http://stackoverflow.com/q/26720684
tags question: http://stackoverflow.com/q/26743992
tags question: http://stackoverflow.com/q/26748616
tags question: http://stackoverflow.com/q/26811228
tags question: http://stackoverflow.com/q/26793508
tags question: http://stackoverflow.com/q/26682265
tags question: http://stackoverflow.com/q/26767236
tags question: http://stackoverflow.com/q/26796281
tags question: http://stackoverflow.com/q/26676507
tags question: http://stackoverflow.com/q/26711383
tags question: http://stackoverflow.com/q/26787747
tags question: http://stackoverflow.com/q/26794124
tags question: http://stackoverflow.com/q/26744621
tags question: http://stackoverflow.com/q/26807434
tags question: http://stackoverflow.com/q/26683315
tags question: http://stackoverflow.com/q/26688747
tags question: http://stackoverflow.com/q/26676527
tags question: http://stackoverflow.com/q/26754757
tags question: http://stackoverflow.com/q/26709184
tags question: http://stackoverflow.com/q/26802943
tags question: http://stackoverflow.com/q/26699535
tags question: http://stackoverflow.com/q/26690465
tags question: http://stackoverflow.com/q/26767142
tags question: http://stackoverflow.com/q/26720565
tags question: http://stackoverflow.com/q/26704781
tags question: http://stackoverflow.com/q/26828909

http://stackoverflow.com/q/26695254
has comment: http://stackoverflow.com/comment/41995864
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/41995288
has comment: http://stackoverflow.com/comment/41985584
score: 3
tagged with: java
has body: System.out.printf("Time: %d-%d %02d:%02d" + calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.MONTH), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE); That is the code a friend showed me, but how do I get the date to appear in a Format like November 1?
downvote count: 1
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26701088
has comment: http://stackoverflow.com/comment/41995473
has answer: http://stackoverflow.com/a/26695301
linked to: http://stackoverflow.com/q/14832151
has answer: http://stackoverflow.com/a/26695453
has title: Java printf with date and month
has comment: http://stackoverflow.com/comment/41996585
has answer: http://stackoverflow.com/a/26700704
linked to: http://stackoverflow.com/q/1038570
favorite count: 0

http://stackoverflow.com/comment/42073753
has text: Shouldn't searchText be etSearch?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26743341

http://stackoverflow.com/a/26735568
type: Answer
accepted answer of: http://stackoverflow.com/q/26732875
upvote count: 5
answers question: http://stackoverflow.com/q/26732875
has body: You're connecting on the wrong (plain HTTP) port. It's not possible to run HTTPS and HTTP on the same port, so there will be another listening port for HTTPS in your config.
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42058053

http://stackoverflow.com/comment/42173824
comment on: http://stackoverflow.com/a/26782097
score: 0
type: AnswerComment
has text: I was able to apply SQL on Streaming data. We are not supposed to have the declaration of JavaSQLContext within the foreachRDD. Had to do that outside the for loop. Thanks for the help though. Appreciate it
type: Comment

http://stackoverflow.com/comment/42037174
comment on: http://stackoverflow.com/a/26723387
score: 0
type: AnswerComment
type: Comment
has text: I think from the documentation and out observation we can be pretty sure that it's atomic. The case with the two separated statements may only work if you apply a read lock in the tables.

http://stackoverflow.com/comment/42056988
type: Comment
type: QuestionComment
has text: For me this works, no matter if `Client` is a static or non-static inner class. I tried with pure AspectJ though, not with Spring AOP. But the pointcut syntax and matching algorithms should be the same. So unless you have a Spring configuration problem I do not know what the problem could be. Maybe you can update the question by posting the `Role` source code including the inner class. Don't forget package name and imports. Please also add those two to the aspect.
score: 0
comment on: http://stackoverflow.com/q/26703630

http://stackoverflow.com/comment/42144826
type: QuestionComment
has text: yes... that's what I want to do... I want to use a.x in a case statement... so for that I want to re-initialize it as a constant... My question is, Is there a way to do that ?
comment on: http://stackoverflow.com/q/26783919
score: 0
type: Comment

http://stackoverflow.com/a/26740128
accepted answer of: http://stackoverflow.com/q/26739402
has body: I assume the intention is to do it from n = 5368 so you will need a loop to pull of each individual digit and compare it to the current min/max int n = 5368; int result = 0; if (n &gt; 0) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; while (n &gt; 0) { int digit = n % 10; max = Math.max(max, digit); min = Math.min(min, digit); n /= 10; } result = min + max; } System.out.println(result);
answers question: http://stackoverflow.com/q/26739402
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26813974
has comment: http://stackoverflow.com/comment/42199681
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26813832
has comment: http://stackoverflow.com/comment/42199855
answers question: http://stackoverflow.com/q/26813832
has body: You are not checking that w is a neighbor for v. Also you need to mark vertice as visited before the recursive call. Your loop should look like // println("Visiting " + v); for(int i = 0; i &lt; adj.length; i++) { if( adj[v][i] &amp;&amp; (visited[i] == 0) ) { visited[i] = counter; dfs(i); } }
type: Answer
score: 1

http://stackoverflow.com/q/26818105
score: 0
tagged with: io
has comment: http://stackoverflow.com/comment/42206412
has body: I need to write some data about several companies into a binary file; the data includes name of companies (String), year of incorporation (int), and revenue this year (double). Write data would be not trouble to me, but I don't know how to read some specific data from a the binary file; for example, if I have name of a company, I need to return the the other data about the company. So far, I only know to read all the data or maybe line by line in a binary file. Can someone suggest which class or method I need to use to do so?
has answer: http://stackoverflow.com/a/26818159
accepted answer: http://stackoverflow.com/a/26818159
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has title: How I can read some specific data from a file that contain different types of data?

http://stackoverflow.com/comment/42220048
has text: Pretty sure you're gonna need separate conditional statements for that
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26825853
score: 0

http://stackoverflow.com/comment/42082220
has text: What container are you using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26747033

http://stackoverflow.com/a/26805731
has comment: http://stackoverflow.com/comment/42190565
has comment: http://stackoverflow.com/comment/42187022
score: 0
accepted answer of: http://stackoverflow.com/q/26805350
has comment: http://stackoverflow.com/comment/42186522
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42189493
has comment: http://stackoverflow.com/comment/42190723
has comment: http://stackoverflow.com/comment/42190692
type: Answer
has body: Here is your code edited so that it works as you would like. I will include a list of changes at the bottom public class Names { public static void main(String[] args) { SimpleFrame frame = new SimpleFrame(); frame.setTitle("Multi Thread Workers"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } class SimpleFrame extends JFrame { public static final int HEIGHT = 500; public static final int WIDTH = 600; public JTextArea jta; public SimpleFrame() { setSize(WIDTH, HEIGHT); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new BorderLayout()); JPanel topPanel = new JPanel(); final JButton tim = new JButton("Tim (5 sec)"); final JButton suzy = new JButton("Suzy (3 sec)"); final JButton edna = new JButton("Edna (2 sec)"); topPanel.add(tim); topPanel.add(suzy); topPanel.add(edna); add(topPanel, BorderLayout.NORTH); JPanel textPanel = new JPanel(); jta = new JTextArea(10, 10); jta.setFont(new Font("SansSerif", Font.PLAIN, 20)); JScrollPane jsp = new JScrollPane(jta); add(jsp, BorderLayout.CENTER); tim.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { Runnable r1 = new myRunnable(5, "Tim", "Tim", 5000, SimpleFrame.this, jta); Thread t1 = new Thread(r1); t1.start(); tim.setEnabled(false); } }); suzy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { Runnable r2 = new myRunnable(3, "Suzy", "Suzy", 3000, SimpleFrame.this, jta); Thread t2 = new Thread(r2); t2.start(); suzy.setEnabled(false); } }); edna.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { Runnable r3 = new myRunnable(1, "Edna", "Edna", 1000, SimpleFrame.this, jta); Thread t3 = new Thread(r3); t3.start(); edna.setEnabled(false); } }); jta.setVisible(true); jsp.setVisible(true); topPanel.setVisible(true); setVisible(true); } } class myRunnable implements Runnable { int workerTime; String name; String threadToRun; int runtimeDelay; JFrame frame; JTextArea jTextArea; …
has comment: http://stackoverflow.com/comment/42189246
has comment: http://stackoverflow.com/comment/42189369
has comment: http://stackoverflow.com/comment/42189312
has comment: http://stackoverflow.com/comment/42190074
has comment: http://stackoverflow.com/comment/42190611
has comment: http://stackoverflow.com/comment/42186245
has comment: http://stackoverflow.com/comment/42185009
has comment: http://stackoverflow.com/comment/42184808
answers question: http://stackoverflow.com/q/26805350

http://stackoverflow.com/comment/42143965
score: 0
type: Comment
type: QuestionComment
has text: @zaidshawahin don't worry, it is a legitimate question. It is just hard to understand and difficult to see the problem
comment on: http://stackoverflow.com/q/26783093

http://stackoverflow.com/q/26751316
type: Question
answer count: 1
tagged with: installation
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26762438
tagged with: jwrapper
type: UnansweredQuestion
has title: Using JWrapper to build java application
has body: Need some inputs on below points. Thanks in advance. We have deployed our project using JWrapper in Mac version. For a latest upgrade installation, I have been trying to just replace the updated jars files (from other Mac OS) to check for a delta update. The application stop running and gives exception something like ”Encrypted data integrity check failed”. What I understand with this is there is a checksum added for each version of the package done by JWrapper. In that case how I can only replace a jar (in client location) to support a delta update. Please let me know if you need any other info.

http://stackoverflow.com/q/26762326
answer count: 2
has body: I have written a program that outputs the Fibonacci sequence and the program is working alright for small numbers. When I set the loop for 10 000th number of the sequence, the program goes super weird and starts outputting negative numbers alongside positive ones. At first I though it was because I used int type for the numbers but then I changed it to long and the program still outputs the same things. I am quite new to java, so I guess either something is wrong with my program or I have missed a type that is larger than long and would not output a negative number. Below is the code. Feel free to comment about anything else apart from just any mistakes, as I am fairly new to java so the code might look a bit amateurish: public class Problem2{ //fibonacci sequence public static void main (String [] args ){ long first = 1; long second = 1; System.out.println(first); System.out.println(second); for ( int i = 1; i &lt;= 100 ; i++){ long third = first + second; first = second; second = third; System.out.println(third); } } } Outputs for the first 90 numbers are alright: 1 1 2 3 5 8 13 21 ... After that the the last 2 outputs are : 90th : 7540113804746346429 91st : -6246583658587674878 I sincerely apologize if this has been asked many times, I've searched around a little and didn't find much I could understand so I thought it might be best to ask.
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26762424
upvote count: 2
has title: [Java]The bigger the numbers, the weirder the output of Fibonacci sequence
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26762332
tagged with: fibonacci
has answer: http://stackoverflow.com/a/26762424
has answer: http://stackoverflow.com/a/26762332

http://stackoverflow.com/q/26814549
tagged with: android
has comment: http://stackoverflow.com/comment/42200755
favorite count: 0
linked to: http://stackoverflow.com/q/25017680
has body: I am getting "NoSuchMethodError" in this code. I have tried to take help from this link, but it couldn't help me.I am providing the code with log output.Hopefully these will help you people to understand the problem in the code. Please help me to get rid of it. @SuppressLint("NewApi") @Override protected void onSetContentView() { this.mRenderSurfaceView = new RenderSurfaceView(this); this.mRenderSurfaceView.setRenderer(this.mEngine, this); final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams =(LayoutParams) ((ViewGroup.MarginLayoutParams)( new FrameLayout.LayoutParams( super.createSurfaceViewLayoutParams()))); final FrameLayout.LayoutParams frameLayoutLayoutParams = (LayoutParams) ((ViewGroup.MarginLayoutParams) (new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT))); // Creating the banner view. AdView adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId(this.getResources().getString(R.string.google_ad_id)); adView.loadAd(new AdRequest.Builder().build()); final FrameLayout.LayoutParams adViewLayoutParams = (LayoutParams) ((ViewGroup.MarginLayoutParams) ( new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL))); final FrameLayout frameLayout = new FrameLayout(this); /*final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT);*/ surfaceViewLayoutParams.setMargins(0, 0, 0, 50); frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); frameLayout.addView(adView, adViewLayoutParams); this.setContentView(frameLayout, frameLayoutLayoutParams); } Here is the Logcat output 11-08 11:57:55.192: E/AndroidRuntime(8442): FATAL EXCEPTION: main 11-08 11:57:55.192: E/AndroidRuntime(8442):java.lang.NoSuchMethodError:android.widget.FrameLayout$LayoutParams.&lt;init&gt; 1…
type: UnansweredQuestion
tagged with: nosuchmethoderror
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42200742
has comment: http://stackoverflow.com/comment/42200448
downvote count: 0
has title: Android: java.lang.NoSuchMethodError on FrameLayout$LayoutParams.<init>
has comment: http://stackoverflow.com/comment/42200807
has comment: http://stackoverflow.com/comment/42200456

http://stackoverflow.com/q/26805821
tagged with: java
has answer: http://stackoverflow.com/a/26805838
accepted answer: http://stackoverflow.com/a/26805838
downvote count: 0
answer count: 1
favorite count: 0
tagged with: postgresql
has body: I Installed postgresql and its driver which is "postgresql-9.3-1102.jdbc41.jar". And my directory seems like : &gt; SQL &gt; myJDBC.java &gt; postgresql-9.3-1102.jdbc41.jar I have tried : javac -cp postgresql-9.3-1102.jdbc41.jar myJDBC.java java -cp postgresql-9.3-1102.jdbc41.jar myJDBC It compiles fine but when I try to execute it, I get error which is : Error: Could not find or load main class myJDBC What am I missing ?
has title: how to use postgresql in Java
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question

http://stackoverflow.com/comment/42166185
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26795976
has text: related: http://stackoverflow.com/questions/13927217/what-happens-when-java-program-starts

http://stackoverflow.com/comment/41952115
has text: It only asks me to lists the amount of numbers that are divisible by either 2,3 or 5. For example: if a= 5 and b=8 it would return the number 3....why? because 5,6 and 8 are divisible by either 2,3 or 5.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26675725

http://stackoverflow.com/comment/42014277
type: Comment
has text: Yes I tried the first suggestion with no luck, the connection is already set to auto commit. The select statement is called by different part of the code which I neglected in the flow I described, just to make it clearer.
type: AnswerComment
comment on: http://stackoverflow.com/a/26711208
score: 0

http://stackoverflow.com/a/26726070
has comment: http://stackoverflow.com/comment/42041674
has body: Have you considered to use the RestTemplate-class of the spring framework ? It directly combines the http-request with possibility to map a JSON reply onto a pojo in about 5 lines of code. The advantage is that you know that the mapping is working correctly and the source code is much more readible. Example that helped me a lot: https://spring.io/guides/gs/consuming-rest/
answers question: http://stackoverflow.com/q/26725806
has comment: http://stackoverflow.com/comment/42041257
has comment: http://stackoverflow.com/comment/42041132
score: 0
type: Answer

http://stackoverflow.com/comment/42105422
type: Comment
type: QuestionComment
has text: I will try this. Does this eliminate the possibility to attach an actionListener to the checkbox however?
score: 0
comment on: http://stackoverflow.com/q/26761920

http://stackoverflow.com/comment/42479688
has text: Surprised with the down votes on this one. This is a legitimate answer which is simple and does the job perfectly. +1 for you.
comment on: http://stackoverflow.com/a/26791459
type: AnswerComment
score: 0
type: Comment

jvm
tags question: http://stackoverflow.com/q/26798131
tags question: http://stackoverflow.com/q/26801109
tags question: http://stackoverflow.com/q/26791204
tags question: http://stackoverflow.com/q/26737357
type: Tag
tags question: http://stackoverflow.com/q/26765155
tags question: http://stackoverflow.com/q/26741925
tags question: http://stackoverflow.com/q/26776452
tags question: http://stackoverflow.com/q/26795976
tags question: http://stackoverflow.com/q/26714352
tags question: http://stackoverflow.com/q/26743095
tags question: http://stackoverflow.com/q/26676870
tags question: http://stackoverflow.com/q/26810819
tags question: http://stackoverflow.com/q/26791859
tags question: http://stackoverflow.com/q/26823930
tags question: http://stackoverflow.com/q/26762368
tags question: http://stackoverflow.com/q/26682645
tag name: jvm
tags question: http://stackoverflow.com/q/26681803
tags question: http://stackoverflow.com/q/26786806
tags question: http://stackoverflow.com/q/26728621
tags question: http://stackoverflow.com/q/26676947
tags question: http://stackoverflow.com/q/26693720
tags question: http://stackoverflow.com/q/26693418
tags question: http://stackoverflow.com/q/26748162
tags question: http://stackoverflow.com/q/26757902
tags question: http://stackoverflow.com/q/26735138
tags question: http://stackoverflow.com/q/26731539
tags question: http://stackoverflow.com/q/26822618
tags question: http://stackoverflow.com/q/26792152
tags question: http://stackoverflow.com/q/26801246
tags question: http://stackoverflow.com/q/26760278
tags question: http://stackoverflow.com/q/26720189

http://stackoverflow.com/comment/42227444
type: Comment
type: QuestionComment
has text: @Dalton How would you recommend remedying this issue? I went back and attempted to take the values from the resultSet and place those directly into the list of buttons, however, the errors still persist. Is it possible the values in resultSet aren't being retrieved properly?
comment on: http://stackoverflow.com/q/26818959
score: 0

http://stackoverflow.com/q/26740091
answer count: 4
type: AnsweredQuestion
tagged with: hashcode
has comment: http://stackoverflow.com/comment/42066118
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26740207
upvote count: 1
linked to: http://stackoverflow.com/q/909843
type: Question
has answer: http://stackoverflow.com/a/26740258
has comment: http://stackoverflow.com/comment/42066418
has answer: http://stackoverflow.com/a/26740144
has title: Why hashcode does not generate unique hashcode?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26740187
accepted answer: http://stackoverflow.com/a/26740258
has body: We known that default implementation of hashCode() returns integer after converting the internal address converting the internal address of the object into an integer . So internal memory of every object is different, then why hashCode() does not generate unique hashcode. My question is why hashcode() [It returns integer which is address representation of an object] does not generate unique code , if we don't override hashcode() and equals?
has answer: http://stackoverflow.com/a/26740207

http://stackoverflow.com/q/26815474
possible better answer: http://stackoverflow.com/a/26815580
has title: Will threading help improve efficiency in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/26815548
has answer: http://stackoverflow.com/a/26815539
has answer: http://stackoverflow.com/a/26816262
upvote count: 2
tagged with: multithreading
answer count: 4
has comment: http://stackoverflow.com/comment/42201942
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/42201978
accepted answer: http://stackoverflow.com/a/26815548
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26815580
has body: My application is supposed to have a "realtime with pause" functionality. The user can pause execution, do some things that modify what's going to happen, then unpause and let stuff happen. Stuff happens at regular intervals as specified by the user, can be slow, can be fast. My goal at using threading here is to improve performance on multicore systems. The amount of data that the application is supposed to crunch at the time intervals is supposed to be arbitrarily large (I expect lots and lots of loops over collections, modifying object properties and generating random numbers, but precious little disk access). I don't want the application to be constrained by the capacity of a single core, if it can use more to run faster. Will this actually work this way? I've run some tests (made a program crunch numbers a lot, and looked at CPU usage during its activity), but it's not really conclusive - usage is certainly in the proximity of 100% on my dual core machine, but hardly ever 100%. Does a single-threaded (main only) Java application use all available cores for computation?

http://stackoverflow.com/a/26778918
answers question: http://stackoverflow.com/q/26778517
has comment: http://stackoverflow.com/comment/42175581
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42163185
has body: Even I had the same problem when I was making a program half a year ago. I realized that basically, I can't prevent that! So, I encrypted the file in my cipher, so that only my program could understand it and no one else! I suggest the same to you. Like for example, if you .xml file has a node called &lt; money > , you could rename the node as something which makes no sense i.e. something like &lt; wer > and if it has amount 12000, you could use ab@@@ instead of 12000 (a for 1, b for 2, @ for 0) In this way, no one would understand what it means and would make no attempt to edit it! Also, you could rename the file extension from .xml to .mp3 or .exe so that they have no idea that it is your data file! I did the same, and it worked!

http://stackoverflow.com/q/26687051
upvote count: 1
has title: How to programatically invite users for Google Hangout on Air?
type: Question
has answer: http://stackoverflow.com/a/26818470
has body: I want to use a registration platform like Eventbrite/Townscript to get the user emails who are interested in attending my Google Hangout on Air. Now I want to programatically invite those User Emails for Hangout. How to do that? I also had a look at Google Hangout API Page but couldn't figure out the way. Any help would be really appreciated.
downvote count: 0
answer count: 1
favorite count: 0
tagged with: rest
type: UnansweredQuestion
tagged with: google-hangouts
score: 1
tagged with: java

http://stackoverflow.com/a/26768519
has comment: http://stackoverflow.com/comment/42118424
type: Answer
answers question: http://stackoverflow.com/q/26768429
has comment: http://stackoverflow.com/comment/42117800
has comment: http://stackoverflow.com/comment/42117703
has body: The list variable is not defined in the code you presented, so we can't do more than guess about it. If your class compiles, though, then list must be inherited from the superclass, CRefUnsortedList. At a guess, it is a reference to the head node of the list, and the code you asked about is setting a new head node when you insert at the beginning of the list.
score: 0

http://stackoverflow.com/comment/42174362
type: Comment
score: 0
has text: Can we use Spring to autowire an object the life cycle of which *is not* managed by Spring?
type: AnswerComment
comment on: http://stackoverflow.com/a/26800199

http://stackoverflow.com/comment/42154159
type: Comment
type: QuestionComment
has text: "{ System.out.println(\"Executed Method \" + temp); }" will not work. you need something like"{ System.out.println(\"Executed Method " + temp + "\"); }"
comment on: http://stackoverflow.com/q/26788724
score: 0

http://stackoverflow.com/a/26723957
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/26723900
has body: in the manifest file add to your activity: android:screenOrientation="portrait"
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26723900

http://stackoverflow.com/q/26673829
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/506105
has body: I would like to check my inputted string on a comma, which is pretty easy ( just used this: How can I check if a single character appears in a string?). Now I want to check if a character is present more than once. (in this case a comma (/u002C)) I have created this code: public static void addTextLimiterDouble(final TextField tf, final int maxLength, final Button submitButton) { tf.textProperty().addListener(new ChangeListener&lt;String&gt;() { @Override public void changed(final ObservableValue&lt;? extends String&gt; ov, final String oldValue, final String newValue) { if (oldValue.contains("\u002C") &amp;&amp; newValue.endsWith("\u002C")) { tf.setText(oldValue); } } }); This gives a StackOverflow error, because it seems it can not get out of the loop. Can anyone explain why it can't? Note: I know there are maybe more ways to check for more than one character, but I am just curious why this gives me an error. Any help is greatly appreciated!
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/26673942
tagged with: ends-with
type: Question
has answer: http://stackoverflow.com/a/26673942
score: 0
tagged with: contains
answer count: 3
has title: Java: check if string contains more than one character
accepted answer: http://stackoverflow.com/a/26673952
has answer: http://stackoverflow.com/a/26673975
has answer: http://stackoverflow.com/a/26673952

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/26701116
tag name: httpsurlconnection

http://stackoverflow.com/comment/41972324
score: 1
has text: My intention is only put the *.war directly into my Wildfly-directory or my *.jar files directly onto my desktop. Is that possible?
type: Comment
comment on: http://stackoverflow.com/q/26687033
type: QuestionComment

http://stackoverflow.com/comment/42015948
score: 1
has text: It is exactly like I already told you. A Certificate contains a lot of additional information which are also encoded in base64. Take that output you provided (the ----BEGIN CERT----- one), paste it into a text file. Save that file and rename the file to something.cert. You get the WHOLE certificate including all additional fields and not only the public key. This is why you can't compare those two strings. They are just different - even in a logical way.
comment on: http://stackoverflow.com/a/26711907
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26768303
has body: You could make two helper jobs: One job that is scheduled to run at 11 am which disables the job you want and Another job that runs at 15 pm which enables the job The actual enabling and disabling of jobs is easiest to do using jenkins command line client, either the java client (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI) or the ssh client (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+SSH) At work I have set up exactly that kind of setup. I myself use the ssh client. To disable a job I use ssh -p &lt;jenkins ssh port&gt; user@localhost disable-job &lt;jobname&gt; It is a good idea to configure Jenkins to set up a static ssh port and set up a user with ssh key without password for this purpose. The client command to enable a job is enable-job.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26723429
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42040818
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26725815
type: AnswerComment
has text: @EdisonMiranda Forgot about that. Edited.

http://stackoverflow.com/q/26747281
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26747330
has comment: http://stackoverflow.com/comment/42079864
has comment: http://stackoverflow.com/comment/42079576
tagged with: operation
type: Question
has comment: http://stackoverflow.com/comment/42079763
has body: i have this method : public static String appliquerCoup( String combinaison, String coup ){ String res = ""; for(int i = 0; i &lt; 3; i++){ res = res + (combinaison.charAt(i) - coup.charAt(i)); } return res; } if i apply this in the main System.out.println(appliquerCoup("414", "020") i have : 4-14 As logical as it is, it's puting me a -1 for 2-1 = -1 I want it to put me 0 if the operation is inferior to 0. So i made these changes : public static String appliquerCoup( String combinaison, String coup ){ String res = ""; for(int i = 0; i &lt; 3; i++){ char cFinal = combinaison.charAt(i) - coup.charAt(i); if(cFinal &lt; '0') cFinal = 0; res = res + cFinal; } return res; } but it is saying me that on the 4th line that there's possible loss of precision found :int; required: char Can you help me find the solution ? It's been a long i'm trying. Thanks so much
downvote count: 0
answer count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/42079773
has answer: http://stackoverflow.com/a/26747330
tagged with: character
upvote count: 1
type: AnsweredQuestion
has title: Operation on character in java

http://stackoverflow.com/comment/42068696
has text: I might have found it. Line 51 I have conn = (HttpsURLConnection) obj.openConnection(); and line 98 i have conn = (HttpsURLConnection) obj.openConnection();
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26740970

http://stackoverflow.com/comment/41976373
has text: On python, for example if you open a program from command prompt it executes quickly and then closes the cmd. Is your program with GUI or console based? Not sure about JAR-s tho.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26689689

http://stackoverflow.com/a/26742220
type: Answer
answers question: http://stackoverflow.com/q/26742027
downvote count: 0
score: 1
upvote count: 1
has body: You can use Float.floatToIntBits(). Float.floatToIntBits(position.x) == Float.floatToIntBits(-70) Here another example : Float fObj1 = new Float("5.35"); Float fObj2 = new Float("5.34"); int i2 = fObj1.compareTo(fObj2); if(i2 &gt; 0){ System.out.println("First is grater"); }else if(i2 &lt; 0){ System.out.println("Second is grater"); }else{ System.out.println("Both are equal"); }

http://stackoverflow.com/comment/42023853
has text: who needs loops? `return (n * (n+1) / 2);`
comment on: http://stackoverflow.com/q/26716771
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26678888
score: 2
has body: Hard to say why that wouldn't work from that limited amount of code but you can just add the post delayed to your View. You don't need a handler. t.setText("Test!"); t.postDelayed(new Runnable() { @Override public void run() { t.setText("Test - after 1 second!"); } }, 1000); All Views in Android have a built in handler class.
has comment: http://stackoverflow.com/comment/41956956
downvote count: 0
has comment: http://stackoverflow.com/comment/41957081
upvote count: 2
has comment: http://stackoverflow.com/comment/41956804
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41956865
accepted answer of: http://stackoverflow.com/q/26678803
type: Answer
has comment: http://stackoverflow.com/comment/41956840
answers question: http://stackoverflow.com/q/26678803

http://stackoverflow.com/comment/42223598
type: QuestionComment
comment on: http://stackoverflow.com/q/26822009
score: 1
has text: Craig, thanks for your comment. It looks like FF (but Chrome not!) leaking my external IP even if I use anonymous proxy (or I misconfigured it somewhere). If you still interested in issue - here is a link : http://stackoverflow.com/questions/26827967/anonymous-proxy-not-working-only-for-firefox-for-chrome-ok Thanks again for your reply!
type: Comment

http://stackoverflow.com/comment/42209976
type: Comment
type: QuestionComment
has text: You're setting the type argument as `Integer`, yet you're trying to pass an array object (`int[]`) to the constructor instead of an Integer object. You'd have to change the type argument from `Integer` to `int[]` to accept that constructor argument
comment on: http://stackoverflow.com/q/26820094
score: 0

http://stackoverflow.com/q/26692423
has answer: http://stackoverflow.com/a/26692564
has comment: http://stackoverflow.com/comment/41980581
tagged with: list
has body: How Modify all elements into unknown type of list? for (Person person : persons) { person = transformer.transform(person); } But this construction create new person every time, I know that it's wrong. And I guess that it's better to use iterator but, I don't know how should I do it exactly. Please don't give me any links to javadoc iterator. Ok If it was ArrayList I just need to do like this for (int i = 0 ; i &lt; persons.size ; i++) { persons[i] = transformer.transform(persons[i]); }
tagged with: java
downvote count: 3
upvote count: 1
tagged with: updates
has answer: http://stackoverflow.com/a/26692502
type: Question
has comment: http://stackoverflow.com/comment/41980523
type: AnsweredQuestion
score: -2
has title: Modify all elements into unknown type of list
possible better answer: http://stackoverflow.com/a/26692529
has answer: http://stackoverflow.com/a/26692529
has comment: http://stackoverflow.com/comment/41980559
tagged with: iterator
answer count: 3
has comment: http://stackoverflow.com/comment/41980525
accepted answer: http://stackoverflow.com/a/26692502
favorite count: 0
has comment: http://stackoverflow.com/comment/41980593

http://stackoverflow.com/a/26779564
has comment: http://stackoverflow.com/comment/42157729
downvote count: 0
has comment: http://stackoverflow.com/comment/42150076
has body: Unfortunatly, XPath does not use the namespace prefixes definend in the document. You need either to xpath.setNamespaceContext(...) with your prefixes, or use a library that handles all that automatically. Here is reading the teacher as object done with XMLBeam. Reading Class elements is simply the same. public class TestXMLParsing { public interface Schedule { public interface Teacher { @XBRead("./classes/ref:class/@ref") String[] getClassRefs(); @XBRead("./name") String getName(); @XBRead("./position") String getPosition(); } @XBRead("//data:teacher[@id='{0}']") Teacher getTeacher(String id); } @Test public void readTeacherAndClassesRef() throws IOException { Schedule schedule = new XBProjector(Flags.TO_STRING_RENDERS_XML).io().url("resource://schedule.xml").read(Schedule.class); Teacher teacher = schedule.getTeacher("T72100"); System.out.println(teacher.getName()+"\n"+teacher.getPosition()+"\nclasses:"); for (String classRef : teacher.getClassRefs()) { System.out.println(classRef); } } } To my eyes this looks more straight forward and understandable as processing the DOM by hand.
type: Answer
has comment: http://stackoverflow.com/comment/42179566
has comment: http://stackoverflow.com/comment/42157441
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42168183
has comment: http://stackoverflow.com/comment/42158119
has comment: http://stackoverflow.com/comment/42158317
answers question: http://stackoverflow.com/q/26776005
has comment: http://stackoverflow.com/comment/42165551

http://stackoverflow.com/comment/42139596
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26780991
has text: Just a couple of things - if the `driver` is being initialized as a static field then there is no need to pass it as a method parameter. I know this is only a suggested modification but if going the route of JUnit (which I personally prefer) maybe convert the whole code to resemble a test case.
score: 1

http://stackoverflow.com/a/26683571
score: 0
answers question: http://stackoverflow.com/q/26683547
type: Answer
has body: Java is nice there and invokes undergraduate.writeoutput. You can not invoke persons method except from undergraduate via super.

http://stackoverflow.com/q/26717853
has title: Exporting an empty or node based blender model using Chilli Source model exporter
has answer: http://stackoverflow.com/a/26733158
upvote count: 1
type: AnsweredQuestion
tagged with: blender
has body: Apologies for not using any tags related to the Chilli Source engine, but it's a new engine and doesn't appear to have any tags yet. What I'm trying to achieve is a 2D looking object (made up of planes or sprite components) from a simple node based model. This is so I can swap the parts of the body around (head, body, etc) without having multiple materials for each character or moving UVs around the place. I've tried exporting empties and armatures but neither produce anything when run though the exporter. I get a little lost in the tool within the CSModelConverter. It appears the nodes wont export because they're of type COLLADA_NODE_TYPE.BASE instead of either CONTROLLER or GEOMETRY. Here is what is produced in the DAE with the empty nodes (Doesn't format well, blame blender). 1 0 0 1.201311 0 7.54979e-8 -1 0.04089412 0 1 7.54979e-8 0.8485807 0 0 0 1 It's a simple transform that looks like it should be compatable but I think where it fails is the fact it has no material and geometry. It doesn't have UVs either, but I guess they might not be required. I might be trying to do things the difficult way by changing the exporter to support empty blender objects. Is there any way to achieve this in the model exporter without either writing my own collada parser or heavily modifying the one with Chilli Source? Here's the full dae file. <?xml version="1.0" encoding="utf-8"?> Blender User <authoring_tool>Blender 2.72.0 commit date:2014-10-21, commit time:11:38, hash:9e963ae</authoring_tool> 2014-11-03T13:29:40 2014-11-03T13:29:40 <unit name="meter" meter="1"/> <up_axis>Z_UP</up_axis> <library_images/> <library_effects/> <library_controllers/> <library_visual_scenes> <visual_scene id="Scene" name="Scene"> 1 0 0 0.01576674 0 7.54979e-8 -1 -0.3080968 0 1 7.54979e-8 1.016 0 0 0 1 1 0 0 1.781394 0 7.54979e-8 -1 -0.3080968 0 1 7.54979e-8 1.016 0 0 0 1 1 0 0 1.201311 0 7.54979e-8 -1 0.04089412 0 1 7.54979e-8 0.8485807 0 0 0 1 1 0 0 0.9169789 0 7.54979e-8 -1 0 0 1 7.54979e-8 1.4382…
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26733158
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26767232
tagged with: java
tagged with: hibernate
tagged with: database
tagged with: orm
accepted answer: http://stackoverflow.com/a/26767933
type: Question
answer count: 1
tagged with: jpa
score: 0
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26767933
has title: Hibernate. Multiple Parameters on session.get()
has body: Is there a way run multiple parameters through session.get() in Hibernate? public User method(String param1, String param2) { Session session = sessionFactory.getCurrentSession(); return (User) session.get(User.class, param1); }

http://stackoverflow.com/comment/42108382
comment on: http://stackoverflow.com/a/26761048
type: AnswerComment
score: 0
type: Comment
has text: I promise final question :) you have advised me to use generateCombinationsIterative(Arrays.asList(arr),fnum,snum); to call the method however I cannot actually call this as it is no longer a type but a char due to changing the list to Character. The error: incompatible types: inference variable T has incompatible bounds equality constraints: Character lower bounds: char[] where T is a type-variable: T extends Object declared in method <T>asList(T...)

http://stackoverflow.com/q/26714367
answer count: 3
tagged with: machine-learning
accepted answer: http://stackoverflow.com/a/42237341
upvote count: 7
has comment: http://stackoverflow.com/comment/42048718
has comment: http://stackoverflow.com/comment/42020022
has comment: http://stackoverflow.com/comment/42020475
tagged with: search
linked to: http://stackoverflow.com/q/42889605
type: AnsweredQuestion
downvote count: 0
score: 7
possible better answer: http://stackoverflow.com/a/27225062
favorite count: 0
has answer: http://stackoverflow.com/a/42237341
has answer: http://stackoverflow.com/a/34967255
tagged with: relevance
has answer: http://stackoverflow.com/a/27225062
type: Question
has title: Elasticsearch: Learning from clicks (Search result ranking)
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/42024045
has body: I have read over the chapter "Learning from clicks" in the book Programming Collective Intelligence and liked the idea: The search engine there learns on which results the user clicked and use this information to improve the ranking of results. I think it would improve the quality of the search ranking a lot in my Java/Elasticsearch application if I could learn from the user clicks. In the book, they build a multiplayer perceptron (MLP) network to use the learned information even for new search phrases. They use Python with a SQL database to calculate the search ranking. Has anybody implemented something like this already with Elasticsearch or knows an example project? It would be great, if I could manage the clicking information directly in Elasticsearch without needing an extra SQL database.
tagged with: java

http://stackoverflow.com/a/26805219
type: Answer
has body: Parameters are passed by value in Java, not by reference. So when you assign stream in your method, it only pertains to the method you are in, and won't set the value of the variable you passed in.
upvote count: 1
answers question: http://stackoverflow.com/q/26805166
score: 1
downvote count: 0

http://stackoverflow.com/q/26680052
tagged with: java
has body: I've build an application in Java with the help of JFace/SWT. I am using mainly the TableViewer of JFace and sometime the SWT table behind with myTableViewer.getTable(). My table has a header (filled with the column names) and the first row is rendered with CCombos in CellEditors (drop down menus for filters). Now I want to fix this first row ("filter-row") in the table, so it is always shown, independently if I am scrolling down or not.. Do you know any opportunity to do this (instead of splitting one table in two tables, as I found it in the internet)?
type: Question
tagged with: tableviewer
score: 0
has answer: http://stackoverflow.com/a/26700986
answer count: 1
type: UnansweredQuestion
tagged with: swt
tagged with: jface
has title: Java JFace TableViewer fix/freeze row

http://stackoverflow.com/q/26794562
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26794604
tagged with: java
has title: Errors: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression
has comment: http://stackoverflow.com/comment/42163755
has body: The code is not allowing me to log in from the database: package Business; import java.io.Serializable; import java.sql.*; public class Student implements Serializable { private int iD; private String password; private String firstName; private String lastName; private String street; private String city; private String state; private double zip; private String eMail; private double gpa; private String message; /** * No arg constructor that sets the default value of all * customer properties to an empty string value. */ public Student() { this.iD = 0; this.password = ""; this.firstName = ""; this.lastName = ""; this.street = ""; this.city = ""; this.state = ""; this.zip = 0; this.eMail = ""; this.gpa = 0; } public void setID(int id) { this.iD = iD; } public void setPassword(String password) { this.password = password; } public void setFirstName(String firstName) { this.firstName = firstName; } public void SetLastName(String lastName) { this.lastName = lastName; } public void setStreet(String street) { this.street = street; } public void setCity(String city) { this.city = city; } public void setState(String state) { this.state = state; } public void setZip(double zip) { this.zip = zip; } public void setEMail (String email) { this.eMail = email; } public void setGpa(double gpa) { this.gpa = gpa; } public int getID() { return iD; } public String getPassword() { return password; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getStreet() { return street; } public String getCity() { return city; } public String getState() { return state; } public double getZip() { return zip; } public String getEMail() { return eMail; } public double getGpa() { return gpa; } public String getMessage() { return this.message; } public boolean login(String password) throws SQLException { boolean yes_no = false; /* Verify password against database password for the userId */ if (password.equals(this.password)) { this.message =…
type: Question
has answer: http://stackoverflow.com/a/26794667

http://stackoverflow.com/q/26695671
has title: How to add word tags in to JTextField?
answer count: 1
downvote count: 0
tagged with: swingx
favorite count: 0
has body: I am creating Java Swing application. I want to add tags to JTextField. When I add tag I can search another tag to add. Same like stack overflow. Is there any jar files to do that? Please tell me if there any other solutions. example image tag http://imageshack.com/a/img674/925/kQRLxw.jpg
accepted answer: http://stackoverflow.com/a/26696549
upvote count: 2
tagged with: swing
score: 2
has comment: http://stackoverflow.com/comment/41986347
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41986299
type: Question
has answer: http://stackoverflow.com/a/26696549
has comment: http://stackoverflow.com/comment/41988202
has comment: http://stackoverflow.com/comment/41986335

http://stackoverflow.com/a/26704203
score: 1
has comment: http://stackoverflow.com/comment/42021339
upvote count: 1
has comment: http://stackoverflow.com/comment/42021796
has comment: http://stackoverflow.com/comment/42022370
type: AcceptedAnswer
downvote count: 0
has body: I've asked this question to a friend architect and this is what he wrote me: Let’s think what is REST? REST is just a representation layer, which exposes a view on the system. It already draws a distinction (systems boundaries) between system and its representation, what we have here is classic problem of different responsibilities. I do strongly believe that “value is system boundary”. I wouldn’t expose domain objects, but rather create value objects, which are transformed from and to domain objects. It means creating whole bunch of value objects which represent individual resources at REST layer. Of course if your are in Java world it means creating classes, with getters and setters, but it is definitely worth it. I may sound like fascists but I would draw clear boundary between domain and its representation, you would just need nice mapping layer (there is plenty of these), but I wouldn’t like to see domain objects in JAXRS endpoints (resources). This way you create anticoruption layer between you and and other thirdparty frameworks you use for BPM, so in short it means upgrades and changes in these frameworks will be under YOUR control. So I think you are heading into right direction, but would not use domain classes in JAXRS, and create Value Objects. I would need to build following layers. BPM engine -> common interface (which in my understanding look like Strategies from DDD) -> VO objects which are build by root aggregates (you need a way to factor these objects), VO should have JSON mapping annotations, not common interfaces -> JAXRS which access root aggregates, gets VO from them -> Jackson does the magic of mapping So thanks to this you could have stable interface, you don’t want to rebuild your REST layer every time something changes inside of the system. So VO are here to hide how your internal interface (common interfaces) change. Correct me if I am wrong, but you want to create kind of common lowest denominator of BPM engines, to have same model, desp…
type: Answer
accepted answer of: http://stackoverflow.com/q/26690847
answers question: http://stackoverflow.com/q/26690847

http://stackoverflow.com/a/26771609
upvote count: 0
answers question: http://stackoverflow.com/q/26771250
has body: Check below example. public static void main(String[] args) { String firstNameArr[] = { "diamond", "Iron", "Leather" }; String lastNameArr[] = { "Leggings", "Boots", "Helmet"}; List&lt;String&gt; fullNameList = new ArrayList&lt;String&gt;(); for (String firstname : firstNameArr) { for(String lastName : lastNameArr){ fullNameList.add((firstname+" "+lastName)); } } }
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/42150532
type: Answer

http://stackoverflow.com/q/26743618
tagged with: while-loop
type: AnsweredQuestion
has body: I am writing a method that takes user integer inputs and display the Total, Average, Maximum and Minimum. I have the total and average working but I am getting 2147483647 for the max and -2147483648 for the minimum. The loop must only end when the user inputs -1. My code: public static void processNumbers() { Menu m = new Menu(); clrscr(); int count = 0; // Number of times a value has been added int num = 0; // The Integer that the user inputs int tot = 0; // The total sum of the inputs int avg = 0; // The average value of the inputs int max = Integer.MAX_VALUE; // The maximum value of the inputs int min = Integer.MIN_VALUE; // The minimum value of the inputs System.out.println ("Please enter a whole number (e.g. 150)"); while ((num = Genio.getInteger()) != -1) { count ++; tot += num; avg = tot / count; //Calculate the average the while loop if(tot&gt;max) max = tot; if(tot&lt;min) min = tot; System.out.println("Total \t Average\t Maximum\t Minimum\n"); System.out.println(tot + "\t" + avg + "\t\t" + max + "\t" + min + "\n"); } clrscr(); System.out.println("You entered -1, you will now return to the menu!"); pressKey(); m.processUserChoices(); }
has answer: http://stackoverflow.com/a/26743632
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26743632
accepted answer: http://stackoverflow.com/a/26743629
tagged with: java
tagged with: loops
has title: Cannot get correct max and min values of user inputs
has answer: http://stackoverflow.com/a/26743629

http://stackoverflow.com/a/26750115
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26749889
has body: Your newServer instance doesn't call TransactionServer() ! so : TransactionServer newServer=new TransactionServer(); newServer.TransactionServer();
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26749889
type: Answer
has comment: http://stackoverflow.com/comment/42084198

http://stackoverflow.com/comment/108800577
score: 0
type: Comment
type: QuestionComment
has text: @LóriNóda no, sorry, I remember neither the problem nor solution now )
comment on: http://stackoverflow.com/q/26778150

http://stackoverflow.com/a/55185129
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26684562
has body: Simple answer. The map operation can produce a Stream of Stream.EX Stream&lt;Stream&lt;Integer&gt;&gt; flatMap operation will only produce Stream of something. EX Stream&lt;Integer&gt;
type: Answer
upvote count: 5

http://stackoverflow.com/a/43802789
score: 0
answers question: http://stackoverflow.com/q/26819471
has body: javax.websocket javax.websocket-api 1.0 provided trying to use with provided or like in previous post
type: Answer

http://stackoverflow.com/a/26761929
answers question: http://stackoverflow.com/q/26761568
score: 0
has body: Java is a stronlgy typed language. In C(++) you get some automatic conversions between different buildin-types like float and boolean, so that any float not equal to 0 means true. Java does not allow those kind of conversions. One way (though very dirty) would be to rewrite your if-conditions: [...] if (0 != c) { ... } [...] This would emulate the C(++) semantics.
type: Answer

http://stackoverflow.com/a/26731422
score: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26731412
downvote count: 0
has body: you have to start the programm with agruments. java GreetingClient myServer 1337 Here is an official tutorial for that topic
accepted answer of: http://stackoverflow.com/q/26731412
type: Answer
upvote count: 2

http://stackoverflow.com/q/26682862
type: Question
accepted answer: http://stackoverflow.com/a/26682913
downvote count: 0
tagged with: tomcat8
tagged with: tomcat
answer count: 1
favorite count: 0
tagged with: eclipse-luna
has answer: http://stackoverflow.com/a/26682913
upvote count: 3
type: AnsweredQuestion
score: 3
has title: Tomcat 8 giving JSP compilation error
tagged with: java
has body: I was using tomcat 7 and just upgraded to tomcat 8. But when I run my web application on tomcat server. It gives this error. Stacktrace:] with root cause org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [42] in the generated java file: [/home/jamil/LunaWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/svc/org/apache/jsp/index_jsp.java] The method getDispatcherType() is undefined for the type HttpServletRequest Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenti…
tagged with: eclipse

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/26793175
tags question: http://stackoverflow.com/q/26697536
tags question: http://stackoverflow.com/q/26747470

http://stackoverflow.com/a/26786367
has comment: http://stackoverflow.com/comment/42149410
has body: Try to load the class after compiling it by using, Thread.currentThread().getContextClassLoader().loadClass("com.ur.class"); Found this...check if this can help.. // Create a new custom class loader, pointing to the directory that contains the compiled // classes, this should point to the top of the package structure! URLClassLoader classLoader = new URLClassLoader(new URL[]{new File("./").toURI().toURL()}); // Load the class from the classloader by name.... Class&lt;?&gt; loadedClass = classLoader.loadClass("com.ur.class"); // Create a new instance... Object obj = loadedClass.newInstance(); // Santity check if (obj instanceof com.ur.class) { // code here ... } For more information refer this: How do you dynamically compile and load external java classes?
has comment: http://stackoverflow.com/comment/42149657
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42149586
answers question: http://stackoverflow.com/q/26786172
has comment: http://stackoverflow.com/comment/42149799

http://stackoverflow.com/a/26824497
type: Answer
has body: You're close! Do something like (no idea what you're coding in so this will be pseudo-code): function numDiv(int a, int b, int divBy) { int x; if(a&gt;b) x=1+a-b; else x=1+b-a; return floor(x/divBy); } the floor and +1 will should get you there.
answers question: http://stackoverflow.com/q/26824472
score: 0

http://stackoverflow.com/q/26824825
tagged with: sockets
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Send object via socket
tagged with: client-server
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26825187
accepted answer: http://stackoverflow.com/a/26825187
favorite count: 0
has body: I want to send x object over socket but when I run this code i got nothings. it is stop at new ObjectInputStream(socket.getInputStream()) and don't do any thing else. Server class: public class Server { private static final int PORT = 9001; ServerSocket listener; private Handler h[] = new Handler[5]; private int clientCount = 0; public Server() throws Exception{ System.out.println("The server is running."); listener = new ServerSocket(PORT); run(); } public void run(){ while (true) { try { addClient(listener.accept()); } catch (Exception e) { e.printStackTrace(); } } } private void addClient(Socket socket) throws Exception{ h[clientCount] = new Handler(this, socket,clientCount); h[clientCount].open(); clientCount++; } public static void main(String[] args) throws Exception { Server s = new Server(); } } Handler class // Handle class: public class Handler extends Thread { private Server server; private Socket socket; private int ID = -1; private ObjectInputStream obIn = null; private ObjectOutputStream obOut = null; public Handler(Server _server, Socket _socket, int i){ super(); server = _server; socket = _socket; ID = i; } public void open() { try { obIn = new ObjectInputStream(socket.getInputStream()); obOut = new ObjectOutputStream(socket.getOutputStream()); x= ob.readObject(); } catch (Exception e) { e.printStackTrace(); } } } The client: public class Client { ObjectInputStream oin; ObjectOutputStream oot; private Socket socket = null; public Client() { String serverAddress = "127.0.0.1"; try { socket = new Socket(serverAddress, 9001); oin = new ObjectInputStream(socket.getInputStream()); oot = new ObjectOutputStream(socket.getOutputStream()); System.out.println("hello i am a client"); oot.writeObject(x); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { Client client = new Client(); } }

http://stackoverflow.com/comment/42008029
has text: I have already tried that and it does not work due to duplicate of site.
comment on: http://stackoverflow.com/a/26707783
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42217401
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26824164
has text: And the new code works fine for me. Im using jGRASP
type: AnswerComment

http://stackoverflow.com/q/26677788
answer count: 1
tagged with: compilation
has answer: http://stackoverflow.com/a/26693534
tagged with: thrift
score: 0
has comment: http://stackoverflow.com/comment/41965549
has comment: http://stackoverflow.com/comment/42020302
has title: Error while compiling thrift generated classes with Java 1.5
tagged with: c++
has body: `Platform`: Windows 7, MinGW, MSYS, Java 1.5 I have thrift 0.9.1 compiler (prebuilt for windows) and source. I use Ant to build java library. I create one thrift idl and compile it with the compiler. No problem in generating code files. I add these files in my project, and that add slf4j (downloaded from their site) and libthrift. Most of the errors that I have previously (imports etc) are gone except for errors related to overriding methods. So basically it complains like: The method clear() of type Server must override a superclass method and similarly for compareTo, write, read etc. In short it complains about all methods that are overridden. This is all thrift compiler generated code and I haven't changed anything. Is there any incompatibility? I cannot really find any mention of that. I have tried removing and then adding the libraries, I have also tried cleaning, refreshing, validating the project but the errors are still there. I have also tried to compile the code (thrift code) but MinGW is also a huge headache. It cannot find configure even though I have installed it. And if I run the msys console, it is able to configure but cannot make complaining about inttypes.h not present (which is not in msys include directory but is present in MinGW include directory.). Any suggestion would be appreciated.
has comment: http://stackoverflow.com/comment/41966296
accepted answer: http://stackoverflow.com/a/26693534
has comment: http://stackoverflow.com/comment/41958908
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41959193
has comment: http://stackoverflow.com/comment/42017497
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/26631900

http://stackoverflow.com/a/32869385
score: 13
answers question: http://stackoverflow.com/q/26749128
has body: Try adding a type annotation onto the UUID type e.g. @Type(type = "pg-uuid") @Column(name = "id", columnDefinition = "uuid") private UUID id; I just worked past the same error
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26749128
upvote count: 13

http://stackoverflow.com/comment/41977846
comment on: http://stackoverflow.com/a/26690639
has text: I have <form:errors path="name"/>, I thought it should work, isn't it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42036415
type: Comment
type: QuestionComment
has text: It works when I run it normally though.. only the test fails and it's because the Activity doesn't seem to create properly, I just don't know why it doesn't.
comment on: http://stackoverflow.com/q/26722555
score: 0

http://stackoverflow.com/comment/41962074
comment on: http://stackoverflow.com/q/26679224
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by live variable?

http://stackoverflow.com/q/26776574
accepted answer: http://stackoverflow.com/a/26794791
favorite count: 0
tagged with: binding
has comment: http://stackoverflow.com/comment/42159695
tagged with: templates
has title: use c++ template to generate JNI functions
tagged with: c++
has answer: http://stackoverflow.com/a/74052864
possible better answer: http://stackoverflow.com/a/74052864
has answer: http://stackoverflow.com/a/26794791
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java-native-interface
tagged with: java
type: Question
answer count: 2
has body: I want to use C++ template to generate slot functions and register these functions to the jvm the java code can call, like: template&lt;typename Arg1&gt; void bind_native(const char* className, const char* staticMethodName, function&lt;void(Arg1)&gt;* slotFunc) { JNINativeMethod sig; sig.name = staticMethodName; sig.signature = Wrapper&lt;void(Arg1)&gt;::Get().GetSignature(); sig.fnPtr = Wrapper&lt;void(Arg1)&gt;::Get().GetSlotFunc(slotFunc); // register to jni.. } // bind our native function to java. function&lt;void(int)&gt; cppIntFunc = [](int intFromJava) { printf("called from java"); }; bind_native("MyClass", "MyCppMethod", &amp;cppIntFunc); // we can also bind different functions with the same signature to jni. function&lt;void(int)&gt; cppIntFunc1; function&lt;void(int)&gt; cppIntFunc2; bind_native("MyClass", "MyCppMethod1", &amp;cppIntFunc1); bind_native("MyClass", "MyCppMethod2", &amp;cppIntFunc2); // in java code: class MyClas { private static native MyCppMethod(int i); private static native MyCppMethod1(int i); private static native MyCppMethod2(int i); } but question is, the same template generate the same function, so I can not distinguish which method is called in the jni therefore I can not get the original slot function back: template&lt;typename Arg1&gt; struct Wrapper { void* GetSlotFunc(function&lt;void(Arg1)&gt;* slotFunc) { // how to map the slotFunc to the StaticJniFunc? return StaticJniFunc; } static JNICALL void StaticJniFunc(JNIEnv* e, jclass c, Arg1 param1) { // how to get the slotFunc back here? (*slotFunc)(param1); } }; maybe I need to find a way to get the running jmethodID from jni?
downvote count: 0

http://stackoverflow.com/q/26793599
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/59250867
has answer: http://stackoverflow.com/a/26793774
has comment: http://stackoverflow.com/comment/42162391
favorite count: 0
has title: Carpet calculator error calling a class?
possible better answer: http://stackoverflow.com/a/59250867
type: Question
accepted answer: http://stackoverflow.com/a/26793774
score: -2
has comment: http://stackoverflow.com/comment/42162208
tagged with: java
has comment: http://stackoverflow.com/comment/42162329
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/42162251
upvote count: 1
has comment: http://stackoverflow.com/comment/42162504
tagged with: object
has comment: http://stackoverflow.com/comment/42162297
has body: The assignment goes as stated: The problem The westfield carpet company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To calculate the price, you multiply the area of the floor(width times length) by the price per square foot of carpet. For example, the area of floor that is 12 feet long and 10 feet wide is 120 square feet. To cover that floor with carpet that costs $8 per square foot would cost $960 (12x10x8=960) First, you should create a class named RoomDimension that has two Feields: one for the lenght of the room and one for the width. The RoomDimension class should have a method that returns the area of the room (the area of the room is the room's length multiplied by the room's width). Next, you should create a RoomCarpet class that has a RoomDimension object as a field. It should also have a field for the cost of the carpet per square foot. The RoomCarpet class should have a method that returns the total cost of the carpet. Once you have written these classes, use them in an application that asks the user to enter the dimensions of a room and the price per square foot of the desired carpeting. The application should display the total cost of the carpet. The code I have below can't seem to run due to an error in the 31st line of the MainProgram import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class MainProgram { public static void main(String[] args) { final double CARPET_PRICE_PER_SQFT = 8.0; // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Display intro. System.out.println("This program will display the " + "carpet cost of a room." + "\nPlease enter the room's " + "dimension in feet."); // Get the length of the room. System.out.print("Enter the length of room: "); double length = keyboard.nextDouble(); // Get the width of the room. System.out.print("Enter the width of room: "); double width = keyboard.nextDouble(); //close keyboard…
has comment: http://stackoverflow.com/comment/42162472
tagged with: class
has comment: http://stackoverflow.com/comment/42162209

http://stackoverflow.com/comment/41949079
type: Comment
type: QuestionComment
score: 1
has text: That method does not override `hashCode()` in `Object` because the name is wrong.
comment on: http://stackoverflow.com/q/26674729

http://stackoverflow.com/comment/42185049
has text: Well we don't know why it's there to start with. I can't really advise you on how to configure your machine.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26804498

http://stackoverflow.com/comment/42097510
has text: as one of the httpunit committers I'am sorry to say that httpunit's javascript support might be too limited for your ajax expectations. Your mileage may vary and you'd have to try it out and ask with a more elaborate example here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26736306

http://stackoverflow.com/q/26702179
tagged with: noclassdeffounderror
has comment: http://stackoverflow.com/comment/41999703
type: Question
accepted answer: http://stackoverflow.com/a/28315475
linked to: http://stackoverflow.com/q/6337673
has comment: http://stackoverflow.com/comment/42001050
has comment: http://stackoverflow.com/comment/41997825
has answer: http://stackoverflow.com/a/31161339
has comment: http://stackoverflow.com/comment/58553589
has body: I am trying to launch a new activity using the code: Intent i = new Intent(this, TempLobbyActivity.class); startActivity(i); finish(); When I launch this code I get the following exceptions when executing the Intent constructor. FATAL EXCEPTION: main Process: com.edr.iveflownthat, PID: 1457 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/edr/iveflownthat/TempLobbyActivity; at com.edr.iveflownthat.pages.MainActivity.tryAutoLogin(MainActivity.java:46) at com.edr.iveflownthat.pages.MainActivity.onCreate(MainActivity.java:22) at android.app.Activity.performCreate(Activity.java:5933) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.edr.iveflownthat.TempLobbyActivity" on path: DexPathList[[zip file "/data/app/com.edr.iveflownthat-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] FATAL EXCEPTION: main Process: com.edr.iveflownthat, PID: 1457 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/edr/iveflownthat/TempLobbyActivity; at com.edr.iveflownthat.pages.MainActivity.tryAutoLogin(MainActivity.java:46) at com.edr.iveflownthat.pages.MainActivity.onCreate(MainActivity.java:22) at android.app.Activity.performCreate(Activity.java:5933) at android.app.Instru…
has comment: http://stackoverflow.com/comment/41997962
has title: Failing to launch activity due to ClassNotFoundException
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26702372
has answer: http://stackoverflow.com/a/33543209
has answer: http://stackoverflow.com/a/26702372
answer count: 5
tagged with: android
linked to: http://stackoverflow.com/q/28644256
tagged with: android-intent
score: 14
type: AnsweredQuestion
upvote count: 14
has answer: http://stackoverflow.com/a/28315475
tagged with: java
has answer: http://stackoverflow.com/a/27224656

http://stackoverflow.com/q/26801272
has title: Java with redistributed JRE: cannot find native dependencies
accepted answer: http://stackoverflow.com/a/26891790
answer count: 1
downvote count: 0
favorite count: 0
has body: I would like to redistribute a jre with my application. I have a problem with using native libraries. Say I have a jar: application.jar, which has dependencies on two native libraries (dll): a.dll and b.dll. All are in the same directory. Application.jar contains one class: Test.java package com.mytest; public class Test { static { System.loadLibrary("a"); System.loadLibrary("b"); } public static void main(String[] args) { System.out.println("hooray"); } } When executing: java -jar application.jar it works just fine. Then I copy my JRE folder from program files to the folder: C:\data\jre\ Now I execute: c:\data\jre\bin\java.exe -jar application.jar It fails with the following message: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\data\application\b.dll: The specified procedure could not be found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1088) at com.mytest.Test.&lt;clinit&gt;(Test.java:6) When I remove the line where library b is loaded, it works just fine. Given that library a and b are in the same directory, why is the system unable to find b?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26891790
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-native-interface

linked-list
tags question: http://stackoverflow.com/q/26818382
tags question: http://stackoverflow.com/q/26822030
tags question: http://stackoverflow.com/q/26719988
tags question: http://stackoverflow.com/q/26708633
tag name: linked-list
tags question: http://stackoverflow.com/q/26752609
tags question: http://stackoverflow.com/q/26768429
tags question: http://stackoverflow.com/q/26823759
tags question: http://stackoverflow.com/q/26813336
tags question: http://stackoverflow.com/q/26761714
type: Tag
tags question: http://stackoverflow.com/q/26819914
tags question: http://stackoverflow.com/q/26679121
tags question: http://stackoverflow.com/q/26823195
tags question: http://stackoverflow.com/q/26750013
tags question: http://stackoverflow.com/q/26713888
tags question: http://stackoverflow.com/q/26716468
tags question: http://stackoverflow.com/q/26815677
tags question: http://stackoverflow.com/q/26813449
tags question: http://stackoverflow.com/q/26704201
tags question: http://stackoverflow.com/q/26704512
tags question: http://stackoverflow.com/q/26693121
tags question: http://stackoverflow.com/q/26737018
tags question: http://stackoverflow.com/q/26679200
tags question: http://stackoverflow.com/q/26693557
tags question: http://stackoverflow.com/q/26809242
tags question: http://stackoverflow.com/q/26761075
tags question: http://stackoverflow.com/q/26734216
tags question: http://stackoverflow.com/q/26773844
tags question: http://stackoverflow.com/q/26707229
tags question: http://stackoverflow.com/q/26813765
tags question: http://stackoverflow.com/q/26783447
tags question: http://stackoverflow.com/q/26813346

http://stackoverflow.com/comment/42033957
type: Comment
has text: The logic is wrong. isViewed && (position == numberOfPages.length) will never occur, position is zero indexed. You need to check length-1, and also the isViewed need to be per-page - not one shared flag for all pages.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26722011

http://stackoverflow.com/comment/42068859
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26740890
has text: Which version of Mule are you using .. community Edition or Enterprise Edition ?
score: 0

http://stackoverflow.com/comment/42046845
comment on: http://stackoverflow.com/q/26707853
score: 0
type: Comment
type: QuestionComment
has text: I've opened a ticket [here](http://jira.codehaus.org/browse/GROOVY-7146) - thanks a lot for your support. I've worked around the problem by injecting the needed methods after object creation, but I want to return to traits later because they seem like a 'cleaner' solution to me.

http://stackoverflow.com/a/36577717
has body: If you would like the string version of the PublicKey: String publicKeyString value = "-----BEGIN PUBLIC KEY-----\n" + new String(Base64.encode(publicKey.getEncoded())) + "\n-----END PUBLIC KEY-----";
answers question: http://stackoverflow.com/q/26711731
score: 0
type: Answer

unsatisfiedlinkerror
tags question: http://stackoverflow.com/q/26742319
tag name: unsatisfiedlinkerror
type: Tag
tags question: http://stackoverflow.com/q/26761348

http://stackoverflow.com/q/26720768
tagged with: java
possible better answer: http://stackoverflow.com/a/46720331
tagged with: spring-data
has answer: http://stackoverflow.com/a/46720331
type: Question
has answer: http://stackoverflow.com/a/72196439
has answer: http://stackoverflow.com/a/32923234
has answer: http://stackoverflow.com/a/52838394
linked to: http://stackoverflow.com/q/62485592
downvote count: 0
answer count: 7
has title: Spring Data PageImpl not returning page with the correct size?
favorite count: 0
has answer: http://stackoverflow.com/a/54900247
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/32918031
accepted answer: http://stackoverflow.com/a/32923234
has body: I am trying to create a new Page using a list of objects retrieved from the database. First I get all the elements from the DB, convert it to a Stream and then use lambda to filter the results. Then I need a Page with a set number of elements, however, instantiating a new PageImpl doesn't seem to return a page with the correct size. Here is my code: List&lt;Produtos&gt; listaFinal; Stream&lt;Produtos&gt; stream = produtosRepository.findAll().stream(); listaFinal = stream.filter(p -&gt; p.getProdNome().contains("uio")).collect(Collectors.toList()); long total = listaFinal.size(); Page&lt;Produtos&gt; imp = new PageImpl&lt;&gt;(listaFinal,pageable,total); Here's a screenshot from debugging: Note the size in the Pageable object is set to 20 and it understands that it needs 4 pages to render the 70 elements, but it returns the whole list. What am I missing? Edit answering the comment made by Thomas: I understand how to use Page to return just a slice of the data. The code I showed was my attempt to use a lambda expression to filter my collection. The problem for me is I want to use Java 8's lambda to query the database via Spring Data JPA. Im used to VB.NET's and Entity function(x) query expressions and was wondering how to do the same with Spring JPA. In my repository, Im using extends JpaRepository&lt;Produtos, Integer&gt;, QueryDslPredicateExecutor&lt;Produtos&gt; which gives me access to findAll(Predicate,Pageable). However, the Predicate is not typed so I cant simply use p -&gt; p.getProdNome().contains("uio") in the query. I'm using SQL Server and Hibernate.
tagged with: spring
score: 19
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26735373
type: AnsweredQuestion
upvote count: 19

http://stackoverflow.com/q/26746886
tagged with: java
has comment: http://stackoverflow.com/comment/42133092
has title: Found multiple catalog/schemas matching null.PUBLIC - Hsqldb / Liquibase
has comment: http://stackoverflow.com/comment/42141909
score: 0
has body: I am using Atlassian Jira SDK with liquibase and hsqldb 1.8. When I run the liquibase maven plugin to install the database schema, the follow error is printed: [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.2.2:update (default-cli) on project portal-db: Error setting up or running Liquibase: liquibase.exception.UnexpectedLiquibaseException: liquibase.snapshot.InvalidExampleException: Found multiple catalog/schemas matching null.PUBLIC -> [Help 1] Java Version: 1.6 Jira SDK: 5.0.4 Hsqldb: 1.8 Liquibase: 3.2.2 How it is possible to fix this? thanks for reading.
answer count: 1
tagged with: hsqldb
has comment: http://stackoverflow.com/comment/42100146
has answer: http://stackoverflow.com/a/26786539
has comment: http://stackoverflow.com/comment/42117638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42117469
accepted answer: http://stackoverflow.com/a/26786539
tagged with: maven
tagged with: liquibase
tagged with: jira
type: Question

http://stackoverflow.com/comment/42067544
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26740725
has text: count is being populated by a while statement: while(inputStream.hasNext())

http://stackoverflow.com/comment/42095945
comment on: http://stackoverflow.com/a/26756436
type: Comment
has text: Nice Tetris game! looks good but.. I think I need to approach this problem the way I imagine it to work. Otherwise I will just copying someone else's code and that wont make me a better programmer. I´ve broken down my project into small problems, and each problem should get me closer to a finished game. Currently it´s the collision part I need to solve. But thanks again =)
score: 0
type: AnswerComment

http://stackoverflow.com/q/26693220
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41982338
accepted answer: http://stackoverflow.com/a/26693310
has comment: http://stackoverflow.com/comment/41982031
has body: This lab we are doing in class is giving me a lot of trouble, and I wanted someone to help explain it to me. My teacher is out of town this weekend and so he can't answer my questions. The point of this lab is to find the first and last letter of each string. We also have to use "return" methods, but I am confused as to how they should be used. I know that I have to use "charAt();", but i'm not sure where to put this and how to test certain strings from another method. import static java.lang.System.*; public class firstandlast { public String s, word, getFirst, getLast; public firstandlast(String s) { } public void setString(String s) { } public String getFirst() { return ""; } public String getLast() { return ""; } public String toString() { String output = ""; return output; } } Code that tests the main class: import static java.lang.System.*; public class firstrunner { public static void main ( String[] args ) { firstandlast demo = new firstandlast("Hello"); demo.setString("Hello"); System.out.println( "first letter :: " + demo.getFirst() ); System.out.println( "last letter :: " + demo.getLast() ); demo.setString("World"); System.out.println( "first letter :: " + demo.getFirst() ); System.out.println( "last letter :: " + demo.getLast() ); //add more test cases } } I appreciate any help!
answer count: 3
has title: First and Last Character of a String
has comment: http://stackoverflow.com/comment/41982000
tagged with: string
has comment: http://stackoverflow.com/comment/41981974
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/47109654
has comment: http://stackoverflow.com/comment/41982030
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26693310
possible better answer: http://stackoverflow.com/a/26693252
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26693252

http://stackoverflow.com/q/26722757
favorite count: 0
has answer: http://stackoverflow.com/a/26841379
type: UnansweredQuestion
tagged with: matlab
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Running matlab predict and nearest K in deployed jar file
has body: I'm trying to run a very simple function in matlab that works when I run it there function testFunction mdl = fitcknn([1,1,1],[1]); predict(mdl,[1,1,1]); disp('done') end however when I compile this into a jar file (and I've tried doing this with multiple MATLAB versions) I get the following error thrown Undefined function 'classreg.learning.modelparams.KNNParams.make' for input arguments of type 'char'. Error in classreg.learning.FitTemplate/fillIfNeeded (line 517) Error in classreg.learning.FitTemplate.make (line 122) Error in ClassificationKNN.fit (line 755) Error in fitcknn (line 263) Error in testFunction (line 2) Is this because it's impossible to deploy the fitcknn function? If so, what should I do as an alternative?
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42137499
type: Comment
comment on: http://stackoverflow.com/a/26779230
score: 0
type: AnswerComment
has text: @jens just curious: can we simply do: `HashMap<String,String> map = new HashMap<String, String>();` and not `Map<String,String> map..`? Thanks.

http://stackoverflow.com/comment/42127280
type: Comment
comment on: http://stackoverflow.com/q/26774131
score: 0
has text: Spring takes care of that, you should post the tomcat error message
type: QuestionComment

http://stackoverflow.com/comment/42143650
type: Comment
comment on: http://stackoverflow.com/a/26781130
score: 0
type: AnswerComment
has text: Hi, I had been looking into parsing the string as a byte stream as you mentioned. It is giving out about the structure of the xml in the string however. "[Fatal Error] :1:3: The markup in the document preceding the root element must be well-formed." Is there any way to ignore the XML formatting and just parse in the string as text ?

http://stackoverflow.com/comment/42117703
type: AnswerComment
has text: It seems pretty clear to me that `list` is the head of the list. Two hints : first, this is the node used to initialize the iteration over the list, and second it is the node used to point the new head of the list in the case `element <= list(0)`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26768519

http://stackoverflow.com/a/39104056
downvote count: 1
has body: Just add @color/white to your current app theme.
score: 46
has comment: http://stackoverflow.com/comment/79114285
upvote count: 47
answers question: http://stackoverflow.com/q/26788464
type: Answer

http://stackoverflow.com/q/26717679
has title: Converter affects routine auto generated code
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26719696
type: Question
has body: I am using custom type converters with JOOQ, which work fine for tables but create uncompilable code for routines. For example I have a public class DateConverter implements Converter&lt;Date, LocalDate&gt; but when auto-generating code some functions that accept a date as a parameter lead to the following code being generated: public static final org.jooq.Parameter&lt;java.time.LocalDate&gt; VALUE_DATE = createParameter("value_date", org.jooq.impl.SQLDataType.DATE); I understand that a related feature is planned for 3.5.0 that will probably solve the issue but I am on 3.4.4 and wonder if there is a workaround.
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26719696
tagged with: jooq

vector
tags question: http://stackoverflow.com/q/26694771
type: Tag
tag name: vector
tags question: http://stackoverflow.com/q/26761093
tags question: http://stackoverflow.com/q/26830104
tags question: http://stackoverflow.com/q/26750496

http://stackoverflow.com/comment/42154943
has text: you'll actually read as [UTF-16](http://stackoverflow.com/a/14224007) but that doesn't change a thing
type: AnswerComment
comment on: http://stackoverflow.com/a/26789013
type: Comment
score: 0

http://stackoverflow.com/comment/42029032
comment on: http://stackoverflow.com/a/26718407
type: AnswerComment
score: 0
type: Comment
has text: Great if that helped anyhow. Good luck with Hiberante, sir. Amazing tool ;)

http://stackoverflow.com/comment/42055187
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26734266
has text: WHen you say Java would you happen to mean jQuery?
score: 0

http://stackoverflow.com/comment/42081542
score: 0
type: Comment
has text: Sorry I'm a beginner at Java. Seems that all these options are wanting me to add in the tester class. Is that where I put it?
type: QuestionComment
comment on: http://stackoverflow.com/q/26748440

http://stackoverflow.com/q/26760369
has comment: http://stackoverflow.com/comment/42129037
answer count: 0
score: 0
tagged with: java
has body: On page A.jsp I have an object which I want to pass to page B.jsp. A.jsp renderRequest.setAttribute("organization", organization); //the second parameter organization is the object. &lt;portlet:renderURL var="addOrganizationURL"&gt; &lt;portlet:param name="mvcPath" value="/html/organization/B.jsp" /&gt; &lt;portlet:param name="organization" value="${organization}" /&gt; &lt;/portlet:renderURL&gt; I set the attribute string organization to the object organization. And then pass it as the &lt;portlet:param&gt;. B.jsp renderRequest.getParameter("organization") //This obviously returns the string of the format {organizationId=, acronym=, name=, url=, description=, backup=false, trainingCourses=false} renderRequest.getAttribute("organization") //This returns the null object The string is not what I want. What I want is to be able to get the object organization itself so that I can invoke the methods on that object. Like organization.getName(), organization.getUrl().
type: Question
tagged with: liferay
has comment: http://stackoverflow.com/comment/42121227
tagged with: portlet
tagged with: jsp
has title: How to pass object as parameter via <portlet:param> in one jsp page and retrieve in other jsp
type: UnansweredQuestion

http://stackoverflow.com/a/26766048
upvote count: 3
has body: Try this : List&lt;String&gt; keys = new ArrayList(map.keySet()); for (int i = 0; i &lt; keys.size(); i++) { String key = keys.get(i); Integer value = map.get(key); //... }
score: 3
answers question: http://stackoverflow.com/q/26765950
downvote count: 0
type: Answer

http://stackoverflow.com/q/26689896
answer count: 1
downvote count: 0
favorite count: 0
tagged with: size
has title: JScrollpane not scrolling big content
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/26689930
type: Question
has body: I have this simple example where I want to display a large panel in a small frame. Java documentation tell the scrollpane will automatically fit its contents in its viewport and add scrollbars. However I have no such luck. No scrollpane nor its content appear. Here is what I have tried. public class MyWindow extends JFrame { JPanel panel; JScrollPane scroll; public MyWindow(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new JPanel(); panel.setSize(1000,1000); scroll = new JScrollPane(panel); add(scroll,BorderLayout.CENTER); setSize(300, 300); setVisible(true); } } As stated in similar questions, I made the panel bigger than frame. I added border layout to frame. Still no luck.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26689930
score: 4
upvote count: 4
tagged with: jscrollpane

http://stackoverflow.com/q/26731671
tagged with: java
tagged with: drawer
type: Question
has comment: http://stackoverflow.com/comment/42050737
score: 0
has body: Here is MainActivity.java public class MainActivity extends ActionBarActivity { // inisiasi toolbar private Toolbar toolbar; // navigation drawer private DrawerLayout drawerLayout; private ActionBarDrawerToggle drawerToggle; String title = "My App"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); if (toolbar != null) { toolbar.setTitle(title); setSupportActionBar(toolbar); } initDrawer(); } /** * init navigation drawer thing */ private void initDrawer() { //setup navigation drawer drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.txt_open, R.string.txt_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); // when drawer closed toolbar.setTitle(title); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); // when drawer open toolbar.setTitle("Nav menu"); } }; // setDrawerlisterner drawerLayout.setDrawerListener(drawerToggle); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); drawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); drawerToggle.onConfigurationChanged(newConfig); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } if (drawerToggle.onOptionsItemSelected(item)) return true; return super.onOptionsItemSelected(item); } } and here is xml file layout view &lt;LinearLayout xmlns:android="htt…
has comment: http://stackoverflow.com/comment/42051221
answer count: 1
has title: how to include items in navigation drawer
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42058444
has answer: http://stackoverflow.com/a/26732173

http://stackoverflow.com/comment/42195033
comment on: http://stackoverflow.com/a/26810932
score: 0
type: Comment
type: AnswerComment
has text: You cracked it, it should be your answer.

http://stackoverflow.com/comment/97856406
comment on: http://stackoverflow.com/a/26752025
type: Comment
has text: Link in the answer is broken
type: AnswerComment
score: 0

http://stackoverflow.com/q/26789754
tagged with: server
has comment: http://stackoverflow.com/comment/42157478
has comment: http://stackoverflow.com/comment/42157023
downvote count: 0
has body: I'm in the process of writing a messaging program, and I'm running into a spot where I'm having trouble understanding how to pass a socket over to a new thread for handling outbound messages via TCP. I'm currently using UDP packets for messages coming from a client, to the server, which, being UDP, doesn't require very much processing, as it's simply listening for incoming packets, before it de-serializes the objects, and processes them as needed in a separate thread. My problem now is, I'm setting up a client initiated TCP socket for reverse traffic, from the server to the assorted clients that connect. I've done a bit of research, and I already understood that each client should have their own thread for handling outgoing messages, along with another thread simply for accepting the incoming connections. I'm unsure of how to actually achieve this, and I've done some research into the topic. I've found this: http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html The resource above basically verified my original suspicion that this would have to be handled by threads dedicated to the client. They included psuedo code here, which is representing my listener thread. while (true) { accept a connection; create a thread to deal with the client; } I'm a bit of a visual learner, and I have been searching for some type of an example where this is done. I'm unsure of what variable I'd be passing over to the thread that keeps the original connection open, and pushes data back to clients. I'm also having a little bit of trouble grasping whether it even keeps the same socket open, or if a new one needs to be established, which then, makes me believe a firewall could interfere, but I know that won't be the case. Can somebody explain this for me in detail? If possible, an example would be greatly appreciated! I'll be likely replying and commenting on responses in about 15-30 minutes from the time this is posted.
has answer: http://stackoverflow.com/a/26793332
has title: Handling Multiple TCP Connections In Java (Server-side)
answer count: 1
favorite count: 0
upvote count: 2
tagged with: sockets
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26793332
score: 2
type: AnsweredQuestion
tagged with: tcp
tagged with: java
type: Question

http://stackoverflow.com/q/26817080
has comment: http://stackoverflow.com/comment/42206135
type: Question
has body: I'm new to Java and I have a problem with this code. The first part works perfectly, it gets the RGB values of every pixel of an input image, then it multiplies the values by specific number and saves the result as new image. try { File input = new File("obr4.png"); image2 = ImageIO.read(input); int width = image2.getWidth(); int height = image2.getHeight(); for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; width; j++) { Color c = new Color(image2.getRGB(j, i)); int red = (int) (c.getRed() * Math.abs(text2value)); if (red &gt; 255) { red = 255; } int green = (int) (c.getGreen() * Math.abs(text2value)); if (green &gt; 255) { green = 255; } int blue = (int) (c.getBlue() * Math.abs(text2value)); if (blue &gt; 255) { blue = 255; } Color newColor = new Color(red, green, blue); image2.setRGB(j, i, newColor.getRGB()); //System.out.println("Row: "+i+" Column: "+j+" Red: "+red+" Green: "+green+" Blue: "+blue); } } File output2 = new File("grayscale2.jpg"); ImageIO.write(image2, "jpg", output2); repaint(); } catch (Exception e2) { System.out.println("Error"); } Same code with different values also works for second image. Now the tricky part: I want the two new created images put in just one picture - just get all pixel values form pic1 and pic2, add them together and print the result. So far I have this code: try { File input1 = new File("grayscale1.jpg"); File input2 = new File("grayscale2.jpg"); finalImage1 = ImageIO.read(input1); finalImage2 = ImageIO.read(input2); for (int i = 0; i &lt; 256; i++) { for (int j = 0; j &lt; 256; j++) { Color c = new Color(finalImage1.getRGB(j, i)); int red1 = (int) (c.getRed()); int green1 = (int) (c.getGreen()); int blue1 = (int) (c.getBlue()); Color o = new Color(finalImage2.getRGB(j, i)); int red2 = (int) (o.getRed()); int green2 = (int) (o.getGreen()); int blue2 = (int) (o.getBlue()); int red = (red1 + red2) / 2; if (red &gt; 255) { red = 255; } int green = (green1 + green2) / 2; if (green &gt; 255) { green = 255; } int blue =…
has comment: http://stackoverflow.com/comment/42206257
has comment: http://stackoverflow.com/comment/42205969
tagged with: rgb
tagged with: image
has comment: http://stackoverflow.com/comment/42205173
score: 0
has comment: http://stackoverflow.com/comment/42204621
has title: Printing two images in one
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42204590
has comment: http://stackoverflow.com/comment/42205786
answer count: 0
has comment: http://stackoverflow.com/comment/42205929
tagged with: java
has comment: http://stackoverflow.com/comment/42206249

http://stackoverflow.com/q/26821562
type: AnsweredQuestion
tagged with: primefaces
accepted answer: http://stackoverflow.com/a/26828717
tagged with: java
score: -1
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/26828717
answer count: 1
downvote count: 1
favorite count: 0
has title: JSF page - Why no validations yet process attribute required?
upvote count: 0
has body: The command button's actionListener event of the following JSF based xhtml page does not work. I do not have any validations on the page. The event only works when I add attribute process="@this" to button tag. As there are no validations, so I do not even get any validation error. But with process attribute I get success message returned by java side handler method. So I am kind of stuck without unwanted process attribute. &lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"&gt; &lt;h:head&gt; &lt;/h:head&gt; &lt;h:body style="margin:0 auto !important;width:80% !important;"&gt; &lt;h:form id="form1"&gt; &lt;p:panel id="rootPanel" style="background-color:#E8E8E8 ;width=90%;padding:10px;margin:10px;border:2px solid black;"&gt; &lt;p:panel id="logoHeaderPanel" style="background-color:#E8E8E8 ;width=70%;padding:30px;margin:30px;border:1px solid black;"&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:graphicImage library="images" name="./headerImage.gif" /&gt; &lt;h:outputLabel style="font-size:2.1em;margin-left:30px" value="Demo App" /&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;p:messages id="messages" autoUpdate="true"/&gt; &lt;p:panel id="mainContentPanel" style="background-color:#E8E8E8 ;width=70%;padding:60px;margin:30px;border:1px solid black;"&gt; &lt;h:panelGrid columns="4"&gt; &lt;h:outputLabel for="a" value="State Search" style="margin:10px;" /&gt; &lt;p:inputText id="a" value="" style="margin:10px;" /&gt; &lt;h:outputLabel for="b" value="Value" style="margin:10px;" /&gt; &lt;p:inputText id="b" value="" style="margin:10px;" /&gt; &lt;h:outputLabel for="c" value="City Search" style="margin:10px;" /&gt; &lt;p:inputText id="c" value="" style="margin:10px;…

http://stackoverflow.com/a/26676421
accepted answer of: http://stackoverflow.com/q/26675441
has body: So, given that your display is static and only the data behind it has to change, you can utilise the power of models. (I can't post a full solution, it would be too long but hopefully it'll show you the general idea.) class WeekData { private String monday; private String tuesday; // and so on } class AllData { private final int minWeek; private final int maxWeek; private int currentWeek; // this is modified by clicking the arrows private Map&lt;Integer, WeekData&gt; weekMap; public IModel&lt;WeekData&gt; createDataModel() { return new IModel&lt;WeekData&gt;() { public WeekData getObject() { return weekMap.get( currentWeek ); } } } public IModel&lt;Integer&gt; createWeekModel() { return new IModel&lt;Integer&gt;() { public Integer getObject() { return currentWeek; } } } } Your FoodFieldPanel initialisation will look like this: public FoodFieldPanel(String id, IModel&lt;AllData&gt; model) { super(id); WebMarkupContainer foodFields = new WebMarkupContainer("foodFields", new CompoundPropertyModel( model.getObject().createDataModel() ) ); TextField monday = new TextField("monday"); TextField tuesday = new TextField("tuesday"); //... foodFields.add(monday); foodFields.add(tuesday); // add(foodFields); } You'll also need to change the code for the arrows in a similar fashion, but the basic idea is that by using dynamic models you can replace the data behind the page without the display code even knowing about the logic. And you don't need the extra ListView. (Although I would personally store the days of the week in a ListView but I didn't want to complicate my answer even further.) This kind of decoupling of display and model is one of Wicket's most powerful features so it's worth learning as much about them as you can.
answers question: http://stackoverflow.com/q/26675441
downvote count: 0
has comment: http://stackoverflow.com/comment/41974488
has comment: http://stackoverflow.com/comment/41974497
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41972788
type: Answer
has comment: http://stackoverflow.com/comment/41976850
upvote count: 3

http://stackoverflow.com/comment/42094821
has text: Why don't you put Observatory as a parameter of Earthquake, instead of String obsName?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26756360
score: 0

http://stackoverflow.com/q/26678516
accepted answer: http://stackoverflow.com/a/26678786
possible better answer: http://stackoverflow.com/a/74300867
has body: I have to sort a Collection by different String attributes that might be empty ("") or even null. Both values are allowed and have to be treated equally. I solved this issue by using a method, that checks each String for null and returns an empty String, when null is found. So far my Comparator looks basicly like this public class MyComparator implements Comparator&lt;MyObject&gt; { @Override public int compare(MyObject o1, MyObject o2) { // ... some logical stuff like e.g. return rein(o1.getSomeValue()).compareTo(rein(o2.getSomeValue()); } private String rein(String str) { return str == null ? "" : str; } } I wonder if this design is considered to be ok or if there are reason against it? If it is not ok, what else may I do to fulfil my requirements? All those (in most cases unneccessary) function calls looks ugly to me, as we are talking about approximately 1/1000 cases. So I wonder if there is a more elegant solution?
has answer: http://stackoverflow.com/a/74300867
type: AnsweredQuestion
has title: Best way to design a Comparator accessing String fields that might be empty or null
score: 0
tagged with: java
type: Question
answer count: 2
tagged with: null
has answer: http://stackoverflow.com/a/26678786
tagged with: comparison
tagged with: string

http://stackoverflow.com/comment/42209496
type: QuestionComment
has text: Why not find the index and then call your working remove method?
comment on: http://stackoverflow.com/q/26819914
score: 0
type: Comment

http://stackoverflow.com/a/26818814
has body: For determining what type the object instance is use either object instanceof class or object.getClass().equals(Clazz.getSimpleName()) For return type just use the superClass (or interface). You can always cast it to the child if needed.
type: Answer
has comment: http://stackoverflow.com/comment/42208068
has comment: http://stackoverflow.com/comment/42207995
answers question: http://stackoverflow.com/q/26818784
score: 0
has comment: http://stackoverflow.com/comment/42208316

http://stackoverflow.com/a/26686023
has comment: http://stackoverflow.com/comment/41975916
type: Answer
has comment: http://stackoverflow.com/comment/41975991
has comment: http://stackoverflow.com/comment/41975969
score: 3
accepted answer of: http://stackoverflow.com/q/26686011
downvote count: 0
answers question: http://stackoverflow.com/q/26686011
has comment: http://stackoverflow.com/comment/41979939
upvote count: 3
type: AcceptedAnswer
has body: you should declare arrayField[] in class area so array Field is accessible from setInMethodWithArray() method. JTextField[] arrayField = new JTextField[2]; //class area in constructor initial it arrayField[i]= new JTextField(10); arrayField[i].setEditable(false); yes this is work arrayField[0].setText("Array index in class"); because arrayField in the constructor scope ..and you are accessing arrayField Within constructor .so it works.. This won't? Why? setInMethodWithArray(); because method setInMethodWithArray() can't access arrayField[] because it's not in method scope or in class scope.that's because you have declare it in the constructor so after constructor code block execute arrayField doesn't exist .it's reference lost because it's local variable .. public void setInMethodWithArray() { arrayField[1].setText("This text will never show up"); } now set can access arratField[] so now your code will work import java.awt.BorderLayout; import javax.swing.*; public class testSetText extends JFrame { private JPanel panel; private JTextField singleField; // Make array of JTextField components private JTextField[] arrayField = new JTextField[2]; public testSetText() { // Specify an action for close button setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Make a panel panel = new JPanel(); for (int i = 0; i &lt; 2; i++) { arrayField[i] = new JTextField(10); arrayField[i].setEditable(false); arrayField[i].setText("&lt;&gt;!"); panel.add(arrayField[i]); } // Make just one JTextField component singleField = new JTextField(10); singleField.setText("Works here"); panel.add(singleField); // Add to panel to frame add(panel); // Pack the contents of the window and display it pack(); setVisible(true); // This will work! arrayField[0].setText("Array index in class"); // This won't? Why? setInMethodWithArray(); // Is this a problem with JTextField itself? Let me try a single element setInMethodWithArray(); // Hmmm so an element in an array of JTextFields can be addressed with set…

http://stackoverflow.com/a/26710383
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42012582
upvote count: 2
has comment: http://stackoverflow.com/comment/42012517
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42012523
has body: Usually table's row is dto. So you need send just collection of dtos using available marshallers (json, xml etc).
accepted answer of: http://stackoverflow.com/q/26710315
answers question: http://stackoverflow.com/q/26710315

http://stackoverflow.com/q/26729349
has comment: http://stackoverflow.com/comment/64614068
type: Question
score: 5
linked to: http://stackoverflow.com/q/38609791
downvote count: 0
tagged with: tomcat
tagged with: android
has title: Unable to configure LocalContainerEntityManagerFactoryBean from @EntityScan, ensure an appropriate bean is registered
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring
has body: I am able to run my application as Spring Boot Application in Eclipse, but while deploying on tomcat I am getting error while context loading as: Unable to configure LocalContainerEntityManagerFactoryBean from @EntityScan, ensure an appropriate bean is registered Stack trace: 2014-11-04 09:47:42.758 INFO 7808 --- [ost-startStop-1] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug) 2014-11-04 09:47:42.779 ERROR 7808 --- [ost-startStop-1] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalStateException: Unable to configure LocalContainerEntityManagerFactoryBean from @EntityScan, ensure an appropriate bean is registered. at org.springframework.util.Assert.state(Assert.java:385) at org.springframework.boot.orm.jpa.EntityScanRegistrar$EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:124) at org.springframework.boot.orm.jpa.EntityScanRegistrar$EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:94) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:778) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:131) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at org.springframework.boot.buil…
upvote count: 5
tagged with: java

http://stackoverflow.com/q/26824108
has comment: http://stackoverflow.com/comment/42217556
upvote count: 1
has comment: http://stackoverflow.com/comment/42218054
has comment: http://stackoverflow.com/comment/42217467
has comment: http://stackoverflow.com/comment/42217802
favorite count: 0
tagged with: integer
has comment: http://stackoverflow.com/comment/42232076
has comment: http://stackoverflow.com/comment/42217516
has comment: http://stackoverflow.com/comment/42217423
answer count: 5
has comment: http://stackoverflow.com/comment/42218193
has comment: http://stackoverflow.com/comment/42217910
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26824330
has comment: http://stackoverflow.com/comment/42217716
has body: I need to have a container for a couple of integers that I'm writing on a file, but it has to be of type int instead of Integer for the sake of minimum bytes taken (32 bits). I know that both Arraylists and Vectors won't take an int so is there a way to do that?
tagged with: java
has comment: http://stackoverflow.com/comment/42217224
has title: Container of int *not Integer* type in Java
has comment: http://stackoverflow.com/comment/42217593
has comment: http://stackoverflow.com/comment/42217251
has answer: http://stackoverflow.com/a/26824146
has answer: http://stackoverflow.com/a/26824386
type: Question
has answer: http://stackoverflow.com/a/26824330
has comment: http://stackoverflow.com/comment/42217767
score: -2
has comment: http://stackoverflow.com/comment/42217865
has comment: http://stackoverflow.com/comment/42217542
has comment: http://stackoverflow.com/comment/42217854
has comment: http://stackoverflow.com/comment/42217506
possible better answer: http://stackoverflow.com/a/26824140
tagged with: containers
has comment: http://stackoverflow.com/comment/42217331
has answer: http://stackoverflow.com/a/26824140
has comment: http://stackoverflow.com/comment/42217740
has comment: http://stackoverflow.com/comment/42217378
tagged with: int
has comment: http://stackoverflow.com/comment/42217648
has answer: http://stackoverflow.com/a/26824149
has comment: http://stackoverflow.com/comment/42217676
downvote count: 3

http://stackoverflow.com/q/26804669
answer count: 1
has title: How to Run a Hadoop Program Over Network
type: UnansweredQuestion
tagged with: bigdata
has comment: http://stackoverflow.com/comment/42196196
linked to: http://stackoverflow.com/q/9849776
tagged with: java
has answer: http://stackoverflow.com/a/26852873
has body: It's the first time I'm trying to work with Hadoop. I'm just trying to work with some example code. http://www.drdobbs.com/database/hadoop-writing-and-running-your-first-pr/240153197?pgno=2 I have understood the example but i wanna know if this is possible: I don't have hadoop installed in my computer (it's installed in another computer in my network). I wanna run the jar in my PC but hadoop jobs that my program creates should run on that computer's cluster. Can hadoop be configured like this?
type: Question
tagged with: hadoop
score: 0

http://stackoverflow.com/comment/42069297
type: Comment
type: QuestionComment
has text: Is `packets` an `ArrayList<String>` or an `ArrayList<PackOfCrisps>` (or some other type)? If it isn't an `ArrayList<String>`, you won't have `equals` return true. (I don't know your exact code, but you could try changing `if( packets.get(n).equals(flavour)){` to `if( packets.get(n).flavour.equals(flavour)){`.)
score: 1
comment on: http://stackoverflow.com/q/26741726

http://stackoverflow.com/q/26728736
tagged with: jersey
has comment: http://stackoverflow.com/comment/42046425
has title: InvocationTargetException while consuming RESTful webservices in java
type: UnansweredQuestion
answer count: 0
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/42113406
has body: I am trying to consume RESTful webservices using Jersey. Target URL : http://&lt;host&gt;:8080/CatalogWS/publish/getCatFile?catalogId=CAT-865122 I have written the client class as below. try { // ClientConfig cfg = new DefaultClientConfig(); Client c = Client.create(); WebResource resource = c .resource("http://&lt;host&gt;:8080/CatalogWS/publish/getCatFile?catalogId=CAT-865122"); String resp = resource.accept(MediaType.APPLICATION_XML).get(String.class); System.out.println("Resp: :" + resp); } catch (Exception e) { e.printStackTrace(); } When i tried to run this... i am getting following exceptions.. java.lang.reflect.InvocationTargetException 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.sun.jersey.api.client.Client$DefaultComponentProvider.getInstance(Client.java:151) at com.sun.jersey.impl.application.ComponentProviderCache.getComponent(ComponentProviderCache.java:133) at com.sun.jersey.impl.application.ComponentProviderCache.getProvidersAndServices(ComponentProviderCache.java:103) at com.sun.jersey.impl.application.MessageBodyFactory.getProviderMap(MessageBodyFactory.java:132) at com.sun.jersey.impl.application.MessageBodyFactory.initReaders(MessageBodyFactory.java:106) at com.sun.jersey.impl.application.MessageBodyFactory.init(MessageBodyFactory.java:101) at com.sun.jersey.api.client.Client.&lt;init&gt;(Client.java:244) at com.sun.jersey.api.client.Client.&lt;init&gt;(Client.java:185) at com.sun.jersey.api.client.Client.create(Client.java:379) at TestClient.main(TestClient.java:19) Caused by: java.lang.NullPointerException at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.&lt;init&gt;(AbstractJAXBProvider.java:97) at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.&lt;init&gt;(AbstractRootElementPr…
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42045673
tagged with: web-services
tagged with: jersey-client

http://stackoverflow.com/a/30316015
upvote count: 1
score: -6
has comment: http://stackoverflow.com/comment/64349577
type: Answer
downvote count: 7
answers question: http://stackoverflow.com/q/26697122
has body: I spent a lot of time looking for how to do this. What worked for me was changing Request.Method.PUT to Request.Method.POST
has comment: http://stackoverflow.com/comment/78035109

http://stackoverflow.com/comment/42061048
type: Comment
has text: you are right. I agree that the difference is not so significant, both algos are essentially linear (LinkedList must search linearly for the item).
comment on: http://stackoverflow.com/a/26737089
type: AnswerComment
score: 0

http://stackoverflow.com/q/26700897
tagged with: listview
type: Question
has answer: http://stackoverflow.com/a/26701055
has title: Printing SQLite entries into a ListView
has body: I am having some trouble learning the ins and outs of the SQLite world. I have some code that is allowing me to enter data into a DB. But what i want to do is return this data into a listview. At the moment all I could figure out to do was to have each row printed in a toast after a new entry is added. Can someone please show me how to alter my code to print it in a listview? Or to even look at my code and see that i am going about it in the right way. Thanks This is the code i am using which calls a display record function //---get all Records--- com.example.rory.dbtest.DBAdapter db = new com.example.rory.dbtest.DBAdapter(this); db.open(); Cursor c = db.getAllRecords(); if (c.moveToFirst()) { do { DisplayRecord(c); } while (c.moveToNext()); } db.close(); This is the display record function public void DisplayRecord(Cursor c) { Toast.makeText(this, "id: " + c.getString(0) + "\n" + "Item: " + c.getString(1) + "\n" + "Litres: " + c.getString(2), Toast.LENGTH_SHORT).show(); } I know i need to change the second function but i dont know how to do that to make it print into a listview
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26701455
tagged with: android
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/26701455
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26701951
tagged with: java
possible better answer: http://stackoverflow.com/a/26701055

http://stackoverflow.com/a/26758935
answers question: http://stackoverflow.com/q/26758300
score: 0
has body: With the assumption that your code works with exponents other than powers of 2, then indeed your code runs in O(log n) time
has comment: http://stackoverflow.com/comment/42099406
type: Answer

http://stackoverflow.com/comment/42073953
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26743933
has text: Try not adding the dummy time. It will come out zeroes, but It should do the correct format on its own.
score: 0

http://stackoverflow.com/comment/42038820
comment on: http://stackoverflow.com/q/26724663
type: Comment
has text: Surely you just need to get rid of `+ "\n"`... although you should also use try-with-resources for `BufferedReader` and `BufferedWriter`...
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42181346
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26804040
has text: Please post your MyAdapter code

http://stackoverflow.com/comment/42080275
has text: I kind of figured that it was stuck in an infinite loop, but how do I get it to return false when I want it to
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26747580

http://stackoverflow.com/q/26791644
tagged with: protocol-buffers
has body: I am brand new to protocol buffers library.. I know how to send request and get response back from a web service using JSON as my payload format...But I do not know how to do the same with protobuf. Can some one please help and list a small example? Fmy my project , I want to send the following three things to the server: { "session_id": "xxxxxx", "location": { "latitude": xx.xx, "longitude": xx.xx } } Any help is appreciated. Thanks a ton in advance
has comment: http://stackoverflow.com/comment/42170898
has title: How to send HTTP request with protocol buffers as the payload format?
type: UnansweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42215761
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42191685
answer count: 1
has answer: http://stackoverflow.com/a/31443481
tagged with: junit
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/27700406
has comment: http://stackoverflow.com/comment/43814293
type: Answer
upvote count: 1
downvote count: 1
has body: TreeNode newNode = new DefaultTreeNode(a, rootNode); Collection&lt;Catagary&gt; c=port.viewCategoryByPId(a); for (Catagary cat : c) { TreeNode newNode2 = createTree(cat.getId(), newNode); } write this code.
score: 0
answers question: http://stackoverflow.com/q/26814001

http://stackoverflow.com/a/26693917
type: Answer
accepted answer of: http://stackoverflow.com/q/26693846
downvote count: 0
score: 1
has body: Simple logic error. Based on your current code the while loop will never run because val&lt;.0001 will always be false (1 &gt; .0001). You need to modify that line to this: while(val &gt; 0.0001){ Also it's usually better to write decimals with a 0 in front of the . for improved readability.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26693846
upvote count: 1

http://stackoverflow.com/comment/43266804
comment on: http://stackoverflow.com/q/26806239
has text: Developer Note: We noticed that the getDefaultSuggestions was being called automatically when the user would tab into the SuggestBox(onFocus), but not when the user would mouse click on the SuggestBox(onClick). To resolve this required us to add a ClickHandler to the SuggestBox.getValueBox. However, that left us with the initial issue. If this was the first time the SuggestBox had gained focus we had no callback object. The simple answer was to call showSuggestionList() which will request default suggestions. Might have been obvious to others, but took some digging for me to figure it out.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42245622
type: Comment
has text: In the catch block you can forward to `/ErrorHandler` instead of error page. The example of error handler servlet I have posted.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26802105

http://stackoverflow.com/q/26785873
has title: Java array fills, and values print. But, memory always prints after
answer count: 1
accepted answer: http://stackoverflow.com/a/26785937
favorite count: 0
tagged with: java.util.scanner
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42148466
score: 1
tagged with: java
upvote count: 1
tagged with: memory
has answer: http://stackoverflow.com/a/26785937
type: Question
has body: My project its to take in and read a file then load its contents into an array, the have a user alter it and find things from it. My problem though is when I go to search the array it always prints out the contents, along with something that is stored in the memory. I can't figure out how to stop it because I can't figure out what that something is. This is what it prints though Directory1@27391d. import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class Directory1{ private int size=0; private String[] dval;//Sting Array public Directory1(String directoryFileName){ int size=0;//counter for the array Size int ct=0;//counter dval = new String[size];//New String array File file= new File(directoryFileName); try{ Scanner insert = new Scanner(file); Scanner populate= new Scanner(file);//Scans File //Counts the amount of lines to get array size while(populate.hasNextLine()){ String i= populate.nextLine(); size++; } dval= new String[size]; //Inserts values into the array for(int i=0;i&lt;dval.length;i++){ String j= insert.nextLine(); dval[ct]= j; System.out.println(dval[ct]); ct++; } }catch(FileNotFoundException e) { e.printStackTrace(); } }//End Constructor } When I Initialize it using this it always prints out the names in the directory but also prints out something in the memory. public class Directory{ public static void main(String[] args){ Directory1 direct= new Directory1("directory.txt"); System.out.println(direct); } }
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/26825685
type: Answer
has body: Create a list to return. Loop through the String looking for spaces. For each space that you find, add a substring to the list, that starts at the zero index and goes up to the space (not including the space). When there are no more spaces, add the entire string to the list, and return.
score: 1
answers question: http://stackoverflow.com/q/26825650
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26701104
type: Answer
has body: Seems to me that you don't want to return value for each call. Better would be creating a StringBuilder and constructing a grid inside the StringBuilder (with newLine after each outer iteration) and then returning toString of the constructed StringBuilder outside the loops. Anyway, if your mapSize is 0, you will never get to any return statement (and as it's runtime data, compiler has no way of knowing the argument size. public String display(){ StringBuilder sb = new StringBuilder(); for(int i = 0; i &lt; mapSize; i++){ for(int j = 0; j &lt; mapSize; j++){ if(poorSignal[i][j]){ //don't use comparing to true if you have stored boolean values sb.append("O "); }else{ sb.append("X "); } } sb.append("\n"); } return sb.toString; }
score: 0
answers question: http://stackoverflow.com/q/26701056

http://stackoverflow.com/a/26800584
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42175388
has comment: http://stackoverflow.com/comment/42174794
answers question: http://stackoverflow.com/q/26799782
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26799782
has comment: http://stackoverflow.com/comment/42175330
has comment: http://stackoverflow.com/comment/42175121
score: 2
has comment: http://stackoverflow.com/comment/42174847
has comment: http://stackoverflow.com/comment/42175336
has body: You need to convert the ciphertext to base 64 encoding, and back to bytes before decrypting. Either that or you need to keep treating the ciphertext as binary. There are no character encodings that will use every possible random byte value as printable character. So using just the default character encoding as you do now is going to lead to data loss. When data is lost you will get an exception indicating that the size of the ciphertext is incorrect, or that the padding used within the RSA encryption is invalid.
has comment: http://stackoverflow.com/comment/42175242
has comment: http://stackoverflow.com/comment/42175311

http://stackoverflow.com/a/26767443
type: Answer
has comment: http://stackoverflow.com/comment/42136227
score: 2
accepted answer of: http://stackoverflow.com/q/26767216
has body: The Listener is not called by your program. Swing calls the Listener when an apropiate event happens. For example: say we write a KeyListener for a TextField. If the user starts typing in this TextField, Swing will call the corresponding methods in the listener. So, the Listener is called by Swing, not by your code and thus you cannot write it for an own thread. This principle is also known as Hollywood principle ("Don't call us, we call you!") (wikipedia.org). This link gives a good introduction to Events and Listener in Swing. EDIT As mentioned by SJuan76, we are able to launch seperate threads FROM the listener to do stuff we want them to.
answers question: http://stackoverflow.com/q/26767216
has comment: http://stackoverflow.com/comment/42115864
has comment: http://stackoverflow.com/comment/42116021
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42127401

spliterator
type: Tag
tag name: spliterator
tags question: http://stackoverflow.com/q/26812096

http://stackoverflow.com/q/26731870
possible better answer: http://stackoverflow.com/a/26731965
has comment: http://stackoverflow.com/comment/42052901
has comment: http://stackoverflow.com/comment/42053214
tagged with: android
has answer: http://stackoverflow.com/a/26756475
accepted answer: http://stackoverflow.com/a/26756475
has body: I am new to android. I have implemented custom ArrayAdapter in my Android Application using view holder. The getView() function of my ArrayAdapter is as follows for reference: @Override public View getView(int position, View convertView, final ViewGroup parent) { View row = convertView; MyClassViewHolder myClassViewHolder; MyClass myClass; if(row == null) { LayoutInflater inflater = ((Activity)mContext).getLayoutInflater(); row = inflater.inflate(resourceId, parent, false); if(resourceId == R.layout.my_row_item) { myClassViewHolder = new MyClassViewHolder(); myClassViewHolder.title = (EditText) row.findViewById(R.id.title); myClassViewHolder.switch = (Switch) row.findViewById(R.id.switch); } } else { myViewHolder = (MyViewHolder) row.getTag(); } if(resourceId == R.layout.my_row_item) { myClass = (MyClass) myClassList.get(position); //myClassList sent as parameter to constructor of adapter if(myClassViewHolder != null &amp;&amp; myClass != null) { myClassViewHolder.title.setText(myClass.getTitle()); myClassViewHolder.switch.setChecked(myClass.isEnabled()); myClassViewholder.id = myClass.getId(); myClassViewHolder.switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //GET ID OF THE ROW ITEM HERE } }); } } } First of all I want to associate an id which is from database to every row item to perform actions on them. So please confirm if the way I have done is is right or wrong. Secondly in the above code I have a String as title and a Switch in every row item. I want to set an onClickListener on each switch. On toggling the switch i want to get the id of the row item which is associated as per point 1. Thanks in advance. Please let me know if I haven't described my problem properly.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42087187
tagged with: android-layout
has comment: http://stackoverflow.com/comment/42094887
tagged with: java
has answer: http://stackoverflow.com/a/26731965
type: Question
score: 0
answer count: 2
has title: Android Custom ArrayAdapter of list - Java
has comment: http://stackoverflow.com/comment/42085088

http://stackoverflow.com/comment/42019187
comment on: http://stackoverflow.com/a/26714301
has text: Using statics for this is just bad design. I would totally not recommend it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42221455
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26826686
has text: The exception is about a closed *channel,* not a closed connection. The application has closed the channel itself and then continued to use it. It is a coding bug.

http://stackoverflow.com/a/26729264
upvote count: 3
type: Answer
score: 3
has body: You can't do that with Ternary operator in Java since setNull() is void method. From §JLS.15.25: ConditionalExpression: ConditionalOrExpression ConditionalOrExpression ? Expression : ConditionalExpression The conditional operator is syntactically right-associative (it groups right-to-left). Thus, a?b:c?d:e?f:g means the same as a?b:(c?d:(e?f:g)). The conditional operator has three operand expressions. ? appears between the first and second expressions, and : appears between the second and third expressions. The first expression must be of type boolean or Boolean, or a compile-time error occurs. It is a compile-time error for either the second or the third operand expression to be an invocation of a void method.
answers question: http://stackoverflow.com/q/26729238
downvote count: 0

http://stackoverflow.com/a/26747771
has body: Your problem is a loop like this: while(substring.equals("I")) { number = number+1; last = last +1; first=first +1; } If the program enters that loop, it will stuck there, because you're not changing the value of substring. Therefore substring.equals("I") will always return true and the only way to stop that loop is terminating the application. A better way to convert the entered String could be this: public int toNumber(String n) { int number = 0; for (char chr : n.toUpperCase().toCharArray()) { switch(chr) { case 'I': number += 1; break; case 'V': number += 5; break; default: break; } } return number; } It converts the provided String to uppercase (viii -> VIII) to avoid checking both cases of every char and converts it into a char array. This array will be used in a foreach loop that takes every single entry of it and tests it in a switch block. Every supported roman numeral has his own case there to increment number accordingly. Currently it supports I and V like in your code. Btw, number += 1 is just a short version of number = number + 1. After that loop, it returns the converted integer value.
accepted answer of: http://stackoverflow.com/q/26747580
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26747580

http://stackoverflow.com/comment/42155444
type: QuestionComment
has text: @PaulRichter But he is calling setName on a null reference above. Why are you calling the setter there? Why not just remove that line?
comment on: http://stackoverflow.com/q/26789605
score: 0
type: Comment

http://stackoverflow.com/q/26793075
tagged with: java
tagged with: eclipse
type: Question
tagged with: validation
answer count: 1
has body: I'm a beginner programmer, I have been writing code for about three weeks now. I want to make a simple program that asks for user input temperature and tells whether or not the user has fever (temperature higher than 39). I also want to validate the user input, meaning that if the user types "poop" or "!@·R%·%" (symbol gibberish), the program will output the phrase "invalid input". I'm trying to use the try/catch statements, this is my code: package feverPack; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ try{ InputStreamReader inStream = new InputStreamReader(System.in); BufferedReader stdIn = new BufferedReader(inStream); System.out.println("please input patient temperature in numbers"); String numone =stdIn.readLine();} catch (IOException e) { System.out.println("invalid input"); } catch (NumberFormatException e){ System.out.println("invalid input"); } int temp = Integer.parseInt(numone) ; System.out.println("Your temperature is " + temp + "ºC"); if (temp &gt; 39) { System.out.println("You have fever! Go see a doctor!"); } else{ System.out.println("Don't worry, your temperature is normal"); } } } There is an error in line 22 (when i transform numone into a temp) saying "numone cannot be resolved to a variable", as I am a beginner I don't really know what to do, please help.
has answer: http://stackoverflow.com/a/26793089
score: 0
tagged with: input
has comment: http://stackoverflow.com/comment/42161565
linked to: http://stackoverflow.com/q/19130217
has comment: http://stackoverflow.com/comment/42161381
accepted answer: http://stackoverflow.com/a/26793089
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42161693
has title: basic input validation with java.io

http://stackoverflow.com/comment/42196002
type: Comment
comment on: http://stackoverflow.com/a/26811577
has text: Called 200 million times, still there (even in the inlined version at the caller). I am wondering whether this is a HotSpot bug or just an artifact of the debug output. The runtime measurements (significant slow down) indicate the former.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42127460
type: Comment
comment on: http://stackoverflow.com/a/26768554
score: 0
type: AnswerComment
has text: sorry I did not really understand what it is you need. If you give me a concrete example, happy to help.

http://stackoverflow.com/a/26779381
score: 0
has comment: http://stackoverflow.com/comment/42168526
type: Answer
answers question: http://stackoverflow.com/q/26777627
has comment: http://stackoverflow.com/comment/42139641
has body: Probably because your retrieved data does not overflow to disk. Caching is done in memory until some threshold is overpassed. Try to reduce the maxEntriesLocalHeap to something that you know is small enough for your data to overflow and see if the file is created.

http://stackoverflow.com/a/26741416
upvote count: 6
has comment: http://stackoverflow.com/comment/42102619
has body: You're only going to get a deadlock if one of your threads obtains one monitor and the other thread obtains the other monitor before the first thread obtains the second monitor. The more threads you have obtaining the monitors on the two objects, the more likely it is that one of them will obtain just one lock and be pre-empted before it gets a chance to obtain the second monitor. In other words, this is fine, and just causes a wait: Thread A Thread B Lock X Lock Y Lock Y // Blocks (temporary) Sleep Lock X Sleep Whereas this causes deadlock: Thread A Thread B Lock X Lock Y Lock Y // Blocks (deadlock) Lock X // Blocks (deadlock) If you move your Thread.sleep(2000) call to between your two synchronized statements (in both methods) then you're almost guaranteed to get a deadlock, without any looping at the top level.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26741290
score: 6
has comment: http://stackoverflow.com/comment/42102437
answers question: http://stackoverflow.com/q/26741290
type: Answer

http://stackoverflow.com/comment/42229485
comment on: http://stackoverflow.com/a/26808943
score: 0
type: AnswerComment
type: Comment
has text: you're welcome! yes, it's not recommanded to use **mm**. For example when you put a big number as width(or height), maybe the device width(or height) is less than this number so your app can crash.

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/26786284
tags question: http://stackoverflow.com/q/26825792
tags question: http://stackoverflow.com/q/26796691
type: Tag
tags question: http://stackoverflow.com/q/26751930
tags question: http://stackoverflow.com/q/26683949

http://stackoverflow.com/a/26822531
has body: I think that you believe that the array name is []people and []cars. It's not. When you declare them, it's actually: Vehicle[] cars = new Vehicle[10]; └───────┘ └──┘ Type var name So the array is named cars, and that's how you should pass it to the other method: GiveAway(cars, people); As a side note: don't give methods names that begin with a capital letter. The conventions are that only type names (classes, interfaces, etc) begin with a capital letter. Constants are all-caps, and methods have a lowercase first letter.
accepted answer of: http://stackoverflow.com/q/26822469
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26822469
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/41997537
has text: Sorry. I forgot. Local at jetty all works fine. But at weblogic it's could not resolved. I use <context:property-placeholder location="classpath*:**foo.properties" />
comment on: http://stackoverflow.com/q/26701891
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26735540
score: 0
answers question: http://stackoverflow.com/q/26732672
type: Answer
has comment: http://stackoverflow.com/comment/42096810
has body: According to the hint of rolfl, one way is not to mix up DOM and JDOM content and use only DOM to create and save the XML as a file: DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); Document doc = dbFactory.newDocumentBuilder().newDocument(); doc.setXmlVersion("1.0"); Element root = doc.createElement("Document"); root.setAttribute("xmlns", "urn:iso:foo"); root.setAttribute("xsi:schemaLocation", "urn:iso:foo bar.xsd"); root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); doc.appendChild(root); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", 2); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(doc); StreamResult xmlfile = new StreamResult(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("testxml.xml"), "UTF8"))); transformer.transform(source, xmlfile); But this is not a fully valid answer since the question is how to use JDOM2 to get the task done.

http://stackoverflow.com/a/26691773
upvote count: 1
has body: First question: No. If the attribute is not in session, i will be null. Second: This behavior is related to concept of immutability and understanding Java's concept of references. Since sessions are storing Objects, your counter will become a reference to Integer object by autoboxing (so there's no need to create the Integer by hand). It is one of the immutable classes in JDK, and to change its value, You will need to create a new object reference, that's why it is required to update the object that is stored in session - because session still stores the reference address to old value.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26691399
answers question: http://stackoverflow.com/q/26691399

nexus
type: Tag
tags question: http://stackoverflow.com/q/26803219
tags question: http://stackoverflow.com/q/26738227
tags question: http://stackoverflow.com/q/26724001
tag name: nexus
tags question: http://stackoverflow.com/q/26802197

http://stackoverflow.com/comment/42170930
type: Comment
type: QuestionComment
has text: that was not the problem. Thanks anyway :)
score: 0
comment on: http://stackoverflow.com/q/26798182

http://stackoverflow.com/a/26759443
has body: Your web.xml says contextConfigLocation /WEB-INF/spring/root-context.xml Unless your root-context.xml includes security-config.xml you'll have to list it there contextConfigLocation /WEB-INF/spring/root-context.xml /WEB-INF/spring/security-config.xml With your latest update I believe that your issue is two-folded, one, not including the security configuration, second missing pom property try adding <spring.security.version>3.1.0.RELEASE</spring.security.version> within your properties section. Version might be wrong for you, but the issue should be fixed
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26758932
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42100690
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42103633
answers question: http://stackoverflow.com/q/26758932

http://stackoverflow.com/a/26719696
type: Answer
has comment: http://stackoverflow.com/comment/42030724
score: 2
has comment: http://stackoverflow.com/comment/42030007
has comment: http://stackoverflow.com/comment/42029544
has comment: http://stackoverflow.com/comment/42033226
has comment: http://stackoverflow.com/comment/42030139
accepted answer of: http://stackoverflow.com/q/26717679
answers question: http://stackoverflow.com/q/26717679
type: AcceptedAnswer
downvote count: 0
has body: From your comments, I take that you're looking for a way to prevent jOOQ's code generator from erroneously applying converted data types to stored function parameters. One workaround I can think of doing this right now is to ensure that none of the procedures / functions is accidentally matched in the code generator configuration. The &lt;expression/&gt; only matches either the fully qualified object name (e.g. the parameter) or the unqualified object name. Another workaround would be to have two distinct code generation configurations: One for tables, the other for routines. That way, it would be much easier to configure converters...
has comment: http://stackoverflow.com/comment/42030922
upvote count: 2

http://stackoverflow.com/a/31055232
upvote count: 2
answers question: http://stackoverflow.com/q/26823191
has comment: http://stackoverflow.com/comment/66240926
downvote count: 0
has body: If you are on linux (which it appears you are from your stacktrace). You need to install libavformat53 and libavcodec53 for javafx's MediaPlayer to work, else you will get that error.
type: Answer
has comment: http://stackoverflow.com/comment/67173337
score: 2

http://stackoverflow.com/q/26694107
answer count: 1
has comment: http://stackoverflow.com/comment/41983886
tagged with: null
has answer: http://stackoverflow.com/a/26694417
has comment: http://stackoverflow.com/comment/41984139
has body: Hoping someone can help me out with a really bizarre problem I am having. In the code below, I am trying to print out the number that's passed in the request. Its a string called number. String number = request.getParameter("number"); ^ String out.print(number); ^ Printing number At the moment this is failing with a null pointer exception, however when I print out number.length() it prints the length. The stack trace also says the null pointer is occuring on this line JSONObject JSONOBJ = new JSONObject(APIResponse.Response); Can anyone explain what is going on? Thanks! &lt;% if (request.getParameter("number") != null) { String number = request.getParameter("number"); if (number.matches("^[0-9]+")) { %&gt; &lt;% ApiRequest APIRequest = new ApiRequest( "/broadband/availability/" + number, "GET", null); /* COULD ALSO PASS POSTCODE BUT ONLY USING CLI FOR NOW */ ApiClient APIClient = new ApiClient(); api.ApiResponse APIResponse = APIClient.send(APIRequest); JSONObject JSONOBJ = new JSONObject(APIResponse.Response); JSONArray JSONARR = JSONOBJ.getJSONArray("products"); %&gt; Services for &lt;% out.print(number); %&gt;
has comment: http://stackoverflow.com/comment/41983540
tagged with: jsp
tagged with: variables
type: UnansweredQuestion
tagged with: pointers
type: Question
has title: Very strange null pointer issue
has comment: http://stackoverflow.com/comment/41983537
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41984274

http://stackoverflow.com/q/26709473
has comment: http://stackoverflow.com/comment/42048432
has comment: http://stackoverflow.com/comment/42028542
answer count: 0
score: 0
type: UnansweredQuestion
type: Question
has title: Apply promise to request in Play Framework
tagged with: java
has comment: http://stackoverflow.com/comment/42090263
has comment: http://stackoverflow.com/comment/42048625
tagged with: playframework
has comment: http://stackoverflow.com/comment/42060029
has body: I am trying to manage contacts feed received from google in my Controller.The feed is passed from the front end using a POST request. The request is quite large having hundreds of entries. When I try to parse the feed as Document document = request().body().asXml(); it fails with the following exception. 2014-11-03_12:33:41.948 DEBUG play - Invalid Json com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input in VALUE_STRING at [Source: [B@79c1d9a1; line: 1, column: 204801] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1524) ~[jackson-core-2.3.2.jar:2.3.2] at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:557) ~[jackson-core-2.3.2.jar:2.3.2] at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:487) ~[jackson-core-2.3.2.jar:2.3.2] at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(P . . . I think its because the request was not fully loaded and I am trying to parse an incomplete request leading to an invalid Json. How can I apply Promise to the request(). Could someone help me?
tagged with: promise
has comment: http://stackoverflow.com/comment/42014489

http://stackoverflow.com/a/26758608
type: Answer
has body: I think the best advice that can be given here is to research the basics of Java packages. This is a good place to start: Java packages tutorial It covers such topics as: Creating and Using Packages Using Package Members Managing Source and Class Files Having read that, you should be able to understand the problems you are facing.
score: 0
answers question: http://stackoverflow.com/q/26749357

http://stackoverflow.com/a/40695234
downvote count: 1
type: Answer
upvote count: 0
has body: Well, this could be due to not restarting your cmd. Try restarting your cmd, this helped me. Or try to provide administrator privileges.
score: -1
answers question: http://stackoverflow.com/q/26725901

http://stackoverflow.com/comment/42031333
type: QuestionComment
comment on: http://stackoverflow.com/q/26720466
type: Comment
score: 0
has text: There is no exception. Let's say in server S1, a2.ear invokes the remote object and it gets the object from a1.ear deployed on server S1. But I want the remote object that is deployed on S2 server.

http://stackoverflow.com/q/26823040
linked to: http://stackoverflow.com/q/25224323
linked to: http://stackoverflow.com/q/14187963
type: AnsweredQuestion
has title: switch javafx/jrubyfx scenes after some external event
has answer: http://stackoverflow.com/a/26855179
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
accepted answer: http://stackoverflow.com/a/26855179
type: Question
has body: I'm modeling a prototype that will use JavaFX. The application will be similar with a kiosk, for self service. however before the client interact with it, the administrator should unlock it. The administrator will be able to send some remote commands, via a dedicated channel (HTTP or IPC or USB device). Examples of command would be: start, stop and reset How should I do it? a) Can I have a Task, running in another thread pooling actively an IPC and if there is message there, switch the Scene? b) to have a reactor running in a thread and as soon receives a command, it pass it to the JavaFX thread. are both options valid? does exist a third one?
linked to: http://stackoverflow.com/q/13784333
tagged with: jruby
linked to: http://stackoverflow.com/q/18710039
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26746919
favorite count: 0
has title: Static syncronized method and non-static synchronized method can both work on static member variables and this can cause unexpected behaviour
has answer: http://stackoverflow.com/a/26747084
score: 2
type: AnsweredQuestion
has body: I syncronized a static method and a non-static method as follows: public class Demo { static int myvalue; synchronized static public void getStatic() { myvalue = 2; } synchronized public void get() { myvalue = 1; } } Then from the Thread 1 I called only the static method and from the Thread 2 I called only the non-static method. As one call is locked on the object and the other on the class, there is no waiting to get the lock. So, that means that both the functions can run at the same time. Now, the fact is that both the functions work on static member variables (myvalue in the example). That can be a problem in a multi-threading application. Why do the Java creators didn't take this into account? What can be the right way of dealing with this type of situation?
upvote count: 2
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/26747084
type: Question
has answer: http://stackoverflow.com/a/26747096
tagged with: java
accepted answer: http://stackoverflow.com/a/26747096
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/42063557
has text: Did I mention that `rawQuery` never returns `null`? Anyway, the problem might be that Android does not want to display more than 50 toasts …
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26737594
type: Comment

http://stackoverflow.com/comment/41986910
has text: Thank you for you answer. I just found the alternative solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/26695374
score: 0
type: Comment

http://stackoverflow.com/a/32415152
score: 0
answers question: http://stackoverflow.com/q/26802822
type: Answer
has body: You can use this configuration: log4j.rootLogger=INFO, stdout log4j.appender.stdout=org.apache.log4j.DailyRollingFileAppender #log4j.appender.stdout.layout=org.apache.log4j.HTMLLayout log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%d](%F:%L) - %m%n #log4j.appender.stdout.File=/usr/tomcat7/webapps/ngp/newgen.log log4j.appender.stdout.File=c:/logs/DSP.log #log4j.appender.stdout.DatePattern='.'yyyy-MM-dd log4j.appender.stdout=org.apache.log4j.RollingFileAppender log4j.appender.stdout.MaxBackupIndex=1 log4j.appender.stdout.append=false

http://stackoverflow.com/q/26830909
has answer: http://stackoverflow.com/a/26830950
tagged with: java
type: Question
has body: I created a project with 2 classes, Product and Stock. Now I created a third class "Menu" to interact with my 2 classes. I'm using JOptionPane with the showInputDialog. I'd like to get the input to the type "Product" from my self created class. I know there's a way to parse the input (String) to an Integer. int keuze = Integer.parseInt(input); So I'm searching an equivalent way to do this. private void addNewProductType() { String input = JOptionPane.showInputDialog("Which product do you want to add?\n"); stock.addNewProduct(input); }
tagged with: class
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26831013
has title: Parse String to Object in Java
type: UnansweredQuestion
tagged with: input

http://stackoverflow.com/comment/41971803
type: Comment
has text: @Sophie yes..Use intent for checking playing in ActivityA..@Blaze Tama posted it as answer check like that
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26687067

http://stackoverflow.com/comment/49622353
comment on: http://stackoverflow.com/q/26748648
score: 0
type: Comment
type: QuestionComment
has text: @NikhilTalreja, Did you manage to fix this?

http://stackoverflow.com/q/26676160
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/26677243
tagged with: class
answer count: 1
favorite count: 0
has title: Basics to creating a class in java
type: AnsweredQuestion
has body: This is a simple question, but my AP Comp Sci book just doesn't explain it well enough and you guys are always useful. What is the basic way of creating a custom class in Java and creating methods within that class, then later calling those methods. I know its simple but I can't find a good explanation anywhere
tagged with: oop
has comment: http://stackoverflow.com/comment/41951473
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/26677243
type: Question
has comment: http://stackoverflow.com/comment/41951459

http://stackoverflow.com/a/26827525
accepted answer of: http://stackoverflow.com/q/26820113
answers question: http://stackoverflow.com/q/26820113
upvote count: 1
has comment: http://stackoverflow.com/comment/69688685
has body: The answer here is going to depend upon whether you're using the Classic SDK or the REST SDK. In either case, if you look at the source of the Paypal Core SDK here, it seems that this issue has already been reported and fixed. In particular in the code of com.paypal.core.DefaultHttpConnection (which is the class in the Paypal SDK setting the PATCH HTTP method) you'll now see the following comment: * Workaround for a bug in {@code HttpURLConnection.setRequestMethod(String)} * The implementation of Sun/Oracle is throwing a {@code ProtocolException} * when the method is other than the HTTP/1.1 default methods. So to use {@code PATCH} * and others, we must apply this workaround. * * See issue http://java.net/jira/browse/JERSEY-639 */ So I would expect the latest release to have fixed this issue. So if you're using the Classic SDK, simply use version 1.6.4 as that is the latest and contains the fix (as seen here). For the REST API version of the SDK, the latest version appears to be 0.11.2 which has a dependency on the "latest" version of the CORE SDK, which again I would assume would fix your issue.
has comment: http://stackoverflow.com/comment/42277133
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/26826973
accepted answer of: http://stackoverflow.com/q/26826959
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42221862
type: Answer
answers question: http://stackoverflow.com/q/26826959
has body: All it's trying to say is that the language that follows doesn't apply to the Object class (since Object has no superclasses). It does apply to all classes that you and I can declare.

http://stackoverflow.com/comment/42088429
type: Comment
has text: I made the changes and uploaded in [link](http://codereview.stackexchange.com/questions/68934/does-runlengthencoding-class-provide-abstraction-and-encapsulation) . I did this in different way to not distrub the original design before completing the assignment. It is easy to break this design and restructure after completing the assignment.
comment on: http://stackoverflow.com/a/26731379
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42024909
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26717257
has text: Well, the obvious answer is: it isn't a unidirectional relationship if you need an inverse join. Have you checked out using a bidirectional relation (adding `@ManyToOne` to `Bar`)?

http://stackoverflow.com/a/26746001
has comment: http://stackoverflow.com/comment/42102667
answers question: http://stackoverflow.com/q/26745807
score: 0
has body: I would look into using android studio unless you are married to eclipse It is one line to import this in the build.gradle for the app "compile 'org.jsoup:jsoup:1.8.1'". I am using this to strip html from incoming text into an app.
type: Answer

http://stackoverflow.com/comment/66828483
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/39075289
has text: **barRoot.in** I wonder if it works with **equal** instead of **in**

http://stackoverflow.com/comment/42029766
comment on: http://stackoverflow.com/q/26719106
score: 0
type: Comment
type: QuestionComment
has text: Yeah, that's a string constructing a SPARQL query, but you know what I meant. and yes, i want to get the parent category of an article but i'm getting a lot of parent categories, and i would like to know if it's possible to get better results. Like simply for an article like Pizza get "food" or "dishes". Thanks

http://stackoverflow.com/q/26810468
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42208489
upvote count: 1
has comment: http://stackoverflow.com/comment/42193657
type: Question
tagged with: polygon
has comment: http://stackoverflow.com/comment/42193939
has comment: http://stackoverflow.com/comment/42208875
has body: You are given a simple polygon defined by points in R2. You can move a point by x and y axes by some small ε (e.g. 1e-4). What is the algorithm to move the points to make sure that no two edges of the polygon lie exactly on the same line? "Being on the same line" is usually defined as having a small enough difference between angles of two lines, but for the purpose of this particular problem I only consider segments being on the same line if they have exactly 0 difference in their angles or line equations or however you define them. EDIT: Here's some code. It solves the problem only for axis-parallel edges. package org.tendiwa.geometry; import com.google.common.collect.ImmutableSet; import org.jgrapht.UndirectedGraph; import java.util.ArrayList; import java.util.Comparator; import java.util.Set; public final class SameLineGraphEdgesPerturbations { private static Comparator&lt;Segment2D&gt; HORIZONTAL_COMPARATOR = (a, b) -&gt; { assert a.start.y == a.end.y &amp;&amp; b.start.y == b.end.y; double d = a.start.y - b.start.y; if (d &lt; 0) { return -1; } if (d &gt; 0) { return 1; } return 0; }; private static Comparator&lt;Segment2D&gt; VERTICAL_COMPARATOR = (a, b) -&gt; { assert a.start.x == a.end.x &amp;&amp; b.start.x == b.end.x; double d = a.start.x - b.start.x; if (d &lt; 0) { return -1; } if (d &gt; 0) { return 1; } return 0; }; /** * Checks if some of graph's edges are segments of the same line, and perturbs vertices and edges of this graph * so it contains no such segments. * &lt;p&gt; * This class is designed to work with graphs that represent simple polygons. You can use it with other classes * of graphs, but that probably won't be useful. * * * @param graph * A planar graph to be mutated. */ public static void perturbIfHasSameLineEdges(UndirectedGraph&lt;Point2D, Segment2D&gt; graph, double magnitude) { ArrayList&lt;Segment2D&gt; verticalEdges = new ArrayList&lt;&gt;(graph.edgeSet().size()); ArrayList&lt;Segment2D&gt; horizontalEdges = new ArrayList&lt;&gt;(gr…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42206196
tagged with: floating-point-precision
favorite count: 0
has title: How do you perturb a polygon so no two of its edges lie on the same line?
type: UnansweredQuestion
tagged with: computational-geometry
has comment: http://stackoverflow.com/comment/42208768
has answer: http://stackoverflow.com/a/26818090
has comment: http://stackoverflow.com/comment/42193577
has comment: http://stackoverflow.com/comment/42193705
has comment: http://stackoverflow.com/comment/42193609

http://stackoverflow.com/a/29198429
accepted answer of: http://stackoverflow.com/q/26785815
type: Answer
answers question: http://stackoverflow.com/q/26785815
score: 0
type: AcceptedAnswer
has body: Now i am able to make a fully speech based web browser. I used Jsoup for extracting various elements of any web page. Then with the help of sphinx and freetts i allowed users to interact with browser by using speech commands only.

http://stackoverflow.com/q/26770199
accepted answer: http://stackoverflow.com/a/26770207
has title: Java memory leaks - Cleared upon program termination?
tagged with: memory
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26770207
tagged with: memory-leaks
tagged with: java
upvote count: 1
has body: This seems like a yes or no question, and I would have expected it to be answered somewhere but I certainly can't find it. Memory leaks in java don't happen as often as as say developing in a language like C or C++, but they can happen. Most OS will clear memory allocated upon a program's termination, with exception to certain cases like shared memory. Is this still true for when the JVM exits? If I inadvertently create a memory leak in Java will it be cleared by either the JVM or a Linux or Windows OS?
answer count: 1

http://stackoverflow.com/q/26819957
has answer: http://stackoverflow.com/a/26819976
score: 0
has title: Finding length and angles of a triangle
answer count: 1
has body: My job is to compute the following properties of a given triangle: lengths of all sides, angles at all corners, the perimeter and the area. I have a Triangle class and a Triangle tester class. I THINK I have coded the perimeter and area correctly? But I am beginning to think instead of setting a constant variable side for my perimeter I should be using the lengths of all sides to find my perimeter as well. What I am stuck on is finding the lengths and the angles. For some reason when I run my tester class they all come out as 1.0. Any advice would be appreciated! Thank you! import java.util.Scanner; public class Triangle { Scanner in = new Scanner(System.in); /** * Variables */ double x1; double x2; double x3; double y1; double y2; double y3; double lengthA; double lengthB; double lengthC; double angleA; double angleB; double angleC; double area; double perimeter; double base; double height; double p; /** Constructs x and y coordinates @param x1, x2, x3 to x1, x2, x3 @param y1, y2, y3 to y1, y2, y3 */ public Triangle(double x1, double x2, double x3, double y1, double y2, double y3) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.y1 = y1; this.y2 = y2; this.y3 = y3; } /** *Find lengths of all sides */ public double getLengthA() { lengthA = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2)); return lengthA; } public double getLengthB() { lengthB = Math.sqrt(Math.pow((x3 - x2), 2) + Math.pow((y3 - y2), 2)); return lengthB; } public double getLengthC() { lengthC = Math.sqrt(Math.pow((x1 - x3), 2) + Math.pow((y1 - y3), 2)); return lengthC; } /** * Find angles at all corners @return angles at all corners */ public double getAngleA() { angleA = lengthA + lengthB + lengthC - (lengthB * lengthC); return angleA; } public double getAngleB() { angleB = lengthB + lengthA + lengthC - (lengthA * lengthC); return angleB; } public double getAngleC() { angleC = lengthC + lengthA + lengthB - (lengthA * lengthB); return angleC; } /** * Constant Variables */ public Triangle() {…
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/42113720
has text: In the constructor of your AsyncTask, pass a reference to your Activity and store it in a field. Then you can call a public method of that Activity from `onPostExecute()`, passing the string as a parameter.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26762386
type: Comment

http://stackoverflow.com/q/26801416
type: UnansweredQuestion
has body: I am making an activity program which stores activities. Basically i have an arrayList of activity objects and each of them have titles. I want to parse the title and assosciate each word from that title with that activities key. For example if there are the following activities: 1)Football game 2)Basketball game 3)Ping pong Now i want to parse each of those activities, so that for example for the first activity the word football and the word game will be associated with key 1. So if i perform a search using the word "game", the results will be 1 and 2. I know I can use hash maps and arraylists to implement this but im really not sure how to implement it.
answer count: 0
has title: Java - How to create hashmap which holds muliple values for a singe key?
tagged with: arraylist
linked to: http://stackoverflow.com/q/25917531
type: Question
duplicate of: http://stackoverflow.com/q/25917531
score: 0
has comment: http://stackoverflow.com/comment/42176354
tagged with: collections
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42176359
tagged with: java

http://stackoverflow.com/q/26673670
has title: How receive XML argument from storedProcedudure using spring jdbcTemplate?
upvote count: 5
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/105666433
answer count: 0
downvote count: 0
tagged with: java
tagged with: jdbctemplate
has comment: http://stackoverflow.com/comment/41948417
type: Question
score: 5
has body: I use MS-SQL server for my spring application. I have a store procedure, witch I want to execute from my app. CREATE PROCEDURE dbo.spCheckPerson ( @inXML XML, @outXML XML OUTPUT, @inDebug BIT = 0 ) AS --do sth SET @outXML = ' Piotr ' RETURN 0 I try to execute it by this DAO: import java.sql.SQLException; import java.sql.SQLXML; import java.sql.Types; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SqlOutParameter; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.core.simple.SimpleJdbcCall; import org.springframework.jdbc.support.xml.Jdbc4SqlXmlHandler; public class PersonDAOImpl implements PersonDAO { private JdbcTemplate jdbcTemplate; private SimpleJdbcCall spCheckPerson; public PersonDAOImpl(DataSource dataSource) { jdbcTemplate = new JdbcTemplate(dataSource); } @Override public String checkPersonData(String personData) { Jdbc4SqlXmlHandler sqlXmlHandler = new Jdbc4SqlXmlHandler(); spCheckPerson = new SimpleJdbcCall(jdbcTemplate) .withoutProcedureColumnMetaDataAccess() .withProcedureName("spCheckPerson") .declareParameters(new SqlParameter("inXML", Types.SQLXML)) .declareParameters(new SqlOutParameter("outXML", Types.SQLXML)); Map<String, Object> result = spCheckPerson.execute(sqlXmlHandler.newSqlXmlValue(" Test ")); return ((SQLXML) result.get("outXML")).getString(); } } , but I get error: SEVERE: Servlet.service() for servlet [SpringDispatcher] in context with path [/TestSpringProject] threw exception [Request processing failed; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.] with root cause com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid. at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667) at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1654) at com.microsoft.sqls…
has comment: http://stackoverflow.com/comment/41947809
tagged with: sql-server
favorite count: 0

http://stackoverflow.com/comment/42063462
type: Comment
type: QuestionComment
has text: Or use (VLC player)[http://stackoverflow.com/questions/16962013/play-an-avi-video-file-in-java-swing/16962305#16962305] with VlcJ. It needs the player to be downloaded as well, but then you can do all the VLC can, i.e. connect to streamings.
comment on: http://stackoverflow.com/q/26738259
score: 0

http://stackoverflow.com/q/26722078
type: Question
type: AnsweredQuestion
tagged with: list
has body: ---My node class--- class Node&lt;E&gt; { public E data; public Node&lt;E&gt; next; Node(E data, Node&lt;E&gt; next) { this.data = data; this.next = next; } } ---My mystery method that is affecting my list--- public Node &lt; E &gt; mystery &lt; E extends Comparable &gt; (Node &lt; E &gt; first, E x) { Node &lt; E &gt; p2 = null; Node &lt; E &gt; p1 = first; while (p1 != null &amp;&amp; x.compareTo(p1.data) != 0) { p2 = p1; p1 = p1.next; } if (p1 != null) { if (p1 == first) { first = first.next; } else { p2.next = p1.next; } } return first; } I've tried converting my "mystery" method into "psuedocode" to try and understand it better. But I am still not understanding what it is doing. --My psuedocode-- -----While loop------ While p1 is not null/empty, and while x is not equal to p1 Set p2 equal to p1 and set p1 equal to p1.next ----If Statements------ if p1 is not empty/null and if p1 is equal to the first item in the list then set first to first.next (moving the pointer) if none of the above is able to be ran then set p2.next equal to p1.next and return first. My list looks like this... ptr [ ] --> [10][ ] --> [20][ ] --> [30][ ] --> [40][ ] --> [50][Ø] I need to understand what my mystery method is doing exactly, and be able to see what would happen to the list if something like this was called: ptr = mystery( ptr, 50 ); Any help would be great. I have been stuck on this for some time now... Thank you.
score: 1
tagged with: java
tagged with: methods
tagged with: nodes
upvote count: 1
has comment: http://stackoverflow.com/comment/42034084
answer count: 1
has title: Java Queues/Nodes what is this method doing?
accepted answer: http://stackoverflow.com/a/26722331
favorite count: 0
has answer: http://stackoverflow.com/a/26722331
downvote count: 0
has comment: http://stackoverflow.com/comment/42040821
has comment: http://stackoverflow.com/comment/42034383

http://stackoverflow.com/comment/41974351
has text: When you say "Generate an index file when you pack the JAR", is there a way to do it automatically ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26688501

http://stackoverflow.com/q/26735147
has body: I have a JSP page that displays a list of items, each one accompanied by a form that allows the user to edit the corresponding item's data. The changes made by the user are processed by a servlet. Right now, the JSP page produces invalid HTML, because every input of every form share the same id. I can add some suffix to every id, but then the code at the servlet side that gathers all the parameters is not as simple as calling request.getparameter("constantValue") anymore. I can use request.getParameterNames() and guess which input belongs every id to by its prefix, but I think it looks ugly and it's probably bad code. Am I missing a better solution?
has title: Several forms in a JSP page: how to avoid duplicated ids and tedious parameter processing at the same time?
accepted answer: http://stackoverflow.com/a/26735429
favorite count: 0
upvote count: 1
tagged with: parameters
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26735429
tagged with: servlets
type: Question
downvote count: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/42079951
comment on: http://stackoverflow.com/q/26747470
type: Comment
type: QuestionComment
has text: Did you actually follow the build instructions? It says to run https://github.com/oNaiPs/droid-VNC-server/blob/master/updateExecsAndLibs.sh which adds the library to the folder.
score: 1

http://stackoverflow.com/comment/41956551
type: Comment
has text: I mean it doesnt run at all. It gives me no output . Yes I know thr diffrence but '' long'' should do it.. Shouldnt it?
type: AnswerComment
comment on: http://stackoverflow.com/a/26676230
score: 0

http://stackoverflow.com/comment/41966563
has text: @Radiodef This is new to me, thank you for telling me.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26684015

jms
tags question: http://stackoverflow.com/q/26754601
tags question: http://stackoverflow.com/q/26775976
tag name: jms
tags question: http://stackoverflow.com/q/26773389
type: Tag
tags question: http://stackoverflow.com/q/26715654

http://stackoverflow.com/q/26756068
tagged with: algorithm
tagged with: eclipse-rcp
score: 0
tagged with: user-interface
answer count: 1
has body: I have a method: TraceData.getTraceData(true); This trace method takes very long or freezes if the external interface is not configured properly. So it does not even return a null. It just hangs. In this case I want to implement a pop up dialog box with a button "Cancel" to stop this method. So I created a Job to run this method: final Job job = new Job("Trace Job") { @Override protected IStatus run(IProgressMonitor monitor) { TraceData.getTraceData(true); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { MessageDialog.openInformation(shell, "Your Popup ","Your job has finished."); } }); return Status.OK_STATUS; } }; Then I created a dialog box with a single option to stop the trace. Shell shell2 = new Shell(); final MessageBox dialog = new MessageBox(shell2, SWT.ICON_QUESTION | SWT.CANCEL); dialog.setText("Tracing"); dialog.setMessage("Cancel Tracing ?"); int cancelTrace = dialog.open(); This dialog box should automatically disappear when the if tracing is done. So the main thread should stop at this dialog box and wait for the trace to be finished. Or if the user clicks cancel it will stop the trace. EDIT Thanks to Alexander I came up with following, but it still has a couple of issues. I needed to put false for the fork in dialog.run(), otherwise I a get SWT thread access error like this. Also I used the Display.getDefault().asyncExec() before to update the my UI before, but here it is not being activated. Lastly the cancel button is not working, i.e. it cannot be pressed. But the progress bar is working. ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell()); try { dialog.run(false, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Tracing", 10 ); for(int i = 0; i &lt; 10; i++){ // Check if the user pressed "cancel" or method has finished if(monitor.isCanceled() || finished == true)…
tagged with: multithreading
has title: Eclipse RCP: Stopping a thread/job that freezes
linked to: http://stackoverflow.com/q/23779548
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42095419
tagged with: java
has answer: http://stackoverflow.com/a/26756718
accepted answer: http://stackoverflow.com/a/26756718
type: Question

http://stackoverflow.com/a/26816752
has comment: http://stackoverflow.com/comment/42204505
downvote count: 0
has comment: http://stackoverflow.com/comment/42204389
has comment: http://stackoverflow.com/comment/42204206
has comment: http://stackoverflow.com/comment/42204614
has body: Try running Python interpreter instead: Process p = Runtime.getRuntime().exec("[PATH TO YOUR PYTHON DIR]\\python.exe e:\\dev\\CodeBase\\WebService\\src\\com\\rest\\service\\PythonScript.py"); Usually [PATH TO YOUR PYTHON DIR] is something like C:\\Python27\\ or C:\\Python34 depending on your Python version. If you have Python directory added to your system PATH variable sole .exec("python ...") will suffice.
score: 1
has comment: http://stackoverflow.com/comment/42204302
has comment: http://stackoverflow.com/comment/42204640
has comment: http://stackoverflow.com/comment/42204570
accepted answer of: http://stackoverflow.com/q/26816710
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26816710
upvote count: 1
has comment: http://stackoverflow.com/comment/42204160
type: Answer
has comment: http://stackoverflow.com/comment/42204514

http://stackoverflow.com/q/26751480
type: Question
has comment: http://stackoverflow.com/comment/42086676
has comment: http://stackoverflow.com/comment/42086729
has comment: http://stackoverflow.com/comment/42086621
tagged with: arraylist
score: 0
has title: Concatenating consecutive strings in an Array List
answer count: 1
has body: I am trying to do the following. I have an ArrayList of Strings and I want to concatenate consecutive elements such that pairs get concatenated and get stred in a new array list. Here is my code ArrayList&lt;String&gt; list=new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; list3=new ArrayList&lt;String&gt;(); list.add("0100"); list.add("0110"); list.add("0101"); list.add("0101"); for(int in=0,x=0; in&lt;list.size()-1 &amp;&amp; x&lt;list.size()/2; in+=2,x++) { list3.add(x, list.get(in)+list.get(in+1)); } System.out.println(list3); My question is this won't produce a string which I desire. For instance, I expect 2 strings here each with 8 bits. But this concatenation gives me a string which is longer than 8. Note that this is a dummy values here.In actual,I am reading values from a file and using those values to concatenate. Want guidance on why this code won't work as desired. Thanks in advance
has comment: http://stackoverflow.com/comment/42087020
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42086543
has answer: http://stackoverflow.com/a/26751566
tagged with: java

undertow
type: Tag
tag name: undertow
tags question: http://stackoverflow.com/q/26733899

http://stackoverflow.com/comment/42183613
has text: why not return the `PrinterWriter` instead of using it as a parameter?
comment on: http://stackoverflow.com/q/26805166
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41998190
type: Comment
has text: Try to restart the netbeans.
comment on: http://stackoverflow.com/q/26702199
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42087587
type: AnswerComment
has text: This is only a snippet, I didn't include the class declaration, but I assumed that the OP is running a traditional Spring integration test. Thanks for the link, but the setup used is different. I'll try to test this, I'm interested to see the results.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26742982

http://stackoverflow.com/comment/42192564
type: Comment
has text: That works too, however you need to manipulate the offset before you read back!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26809874

http://stackoverflow.com/comment/42208242
has text: How many spaces did you use for the indentation ? My guess is about 45. Just by looking at your error I can say you are missing a closing curly bracket or something like that.
type: Comment
comment on: http://stackoverflow.com/q/26819261
type: QuestionComment
score: 2

http://stackoverflow.com/q/26712231
favorite count: 0
has body: I have a question. In my method public void selectUser(String name, String surname) I try to log user. How I can prepare an sql statment like this one: String sql = "select * from user where surname= (here my surname from method parameter) and name= (name from method parameter) ";
score: -1
type: UnansweredQuestion
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26712270
has answer: http://stackoverflow.com/a/26712515
tagged with: java
tagged with: mysql
has title: Java Select from database with where condition
answer count: 2
upvote count: 0

http://stackoverflow.com/a/26797152
type: Answer
score: 71
downvote count: 0
has comment: http://stackoverflow.com/comment/71631836
has comment: http://stackoverflow.com/comment/125200172
accepted answer of: http://stackoverflow.com/q/26794334
answers question: http://stackoverflow.com/q/26794334
has body: It looks like you don't have Thymeleaf on your class path. Add this dependency: org.springframework.boot spring-boot-starter-thymeleaf and everything should work then. If you're still facing some issues I recommend creating new project with http://start.spring.io/
upvote count: 71
has comment: http://stackoverflow.com/comment/55162513
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/94732626
has comment: http://stackoverflow.com/comment/42176877
has comment: http://stackoverflow.com/comment/136299981

http://stackoverflow.com/a/26703739
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26703604
has body: int k=12; k/=--k; //i.e. k=k/--k; i.e. k=12/11; i.e k=1 System.out.println(k); k*=k++; /*i.e. k=k*k++; i.e. k=1*1; and after this statement value of k is still 1, inspite of k++, since postfix version increase k by 1 after evaluation of k*k++, but just after that 1 is assigned to k overwriting its previous value. */ System.out.println(k); k*=++k; //i.e. k=k*(++k); i.e. k=1*2; System.out.println(k);
downvote count: 0

dto
tags question: http://stackoverflow.com/q/26754446
tag name: dto
type: Tag

http://stackoverflow.com/q/26794699
has comment: http://stackoverflow.com/comment/42163978
score: 0
has body: I kept a counter in my Javascript, when the counter reaches 0, it will trigger the following AJAX call: function logout2() { $.ajax({ type: "GET", dataType: "json", url: "app/logout", timeout: 20000, success: function() { ; }, error : function(xhr, textStatus, errorThrown) { ajaxErrorHandler(xhr, textStatus, errorThrown); } }) } As you will see, it will log out from the server side officially, however, the page will remain unchanged, which means the page remains unchanged, it will NOT automatically be redirected to login page. Only when the user does something specific(like click on a button on this page) will trigger a pop-up saying "session timeout" and redirect the user to the login page. However, now I am requested to enhance this a little bit, after the AJAX function above has been called, not only user actions like clicking a button will trigger the redirect but also when user refresh the page it will do the same. I tried a little but really have no gain. Currently after page expires, if I refresh, it will not pop-up session-time out dialog, nor it will redirect to the desired page. Is there anything I can do at JavaScript or Ajax level to achieve after user refresh, I will be able to also pop up that dialogue then redirect?
possible better answer: http://stackoverflow.com/a/26794758
type: AnsweredQuestion
tagged with: session
tagged with: java
type: Question
answer count: 2
has title: Is there a way to make Javascript redirect the page after cliking refresh( the session already expired)
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/26794729
has answer: http://stackoverflow.com/a/26794758
accepted answer: http://stackoverflow.com/a/26794729
tagged with: ajax

http://stackoverflow.com/q/26819240
favorite count: 0
has comment: http://stackoverflow.com/comment/46594212
type: UnansweredQuestion
has body: Why is my java stack not following the principle of LIFO while printing? import java.util.*; class StackTrace { public static void main(String []ar) { Stack myStack = new Stack(); myStack.push(1); myStack.push(2); myStack.push(3); myStack.push(4); System.out.println(myStack); Object Arr[]=myStack.toArray(); for(Object a:Arr) System.out.println(a); } } Output : [1, 2, 3, 4] 1 2 3 4 In the above code, the statement System.out.println(myStack); is printing data sequentially rather than last in first out manner. Why so? And also how is the toArray() method working in the above program?
has answer: http://stackoverflow.com/a/29185269
score: 1
tagged with: stack
has answer: http://stackoverflow.com/a/28246610
tagged with: java
upvote count: 1
type: Question
has title: Java stack not following LIFO
has answer: http://stackoverflow.com/a/26819417
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42208216
answer count: 3
tagged with: functional-programming
has comment: http://stackoverflow.com/comment/42208369
downvote count: 0
linked to: http://stackoverflow.com/q/1386275

http://stackoverflow.com/comment/42137237
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26779610
score: 0
has text: So , can I consider that if I use spring mvc, this context loaded is not needed ?

http://stackoverflow.com/q/26795007
score: 0
has body: Java OpenGL I followed the Video on how to setup the jogl to Eclipse. I copied its code and when I compiled, I always got this error. * *Exception in thread "main" java.lang.NoSuchMethodError: javax.media.opengl.GLDrawableFactory.initSingleton()V at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1713) at javax.media.opengl.GLProfile.access$000(GLProfile.java:77) at javax.media.opengl.GLProfile$1.run(GLProfile.java:201) at java.security.AccessController.doPrivileged(Native Method) at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:187) at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:2246) at javax.media.opengl.GLProfile.get(GLProfile.java:959) at javax.media.opengl.GLProfile.getDefault(GLProfile.java:693) at javax.media.opengl.GLProfile.getDefault(GLProfile.java:704) at GL_TestProj.main(GL_TestProj.java:15) ** and here is the Code i Copied. : import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; public class GL_TestProj implements GLEventListener { public static void main(String args[]) { GLProfile glp = GLProfile.getDefault(); GLCapabilities caps = new GLCapabilities(glp); GLCanvas canvas = new GLCanvas(caps); Frame frame = new Frame(); frame.setSize(500, 500); frame.add(canvas); frame.setVisible(true); canvas.addGLEventListener(new GL_TestProj()); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } @Override public void display(GLAutoDrawable arg0) { update(); render(arg0); } private void render(GLAutoDrawable arg0) { // TODO Auto-generated method stub GL2 gl = arg0.getGL().getGL2(); gl.glBegin(GL.GL_TRIANGLES); gl.glColor3f(1, 0, 0); gl.glVertex2f(-1, -1)…
answer count: 1
tagged with: jogl
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26808593
tagged with: opengl
tagged with: java
tagged with: eclipse
type: Question
has title: Setting Up JOGL to Eclipse, after that I always got this error

http://stackoverflow.com/comment/42100690
type: Comment
comment on: http://stackoverflow.com/a/26759443
type: AnswerComment
score: 0
has text: I added but i have other errors. Edited in first post

http://stackoverflow.com/q/26745016
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26745233
has body: OK so here's the deal. I'm developing apk and I'd like to add database (atm at .txt) so my question is: How should I add it to my apk, just load it all to table or there is any better way to do it? And after that I'd like to click on button and be able to start writing item from base and phone would help out. For example I've got in database chicken breast, chicken leggs, eggs and when I write "br" my apk shows most accurate position. ps. my database got about 3k positions.
upvote count: 1
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/42076642
downvote count: 3
tagged with: android
tagged with: apk
has comment: http://stackoverflow.com/comment/42075536
has comment: http://stackoverflow.com/comment/42077789
tagged with: android-studio
has title: Android: Adding database to apk
accepted answer: http://stackoverflow.com/a/26745233
type: AnsweredQuestion
tagged with: java
tagged with: database

http://stackoverflow.com/comment/42109170
type: Comment
has text: What I want to do is if my arraylist contains a binary string "00",I want to represent 4 bits for the number.So "00" will become "0000".Similarly,if it contains "0" it should have 3 zeroes appended to the front.In short, all my strings should come out having a length of 4.Hope this helps
comment on: http://stackoverflow.com/q/26763985
score: 0
type: QuestionComment

http://stackoverflow.com/q/26748162
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42095838
has title: Jvm heap being blown by multiple regression algorithm
tagged with: matrix
has body: I am writing a Multiple Regression (similar to linear systems) algorithm for image processing. Considering that my images generate data matrices of `height*width, I can end up with really big structures. The Multiple Regression algorithm is: x = inv(A'*A)*A'*b Where X is an array of coeficients, A is a matrix and B is a vector. My implementation for this is: public RealVector multipleRegression(double[][] coordinates, double[] data){ RealMatrix m1 = new Array2DRowRealMatrix(coordinates); RealVector v1 = new ArrayRealVector(data); // A = (m1'*m1) RealMatrix A = m1.multiply(m1.transpose()); // B = A^-1 -&gt; Matrix inversion RealMatrix B = new Array2DRowRealMatrix(); B = A.power(-1); // C = A*B -&gt; inv(A'*A)*A RealMatrix C = new Array2DRowRealMatrix(); C = A.multiply(B); // result = C*b -&gt; result holds my coeficients RealVector result = new ArrayRealVector(); DecompositionSolver solver = new LUDecomposition(C).getSolver(); result = solver.solve(v1); return result; } I have tried erasing everything but RealMatrix A = m1.multiply(m1.transpose()); but that didn't work either. Given that, I tried doing the transpose operation before the multiply operation and the heap was blown as well. I tried alocating 14GB of ram for my JVM but that wasn't enough. Any suggestions?
has comment: http://stackoverflow.com/comment/42081788
tagged with: jvm
tagged with: heap-memory
type: Question
has comment: http://stackoverflow.com/comment/42095185
has comment: http://stackoverflow.com/comment/42081287
has comment: http://stackoverflow.com/comment/42080931
score: 0
tagged with: java
tagged with: algorithm

http://stackoverflow.com/q/26792510
has title: java.lang.UnsupportedOperationException: Unsupported Service: accessibility android studio
tagged with: android
has comment: http://stackoverflow.com/comment/42160482
has answer: http://stackoverflow.com/a/27543463
has comment: http://stackoverflow.com/comment/42160472
has comment: http://stackoverflow.com/comment/42160499
tagged with: android-studio
answer count: 5
possible better answer: http://stackoverflow.com/a/27543463
score: 16
accepted answer: http://stackoverflow.com/a/29555011
upvote count: 16
type: AnsweredQuestion
tagged with: java
tagged with: material-design
has body: I have ran into a problem with this UnsupportedOperationException. I have recently switched to android studio, so it is quite new for me. I wanted to add the recyclerview into my project, and do stuff with it, but the layout designer throws me this error: java.lang.UnsupportedOperationException: Unsupported Service: accessibility at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:465) at android.support.v7.widget.RecyclerView.&lt;init&gt;(RecyclerView.java:290) at android.support.v7.widget.RecyclerView.&lt;init&gt;(RecyclerView.java:266) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:379) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99) at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:401) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:333) at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:674)…
type: Question
has answer: http://stackoverflow.com/a/36304312
has answer: http://stackoverflow.com/a/28083043
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29555011
has answer: http://stackoverflow.com/a/35969615
has comment: http://stackoverflow.com/comment/42160458

http://stackoverflow.com/a/26774541
has body: You're thinking imperatively rather than functionally. If you wanted to apply a function to each element in an array within Scala, then the idiomatic way of doing it is to utilise the map function, so that you have something like: val elements = Array(1,2,3,4,5) val results = elements map { x =&gt; x+4} If you need to utilise the index of each element in your function call, then transform the array into an array (or sequence) of pairs using zip with index like this: scala&gt; elements.zipWithIndex res0: Array[(Int, Int)] = Array((1,0), (2,1), (3,2), (4,3), (5,4), (6,5)) Then you can apply a map again, this time applying a function which takes a pair rather than a single element: scala&gt; elements.zipWithIndex map { case (x,y) =&gt; (x, y*5) } res2: Array[(Int, Int)] = Array((1,0), (2,5), (3,10), (4,15), (5,20), (6,25)) or scala&gt; elements.zipWithIndex map { case (x, y) =&gt; x*y } res3: Array[Int] = Array(0, 2, 6, 12, 20, 30) If you want to apply a different function per index, then just supply a different definition within the map closure: scala&gt; elements.zipWithIndex map { case (0, y) =&gt; y + 45 | case (1, y) =&gt; y + 5 | case (_, y) =&gt; y | }
has comment: http://stackoverflow.com/comment/42129607
answers question: http://stackoverflow.com/q/26774012
has comment: http://stackoverflow.com/comment/42128247
has comment: http://stackoverflow.com/comment/42129339
has comment: http://stackoverflow.com/comment/42128314
score: 0
type: Answer

http://stackoverflow.com/comment/41974169
type: Comment
has text: Ok, and how to do instance1 everytime looking on moving instance2?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26684045

http://stackoverflow.com/comment/42016883
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26712116
has text: @SteenDanielHunter sorry it is vice versa . check to my updated answer and let me know for your question
type: Comment

http://stackoverflow.com/comment/42178455
score: 0
comment on: http://stackoverflow.com/q/26802423
type: Comment
type: QuestionComment
has text: @MarianneVossSiljan: There's no such method as `taxCalculator`. There's a *class* called `TaxCalculator`, but that's not the same thing at all.

http://stackoverflow.com/comment/42178510
has text: I think @M. Deinum should add the right answer so the author can mark it as responded. It's so much better than finding a solution in a comment.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26800170
score: 0

http://stackoverflow.com/a/26736941
has comment: http://stackoverflow.com/comment/42061209
accepted answer of: http://stackoverflow.com/q/26736503
has comment: http://stackoverflow.com/comment/42100023
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42100632
has comment: http://stackoverflow.com/comment/42061297
has comment: http://stackoverflow.com/comment/42094585
type: Answer
has body: As Emil already mentioned, nested forms are a really bad thing which you should get rid of immediately. Also, as Emil suggested, that kind of error message is usually related to incorrect component-selectors. Those are mainly caused due to the fact that a parent naming container is missing in the selector. Either determine the correct id using some debugging tool or, instead of &lt;p:ajax listener="#{javaHTMLConnection.onAdd()}" update=":dialog:list" /&gt; try using some of the solutions suggested in this thread: Primefaces - Cannot find component with identifier outside the datatable I personally prefer to use the following syntax, which relies on a primefaces-method searching for an id in various naming containers: &lt;p:ajax listener="#{javaHTMLConnection.onAdd()}" update=":#{p:component('list')}" /&gt;
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/42060911
answers question: http://stackoverflow.com/q/26736503

http://stackoverflow.com/comment/41965283
type: AnswerComment
has text: @DavidConrad +1 Oops. Added `try-with-resources`.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26683233

http://stackoverflow.com/comment/41975991
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26686023
has text: @xxgiuzeppexx you can call settext from any where but the text field should in the scope .

http://stackoverflow.com/comment/42099093
comment on: http://stackoverflow.com/a/26754702
score: 0
type: Comment
has text: thanks anyway for the time you spare for me. The adrian's code is simple, yet it do a job lot faster.
type: AnswerComment

http://stackoverflow.com/q/26790136
tagged with: url
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42158249
has title: Filtering URL content in a self written proxy using Java
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: filtering
downvote count: 0
has body: I need to code some proxy server for an assignment in my university. It should be able to display the content of some simple web page given by our professor. Additionally it should filter the URL and the URL content, and block the web page if one of these contain one of the words in my "bad" array. My question is, how can I perform this filtering in Java. Code: import java.io.*; import java.net.ServerSocket; import java.net.Socket; import java.util.Scanner; public class ProxyServer{ //Crate the Port the user wants the proxy to be on static Scanner sc = new Scanner(System.in); public static final int portNumber = sc.nextInt(); public static void main(String[] args) { ProxyServer proxyServer = new ProxyServer(); proxyServer.start(); } public void start() { System.out.println("Starting the SimpleProxyServer ..."); try { String bad[]= new String[4]; bad[0]= "Spongebob"; bad[1]= "Britney Spears"; bad[2]= "Norrköping"; bad[3]= "Paris Hilton"; ServerSocket serverSocket = new ServerSocket(ProxyServer.portNumber); System.out.println(serverSocket); byte[] buffer= new byte [1000000] ; while (true) { Socket clientSocket = serverSocket.accept(); InputStream inputstream = clientSocket.getInputStream(); System.out.println(" DAS PASSIERT VOR DEM BROWSER REQUEST:"); int n = inputstream.read(buffer); String browserRequest = new String(buffer,0,n); System.out.println("Das ist der Browserrequest: "+browserRequest); System.out.println("Das ist der Erste Abschnitt"); int start = browserRequest.indexOf("Host: ") + 6; int end = browserRequest.indexOf('\n', start); String host = browserRequest.substring(start, end - 1); System.out.println("Connecting to host " + host); Socket hostSocket = new Socket(host, 80); //I can change the host over here OutputStream HostOutputStream = hostSocket.getOutputStream(); PrintWriter writer= new PrintWriter (HostOutputStream); BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); String Input= null; while (((Input= reader.readLine()…
tagged with: proxy
has comment: http://stackoverflow.com/comment/42159309

http://stackoverflow.com/a/27203362
type: Answer
has body: you can refer developerwork article to get started to use Bluemix services for your andriod app.
answers question: http://stackoverflow.com/q/26707097
score: 0

http://stackoverflow.com/comment/42186764
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26806575
has text: The second suppresses the warnings about not using generics.

http://stackoverflow.com/a/31039130
score: 1
has body: Try linking libjvm.dylib to /usr/lib: sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/lib -f flag is added to force overwriting existing file/link
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26745364
downvote count: 0

http://stackoverflow.com/q/26682588
type: UnansweredQuestion
tagged with: maven
type: Question
tagged with: jakarta-ee
tagged with: java
has body: I'm trying to connect to server-side via web-socket but connection is not being established. I use maven to build a project and launching with mvn compile tomcat:run Tomcat logs folder into the project is empty. JavaScript var wsUri = "ws://localhost:8080/checkers/"; var output; function init() { output = document.getElementById("messages"); testWebSocket(); } function testWebSocket() { websocket = new WebSocket(wsUri); websocket.onopen = function(evt) { onOpen(evt); }; websocket.onclose = function(evt) { onClose(evt); }; websocket.onmessage = function(evt) { onMessage(evt); }; websocket.onerror = function(evt) { onError(evt); }; } function onOpen(evt) { writeToScreen("CONNECTED"); doSend("WebSocket rocks"); } function onClose(evt) { writeToScreen("DISCONNECTED"); } function onMessage(evt) { writeToScreen('RESPONSE: ' + evt.data+''); websocket.close(); } function onError(evt) { writeToScreen('ERROR: ' + evt.data); } function doSend(message) { writeToScreen("SENT: " + message); websocket.send(message); } function writeToScreen(message) { var pre = document.createElement("p"); pre.style.wordWrap = "break-word"; pre.innerHTML = message; output.appendChild(pre); } ServerSide @ServerEndpoint("/checkers") public class CheckersApp { static Logger logger = Logger.getLogger(ChekersApp.class); @OnOpen public void onOpen() { System.out.println("Welcome", new Date); logger.log("Welcome", new Date); session.getBasicRemote().sendText("Hello websockets"); } } There is "ERROR: undefined" on the page. How can I solve the problem?
tagged with: websocket
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/41963811
has comment: http://stackoverflow.com/comment/41964829
answer count: 0
has title: Can't launch server-side of maven web application with websockets

http://stackoverflow.com/a/26798418
type: Answer
has body: Calls to System.exit() can be intercepted by a Java Agent. The following article discusses using a Java Agent to rewrite byte codes on load to insert logging statements. The same approach could be used to remove calls to System.exit.
answers question: http://stackoverflow.com/q/26798131
score: 0

http://stackoverflow.com/a/26777153
has comment: http://stackoverflow.com/comment/42133048
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42133194
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26776904
has comment: http://stackoverflow.com/comment/42166105
has comment: http://stackoverflow.com/comment/42132680
has body: Transactions are the way to go when it comes to concurrent sql updates, in spring you can use a transaction manager. As for the database structure, as far as I know MySql does not support transactions for DDL commands, that is if you change the structure concurrently with updating, you're likely to run into problems. To handle multiple users working on the same data, you need to implement a manual "lock" or "version" field on the table to keep track of last updates.
accepted answer of: http://stackoverflow.com/q/26776904
has comment: http://stackoverflow.com/comment/42133779

http://stackoverflow.com/comment/41985172
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26694772
has text: sounds like you would benefit from the same tool I'm looking for. The closest I've seen is IntelliJ but we are not allowed to use it over Eclipse.
score: 0

http://stackoverflow.com/q/26783613
favorite count: 0
has comment: http://stackoverflow.com/comment/42287222
has title: TestNG iterate over test data instead of test methods
has answer: http://stackoverflow.com/a/26786692
has body: When using DataProvider with multiple TestNG methods, every method is run with all data sets in sequence. Instead I want to iterate over the data sets and execute all methods on each iteration. I do not care if the results show every single test method result or a summary of the runs per method. I already tried the option order-by-instances="true" in a suite.xml with no success. Sample code: public class TestNGTest { @DataProvider(name = "dp") public Object[][] createData(Method m) { return new Object[][] { new Object[] { "Cedric" }, new Object[] {"Martina"}}; } @Test(dataProvider = "dp") public void test1(String s) throws InterruptedException { System.out.println("test1 " + s); Thread.sleep(1000); } @Test(dataProvider = "dp") public void test2(String s) throws InterruptedException { System.out.println("test2 " + s); Thread.sleep(1000); } } Actual result: test1 Cedric test1 Martina test2 Cedric test2 Martina PASSED: test1("Cedric") PASSED: test1("Martina") PASSED: test2("Cedric") PASSED: test2("Martina") Wanted result: test1 Cedric test2 Cedric test1 Martina test2 Martina PASSED: test1("Cedric") PASSED: test2("Cedric") PASSED: test1("Martina") PASSED: test2("Martina")
tagged with: testng
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26786692
accepted answer: http://stackoverflow.com/a/26800125
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/42287785
upvote count: 5
answer count: 2
has comment: http://stackoverflow.com/comment/42287072
has answer: http://stackoverflow.com/a/26800125
downvote count: 0
has comment: http://stackoverflow.com/comment/42286979
has comment: http://stackoverflow.com/comment/42287843

http://stackoverflow.com/comment/42182967
type: Comment
has text: Thanks for the input, but the button I'm dealing with is an iText PushbuttonField object.
comment on: http://stackoverflow.com/a/26804620
score: 0
type: AnswerComment

http://stackoverflow.com/q/26793418
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29079600
tagged with: spring-mvc
tagged with: java
has body: I am somewhat new to Google Cloud Messaging. We have been working with it for a couple of months but just recently we have been getting "Connection Draining" messages. When this happens all communication stops. Google says: https://developer.android.com/google/gcm/ccs.html#response When you receive a CONNECTION_DRAINING message, you should immediately begin sending messages to another CCS connection, opening a new connection if necessary. You should, however, keep the original connection open and continue receiving messages that may come over the connection (and ACKing them)—CCS will handle initiating a connection close when it is ready. My question is If I open a new connection manually, how does it know what connection to use if I don't close the existing connection? If 6 messages are sent concurrently how do I stop the method from opening 6 connections? Or am I confused on this? Why does connection draining happen? I am surprised this isn't already put into play in their example code. It seems like its pretty much everything you need. Is it already done for me in the code and I am missing it? I don't have a main method in my code, I user servlets as triggers instead. My connection is initailized like this @PostConstruct public void init() throws Exception{ try { smackCcsClient.connect(Long.parseLong(env.getProperty("gcm.api")), env.getProperty("gcm.key")); }catch (IOException e ){ e.printStackTrace(); }catch(SmackException e){ e.printStackTrace(); }catch(XMPPException e){ e.printStackTrace(); } } however after this I never touch the connection again. Am I handling this wrong, is the connection something I should be touching more frequently or something I need to keep track of? _______________________ADDED AFTER THE QUESTION_________________________ I added a connection inside of their example code to try to reinitialize a connection. It looks like this: if ("CONNECTION_DRAINING".equals(controlType)) { connectionDraining = true; //Open new connection because old c…
type: Question
has answer: http://stackoverflow.com/a/26862959
has title: Opening new connection after Connection Draining. Google Cloud Messaging
downvote count: 0
has answer: http://stackoverflow.com/a/48156418
answer count: 3
tagged with: google-cloud-messaging

http://stackoverflow.com/comment/41947779
has text: I've edited the question, please see again. I've explained wrong
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26673873

http://stackoverflow.com/a/26742926
has body: To take advantage of the fact that negative number multiplied to a negative number gives a positive number we can use your current solution. So as an example: e = 2 gives you 4 and e = -2 also gives you 4. Thus we can make a minor adjustment to your function: for(e = 10; e &gt;= -10; e -= 2) System.out.print(e * e + " "); System.out.println(); That should give 100 64 36 16 8 4 0 4 8 16 36 64 100.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26742867
has comment: http://stackoverflow.com/comment/42072073
upvote count: 2
downvote count: 1

http://stackoverflow.com/q/26723900
tagged with: android-layout
has body: In my android studio application my layout and design looks good and everything like i want it to when the device is being held vertically/portrait and I want it to stay like that when the app is being held horizontal/landscape so it stays as facing vertically. So how do I prevent the app from turning horizontal/landscape when the user turns the device horizontally so the layout is constantly facing vertically/portrait.
accepted answer: http://stackoverflow.com/a/26723957
has comment: http://stackoverflow.com/comment/42037462
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
tagged with: android
has title: How do i prevent my android layout from turning horizontal/landscape when the device is being held horizontally
score: -1
has answer: http://stackoverflow.com/a/26723957
tagged with: java
has comment: http://stackoverflow.com/comment/42039557
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/42279117
comment on: http://stackoverflow.com/a/26809201
score: 1
type: AnswerComment
type: Comment
has text: Ok, please remove "localhost" parameter from both files, local and remote. Also, in the local and remote configs set IP in the discover SPI to "10.244.10.95". With this configuration, you need to start remote host first.

http://stackoverflow.com/comment/42034369
comment on: http://stackoverflow.com/q/26698266
has text: If you don't want to use JJT, the next best thing may be to use the builder pattern.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26673316
has comment: http://stackoverflow.com/comment/41946662
tagged with: java
has answer: http://stackoverflow.com/a/26674722
tagged with: hashmap
answer count: 5
has comment: http://stackoverflow.com/comment/41947021
score: 2
tagged with: matrix
type: AnsweredQuestion
has body: I need a data structure that I could store my information in a two dimensional way. For example imagine a table that contains user-item ratings. I need to store all ratings for all users. let's say, user u1. I need to store ratings for user u1 and u2 and u3 and all other users. But the problem is I also need too store all ratings for all items. For example I need to store ratings provided by all users for each item. So I need something like a map that for users the key is the user ID and the value is the set of ratings. I can do that easily. But my problem is how I can also store ratings for Items. for example a map that the key is the item ID and the value is the set of ratings provided be users for that Item. I wanted to upload a table but since I didn't have enough reputation I couldn't do that.So just imagine a table like a two dimensional matrix that rows are users and columns are items. Is there a data structure that can do that? Or I should build two different maps? maybe there is a better option than Map but Since I had to choose a title for my question I wrote map. Thanks
has comment: http://stackoverflow.com/comment/41947176
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26674048
has answer: http://stackoverflow.com/a/26673930
has title: Two-dimensional Map Java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26676211
has comment: http://stackoverflow.com/comment/41946615
accepted answer: http://stackoverflow.com/a/26674048
possible better answer: http://stackoverflow.com/a/26676211
has answer: http://stackoverflow.com/a/26673632

http://stackoverflow.com/comment/42095889
comment on: http://stackoverflow.com/a/26757012
has text: "sharing data between threads is never safe without volatile" No! How about a sync block?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26708914
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26708801
answers question: http://stackoverflow.com/q/26708801
has body: Try this way,hope this will help you to solve your problem. Pass your activity context to DownloadPicture class in constructor and initialize ProgressDialogs in onPreExecute() : public class ProgressDialogs extends AsyncTask&lt;Void,Void,Void&gt;{ private Context context; private ProgressDialog progressDialog; public ProgressDialogs(Context context){ this.context=context; } @Override protected void onPreExecute() { super.onPreExecute(); progressDialog = ProgressDialog.show(context, "dialog title","dialog message", true); } @Override protected Void doInBackground(Void... params) { // do you background code here return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if(progressDialog!=null &amp;&amp; progressDialog.isShowing()){ progressDialog.dismiss(); } } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42162315
type: Comment
comment on: http://stackoverflow.com/a/26793635
has text: In that case, you could just iterate through the file x+1 times. The first time to find out what the max length is, which you then use to determine how many times to go through the file. for(int i = 0; i < x; i++) if(name.length() == i) fileOut.println(name);
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41983702
comment on: http://stackoverflow.com/q/26694081
type: Comment
type: QuestionComment
has text: @JBNizet That's not good, it's limiting.
score: 0

http://stackoverflow.com/a/47892008
score: 1
answers question: http://stackoverflow.com/q/26734907
upvote count: 1
type: Answer
has body: If you are not afraid of using online service then EPUB to PDF Rest API could be used. The actual JAVA code will look like public class Main { public static void main(String[] args) throws IOException { TreeMap params = new TreeMap&lt;&gt;(String.CASE_INSENSITIVE_ORDER); params.put("File", "C:\path\to\test-epub.epub"); params.put("Secret", "&lt;secret&gt;"); CloseableHttpResponse response = ConvertApi.convert("epub", "pdf", params); System.out.println(EntityUtils.toString(response.getEntity(), "UTF-8")); } } class ConvertApi { public static CloseableHttpResponse convert(String srcFormat, String dstFormat, TreeMap params) throws IOException { MultipartEntityBuilder builder = MultipartEntityBuilder.create(); params.forEach((k, v) -&gt; { if(Files.exists(Paths.get(v))) { builder.addBinaryBody(k, new File(v)); } else { builder.addTextBody(k, v, ContentType.TEXT_PLAIN); } }); String authParam = params.get("secret") == null ? String.format("Token=%s", params.get("token")) : String.format("Secret=%s", params.get("secret")); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(String.format("https://v2.convertapi.com/%s/to/%s?%s", srcFormat, dstFormat, authParam)); httpPost.setEntity(builder.build()); return httpClient.execute(httpPost); } }
downvote count: 0

http://stackoverflow.com/a/26745529
has comment: http://stackoverflow.com/comment/85815008
accepted answer of: http://stackoverflow.com/q/26743773
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26743773
downvote count: 0
has body: I worked around the issue, I don't understand what the root cause was but by using the org.apache.commons.compress library the zip file is now usable. I'll dig into it again tomorrow because I'm curious to know what the difference is. Meanwhile, here's the updated class. package com.mycompany.utils; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.log4j.Logger; public class FileZipper { private static final Logger LOGGER = Logger.getLogger(OldFileZipper.class); private String destinationZipFile; private String sourceDirectory; List&lt;String&gt; fileList; private File zipFile; public File getZipFile() { return zipFile; } /** * Zips a source directory into the destination zip file * * @param source * @param destination */ FileZipper(String source, String destination) { LOGGER.info("Zipping source directory: "+source); LOGGER.info("To destination zip file: "+destination); this.destinationZipFile = destination; this.sourceDirectory = source; fileList = new ArrayList&lt;String&gt;(); generateFileList(new File(sourceDirectory)); compressDirectoryContentsToZip(sourceDirectory, destinationZipFile); } /** * Traverse a directory and get all files, and add the file into fileList * * @param node * file or directory */ public void generateFileList(File node) { // add file only if (node.isFile()) { fileList.add(generateZipEntry(node.getAbsoluteFile().toString())); } if (node.isDirectory()) { if(node.toString() != sourceDirectory) { fileList.add(generateZipEntry(node.getAbsoluteFile().toString())); } String[] subNodes = node.list(); for (String filename : subNodes) { generateFileList(new File(node, filename)); } } } /** * Compress a directory to a zip file * @param sourceDire…
type: Answer
has comment: http://stackoverflow.com/comment/85814918
score: 2
upvote count: 2

http://stackoverflow.com/a/26727846
score: 3
downvote count: 1
upvote count: 4
has body: The error means what it says. The documentation for orElseThrow states that it takes a Supplier as a parameter. You have stated your exception is a RuntimeException, which is not a Supplier. Therefore, orElseThrow() is not applicable to that argument type. You would have to pass it a Supplier, not a RuntimeException. It would be simpler syntax to use a lambda expression.
answers question: http://stackoverflow.com/q/26727812
type: Answer

resin
type: Tag
tag name: resin
tags question: http://stackoverflow.com/q/26717662

http://stackoverflow.com/q/26801109
tagged with: jvm-hotspot
has comment: http://stackoverflow.com/comment/42176077
has comment: http://stackoverflow.com/comment/42179188
answer count: 1
has comment: http://stackoverflow.com/comment/42176882
tagged with: jvm
score: 0
has body: We are developing a java application that runs on tomcat. This scenario is not reproducible but for the customer, the application crashes with a jvm crash # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077a60895, pid=3644, tid=3792 # # JRE version: 6.0_30-b20 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.5-b03 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [ntdll.dll+0x50895] # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) v blob 0x0000000003d6707f j java.lang.String.equals(Ljava/lang/Object;)Z+8 j javax.management.MBeanAttributeInfo.&lt;clinit&gt;()V+25 v ~StubRoutines::call_stub j com.sun.jmx.mbeanserver.MBeanServerDelegateImpl.&lt;clinit&gt;()V+51 v ~StubRoutines::call_stub j com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServerDelegate()Ljavax/management/MBeanServerDelegate;+0 j javax.management.MBeanServerBuilder.newMBeanServerDelegate()Ljavax/management/MBeanServerDelegate;+0 j javax.management.MBeanServerFactory.newMBeanServer(Ljava/lang/String;)Ljavax/management/MBeanServer;+14 j javax.management.MBeanServerFactory.createMBeanServer(Ljava/lang/String;)Ljavax/management/MBeanServer;+6 j javax.management.MBeanServerFactory.createMBeanServer()Ljavax/management/MBeanServer;+1 j org.apache.catalina.startup.Bootstrap.createClassLoader(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader;+549 j org.apache.catalina.startup.Bootstrap.initClassLoaders()V+5 j org.apache.catalina.startup.Bootstrap.init()V+9 j org.apache.catalina.startup.Bootstrap.main([Ljava/lang/String;)V+52 v ~StubRoutines::call_stub j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object…
has answer: http://stackoverflow.com/a/27364315
has comment: http://stackoverflow.com/comment/42175802
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11275814
tagged with: java
has comment: http://stackoverflow.com/comment/42179212
has title: JVM crash stacktrace
type: Question
tagged with: jvm-crash

http://stackoverflow.com/comment/42063009
type: QuestionComment
comment on: http://stackoverflow.com/q/26738259
has text: Go with JavaFX2: http://stackoverflow.com/questions/18758041/play-a-video-using-javafx
score: 0
type: Comment

http://stackoverflow.com/comment/42167166
comment on: http://stackoverflow.com/q/26796419
score: 0
type: Comment
type: QuestionComment
has text: Forgive. But, kindly look on the contents and help me yaar.

http://stackoverflow.com/a/26743043
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26741710
score: 4
has body: Try this: Execute the logic in a thread, sleep and check if the thread is still alive. @Test public void fineForFiveSeconds() throws InterruptedException { Thread thread = new Thread() { @Override public void run() { foo.doforever(); } }; thread.start(); //Let the current thread sleep (not the created thread!) Thread.sleep(5000); assertTrue(thread.isAlive()); }
type: Answer

http://stackoverflow.com/q/26808136
has title: Why HttpURLConnection does not send data unless I try to receive something
type: UnansweredQuestion
score: 6
has body: I cannot comprehend why doesn't the following code does not put a packet onto wire (confirmed via wireshark). It is a fairly standard method of sending an HTTP POST request, as I believe. I don't intend to read anything just POST. private void sendRequest() throws IOException { String params = "param=value"; URL url = new URL(otherUrl.toString()); HttpURLConnection con = (HttpURLConnection)url.openConnection(); con.setDoOutput(true); con.setDoInput(true); //setting this to `false` does not help con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "text/plain"); con.setRequestProperty("Content-Length", "" + Integer.toString(params.getBytes().length)); con.setRequestProperty("Accept", "text/plain"); con.setUseCaches(false); con.connect(); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(params); wr.flush(); wr.close(); //Logger.getLogger("log").info("URL: "+url+", response: "+con.getResponseCode()); con.disconnect(); } What happens is... actually nothing, unless I try to read anything. For example by uncommenting the above log line which reads the response code. Trying to read a response via con.getInputStream(); also works. There is no movement of packets. When I uncomment the getResponseCode, I can see that http POST is sent, and then 200 OK is sent back. The order is proper. I.e. I don't get some wild response before sending POST. Everything else looks exactly the same (I can attach wireshark screenshots if needed.). In the debugger the code executes (i.e. does not block anywhere). I don't understand under what circumstances this can be happening. I belive it should be possible, to send a POST request with con.setDoInput(false);. Currently it doesn't send anything or fails (when trying to execute con.getResponseCode()) with an exception because I obviously promised I won't read anything. It might be relevant, that before sendRequest I do request some data from the same site, but I trust I close everything properly. I.…
tagged with: http
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26810433
upvote count: 6
answer count: 1
tagged with: httpurlconnection
favorite count: 0

http://stackoverflow.com/comment/42222274
type: QuestionComment
comment on: http://stackoverflow.com/q/26827182
has text: This is news to me ... This certainly wouldn't work in C# but not sure about Java etc (I'd guess not).
score: 0
type: Comment

http://stackoverflow.com/comment/42036864
type: Comment
type: QuestionComment
has text: So you're problem is that you dont understand what a deep copy is? You just create a new array, copy the values over and use the new array. This differs from a shallow copy, which affects the original when changing it
comment on: http://stackoverflow.com/q/26723393
score: 0

http://stackoverflow.com/a/26717041
score: 0
has comment: http://stackoverflow.com/comment/42024411
type: Answer
answers question: http://stackoverflow.com/q/26716811
has comment: http://stackoverflow.com/comment/42024298
has comment: http://stackoverflow.com/comment/42024380
has comment: http://stackoverflow.com/comment/42025494
accepted answer of: http://stackoverflow.com/q/26716811
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42026137
has body: i think the problem is in this line getFragmentManager() .beginTransaction() .add(R.id.container_list_collections, new FragmentCollectionVignette()) .commit(); change this to this.getActivity() .getFragmentManager() .beginTransaction() .add(R.id.container_list_collections, new FragmentCollectionVignette()) .commit()

http://stackoverflow.com/q/26823076
type: Question
has title: How do I write a method in java that reads a text file and finds the number of occurrences of each character?
tagged with: arraylist
answer count: 2
tagged with: file-io
upvote count: 0
favorite count: 0
tagged with: character
has comment: http://stackoverflow.com/comment/42215334
score: -2
has answer: http://stackoverflow.com/a/26823538
has answer: http://stackoverflow.com/a/26823285
has body: How do I write a method in java that reads a text file and finds the number of occurrences of each character? Then after it stores the items into an arraylist as you read them.
type: UnansweredQuestion
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/42119852
has text: You can't use your stream in 2 different wrappers (BufferedInput and ObjectInput). If the error still occurs after situating that problem, post a [MVCE](http://stackoverflow.com/help/mcve) that replicates the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26769687
score: 1

http://stackoverflow.com/comment/42105996
has text: where would the coordinate show up relative to the base coordinate?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26725012
type: Comment

http://stackoverflow.com/comment/41947615
type: Comment
has text: You want to delete row based id(PK) or anything else, Like showing above
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26673956

http://stackoverflow.com/q/26740782
type: AnsweredQuestion
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/26740907
has comment: http://stackoverflow.com/comment/42067577
has comment: http://stackoverflow.com/comment/42068374
type: Question
has body: private void removeLettersFromMakeWords(List&lt;String&gt; a, List&lt;String&gt; b){ Iterator&lt;String&gt; i = a.iterator(); for(String s:b) while (i.hasNext()) { Object o = i.next(); if(o.toString().equals(s)){ i.remove(); break; } } } I use an iterator to loop through my list and remove an element from the list if there is a match. For example: if a = [a, y, f, z, b] and b = [a, f] --> the output will be a = [y, z, b] Problem is if a = [a, y, f, z, b] and b = [f, a] --> the output will be a = [a, y, z, b] and the iterator doesn't remove the [a] value in the beginning. Is there a way to reset the iterator so that every time I break the iterator starts from the beginning? Or is there a better way to solve this issue?
score: 0
tagged with: iterator
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/26740907
has title: Android: removing elements from list with iterator

http://stackoverflow.com/comment/42016265
type: QuestionComment
comment on: http://stackoverflow.com/q/26711679
has text: Yes, and it does so. It parses `source.get("workcircle").toString()` and obviously this returns a string literal of a value <= Integer.MAX_VALUE and not denoted with "L" to mark it as a long representation.
score: 0
type: Comment

http://stackoverflow.com/a/26709373
has comment: http://stackoverflow.com/comment/42010902
has body: As you stated :- If Class initialization is triggered due to access of static field, only Class which has declared static field is initialized and it doesn't trigger initialization of super class or sub class even if static field is referenced by Type of Sub Class, Sub Interface or by implementation class of interface This clearly states that the output should be Initializing Superclass only. I ran your program and get the output as Initializing Superclass 1414998665110 If you are getting output as you mentioned there is something else you are doing not stated in your question. Note:- Referring to the answer provided by Jon Skeet on this question , it seems that one part of the aricle is wrong where it says:- If Class initialization is triggered due to access of static field, only Class which has declared static field is initialized and it doesn't trigger initialization of super class This is not related to your case , since INIT_TIME is part of Superclass, hence you are basically writing SuperClass_object.INIT_TIME when you say subclass.INIT_TIME. If you had INIT_TIME field in your Subclass instead of Superclass you would get output :- Initializing Superclass Initializing Subclass 1414998665110 To summarize this means Superclass gets intialized even if Class initialization is triggered due to access of static field, But Subclass is not initialized.
has comment: http://stackoverflow.com/comment/42044026
has comment: http://stackoverflow.com/comment/42011247
score: 0
answers question: http://stackoverflow.com/q/26709026
has comment: http://stackoverflow.com/comment/42010864
type: Answer
has comment: http://stackoverflow.com/comment/42046084

http://stackoverflow.com/comment/42161441
has text: Can you use POJO types? Just create a `Patch[]` or a `List<Patch>` and serialize that.
comment on: http://stackoverflow.com/q/26793136
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26732874
possible better answer: http://stackoverflow.com/a/26733084
tagged with: date
has answer: http://stackoverflow.com/a/26733077
score: 4
has answer: http://stackoverflow.com/a/26733084
upvote count: 4
has comment: http://stackoverflow.com/comment/42053061
has answer: http://stackoverflow.com/a/26733236
has comment: http://stackoverflow.com/comment/42053015
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42052929
accepted answer: http://stackoverflow.com/a/26733077
has comment: http://stackoverflow.com/comment/42053050
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4931955
has title: Calender.set() Not working properly
tagged with: calendar
has body: I want to get the last month End date, I am getting the current month and recuding it by one and setting that month value. But Calender.set(Calender.Month, lastMonth) doesnt work for only a specific date. public static String getLastMonthEndDate(Date nowDate, String dateFormat) { final String METHOD_NAME = "getLastMonthEndDate" ; SimpleDateFormat formatedDate = new SimpleDateFormat(dateFormat); Calendar calendar = new GregorianCalendar(2014, Calendar.OCTOBER, 31); // Hard coded as 2014, oct 31st for the sake of example. //calendar.setTime(nowDate); System.out.println(calendar.getTime()); if(calendar.get(Calendar.MONTH) == Calendar.JANUARY) { calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 1); } //System.out.println("calendar.get(Calendar.MONTH) -1 : " + (calendar.get(Calendar.MONTH) -1)); int lastMonth = (calendar.get(Calendar.MONTH) -1); System.out.println("Last month : "+lastMonth); calendar.set(Calendar.MONTH, lastMonth); //System.out.println(calendar.getTime()); //System.out.println("(calendar.get(Calendar.MONTH) : " + calendar.get(Calendar.MONTH)); System.out.println("calendar.getActualMaximum(Calendar.DAY_OF_MONTH) : " + calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); System.out.println("calendar.getTime() : " + calendar.getTime()); return formatedDate.format(calendar.getTime()); } public static void main(String[] args) { Date dCurrentDate = getCurrentDate(); String strLastMonthEndDateInYYYY = getLastMonthEndDate(dCurrentDate, "MM/dd/yyyy"); System.out.println("strLastMonthEndDateInYYYY : "+strLastMonthEndDateInYYYY); } The Below is the output which i got output : Fri Oct 31 00:00:00 IST 2014 Last month : 8 calendar.getActualMaximum(Calendar.DAY_OF_MONTH) : 31 calendar.getTime() : Wed Oct 01 00:00:00 IST 2014 strLastMonthEndDateInYYYY : 10/01/2014 I don't know what where the mistake is. Please help.
type: Question
tagged with: java
tagged with: gregorian-calendar

http://stackoverflow.com/comment/42162686
score: 2
has text: It *should not be* a recursive problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26793827

http://stackoverflow.com/comment/41968150
type: Comment
comment on: http://stackoverflow.com/a/26684981
has text: OK good answer! So I can safely continue my practice of always using HashMaps then. Good to know.
type: AnswerComment
score: 0

weblogic-10.x
tags question: http://stackoverflow.com/q/26809273
tag name: weblogic-10.x
type: Tag

http://stackoverflow.com/comment/42229362
type: AnswerComment
score: 0
type: Comment
has text: This guy seems to have had the same issue http://stackoverflow.com/questions/18391415/eclipse-crashed-works-space-now-cant-be-opened-and-importing-the-projects-won
comment on: http://stackoverflow.com/a/26831295

http://stackoverflow.com/comment/42005920
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26706576
has text: Or, more seriously: What's the point of providing a copy & paste ready answer to a beginner's question?
score: 0

http://stackoverflow.com/comment/42288407
score: 3
type: AnswerComment
type: Comment
has text: @martincharlesworth If you want you can try Dropwizard 0.8.0 RC, it supports Jersey 2.13
comment on: http://stackoverflow.com/a/26756789

http://stackoverflow.com/a/28901202
type: Answer
has comment: http://stackoverflow.com/comment/99636429
score: 10
has comment: http://stackoverflow.com/comment/99615756
upvote count: 10
answers question: http://stackoverflow.com/q/26744885
downvote count: 0
has body: I've had the same problem. This is my solution: public class MyNamingStrategy extends PropertyNamingStrategy { @Override public String nameForField(MapperConfig&lt;?&gt; config, AnnotatedField field, String defaultName) { return field.getName(); } @Override public String nameForGetterMethod(MapperConfig&lt;?&gt; config, AnnotatedMethod method, String defaultName) { return convert(method, defaultName); } @Override public String nameForSetterMethod(MapperConfig&lt;?&gt; config, AnnotatedMethod method, String defaultName) { return convert(method, defaultName); } private String convert(AnnotatedMethod method, String defaultName) { Class&lt;?&gt; clazz = method.getDeclaringClass(); List&lt;Field&gt; flds = FieldUtils.getAllFieldsList(clazz); for (Field fld : flds) { if (fld.getName().equalsIgnoreCase(defaultName)) { return fld.getName(); } } return defaultName; } } In this case you will get the exact name of the property, and will not have to depend on the correct names of the methods.

http://stackoverflow.com/q/26764153
has comment: http://stackoverflow.com/comment/42109374
tagged with: screen-scraping
tagged with: java
has comment: http://stackoverflow.com/comment/42109594
type: Question
has comment: http://stackoverflow.com/comment/42109409
linked to: http://stackoverflow.com/q/4582471
tagged with: htmlunit
answer count: 1
has title: How do I extract login-protected data from a website using Java?
has comment: http://stackoverflow.com/comment/42109333
has comment: http://stackoverflow.com/comment/42109629
score: 0
upvote count: 1
tagged with: apache-commons-httpclient
has body: I've been using Java to extract some values from one website. However, I now need to extract some values from another website, but this website requires you to login to see the page. I have a username and password that I can use to login, but I have been unsuccessful with using an automated login on Java using HTTPclient or HTMLUnit. Is there any way I would be able to get round this and extract the data from the login protected page?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26764244
downvote count: 1

http://stackoverflow.com/comment/41974488
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26676421
has text: I don´t get why u use `model.getObject().createWeekModel()` while I could just do `model.getObject().createDataModel() `. What´s the use of getting a `model` of an `Integer`

http://stackoverflow.com/comment/42222421
comment on: http://stackoverflow.com/a/26826832
score: 0
type: AnswerComment
has text: Could you update your code? I don't understand how the client program will "wait" after the `println`. After that, it is supposed to terminate. It may throw Exceptions but, nonetheless, it is supposed to terminate and not hang around waiting.
type: Comment

http://stackoverflow.com/q/26816496
tagged with: java-ee-7
accepted answer: http://stackoverflow.com/a/26816838
tagged with: jakarta-ee
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42203817
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42203673
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42203854
has comment: http://stackoverflow.com/comment/42203697
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/42203882
has comment: http://stackoverflow.com/comment/42203681
has answer: http://stackoverflow.com/a/26816838
tagged with: rest
has comment: http://stackoverflow.com/comment/42204100
has title: Multiple GET methods match: select most specific
favorite count: 0
has body: I have a web service that looks like: @Path("/ws") public class Ws { @GET public Record getOne(@QueryParam("id") Integer id) { return record(id); } @GET public List&lt;Record&gt; getAll() { return allRecords(); } } The idea is that I can either call: http://ws:8080/ws?id=1 to get a specific record http://ws:8080/ws to get all available records However when I use the second URL, the first @GET method is called with a null id. Is there a way to achieve what I want without using different paths? I think this can be achieved with Spring using the @RequestMapping(params={"id"}) and @RequestMapping annotations for the first and second methods respectively but I can't use Spring in that project.

rest
tags question: http://stackoverflow.com/q/26719838
tags question: http://stackoverflow.com/q/26697102
tags question: http://stackoverflow.com/q/26773024
tags question: http://stackoverflow.com/q/26802658
tags question: http://stackoverflow.com/q/26814901
tags question: http://stackoverflow.com/q/26735941
tags question: http://stackoverflow.com/q/26788608
tags question: http://stackoverflow.com/q/26830248
tags question: http://stackoverflow.com/q/26796687
tags question: http://stackoverflow.com/q/26694544
tags question: http://stackoverflow.com/q/26812479
tags question: http://stackoverflow.com/q/26822963
tags question: http://stackoverflow.com/q/26679171
tags question: http://stackoverflow.com/q/26781613
tags question: http://stackoverflow.com/q/26784297
tags question: http://stackoverflow.com/q/26777578
tags question: http://stackoverflow.com/q/26748646
tags question: http://stackoverflow.com/q/26744636
tags question: http://stackoverflow.com/q/26677489
tags question: http://stackoverflow.com/q/26802589
tags question: http://stackoverflow.com/q/26816496
tags question: http://stackoverflow.com/q/26696880
tags question: http://stackoverflow.com/q/26780404
tags question: http://stackoverflow.com/q/26697122
tags question: http://stackoverflow.com/q/26702426
tags question: http://stackoverflow.com/q/26762195
tags question: http://stackoverflow.com/q/26702483
tags question: http://stackoverflow.com/q/26681603
tags question: http://stackoverflow.com/q/26785551
tags question: http://stackoverflow.com/q/26683633
tags question: http://stackoverflow.com/q/26777083
tags question: http://stackoverflow.com/q/26759454
tags question: http://stackoverflow.com/q/26741167
tags question: http://stackoverflow.com/q/26687051
tags question: http://stackoverflow.com/q/26728736
tags question: http://stackoverflow.com/q/26761845
tags question: http://stackoverflow.com/q/26690847
tags question: http://stackoverflow.com/q/26709288
tags question: http://stackoverflow.com/q/26713743
tags question: http://stackoverflow.com/q/26687775
tags question: http://stackoverflow.com/q/26785027
tags question: http://stackoverflow.com/q/26690671
tags question: http://stackoverflow.com/q/26765891
tags question: http://stackoverflow.com/q/26743643
tags question: http://stackoverflow.com/q/26830759
tags question: http://stackoverflow.com/q/26811267
tags question: http://stackoverflow.com/q/26678938
type: Tag
tags question: http://stackoverflow.com/q/26735645
tags question: http://stackoverflow.com/q/26687111
tags question: http://stackoverflow.com/q/26796179
tags question: http://stackoverflow.com/q/26730059
tags question: http://stackoverflow.com/q/26748648
tags question: http://stackoverflow.com/q/26803258
tags question: http://stackoverflow.com/q/26804823
tags question: http://stackoverflow.com/q/26701081
tags question: http://stackoverflow.com/q/26711906
tag name: rest
tags question: http://stackoverflow.com/q/26724919
tags question: http://stackoverflow.com/q/26757099
tags question: http://stackoverflow.com/q/26697071
tags question: http://stackoverflow.com/q/26752880
tags question: http://stackoverflow.com/q/26739673
tags question: http://stackoverflow.com/q/26701298
tags question: http://stackoverflow.com/q/26690778
tags question: http://stackoverflow.com/q/26678546
tags question: http://stackoverflow.com/q/26719366
tags question: http://stackoverflow.com/q/26800314
tags question: http://stackoverflow.com/q/26715216

conflict
tag name: conflict
type: Tag
tags question: http://stackoverflow.com/q/26778891

http://stackoverflow.com/comment/42154168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26788931
score: 0
has text: Do you really mean Java 6? Can't you even use Java 7?

http://stackoverflow.com/comment/42085452
has text: try initializing the versionPK instance in the entity with an empty instance.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26748640

http://stackoverflow.com/a/26779879
type: Answer
has comment: http://stackoverflow.com/comment/42148544
score: 2
has body: Java packages are like directory. So if you have your class file MyClass.java in package like com.myfirm.pack then this should be in src directory like: src com myfirm pack MyClass.java if you wish to compile your java code (assuming you are at src folder) you need to do the following: c:\src> javac com\myfirm\pack\MyClass.java While if you want to run it, you need to do: c:\src> java -cp . com.myfirm.pack.MyClass
downvote count: 0
has comment: http://stackoverflow.com/comment/42137639
has comment: http://stackoverflow.com/comment/42137627
has comment: http://stackoverflow.com/comment/42137918
upvote count: 2
has comment: http://stackoverflow.com/comment/42138217
has comment: http://stackoverflow.com/comment/42137828
answers question: http://stackoverflow.com/q/26779722

http://stackoverflow.com/comment/42142101
type: AnswerComment
has text: Just to play devil's advocate, the key phrase here might be "without the user’s knowledge and consent". If the OP's app only messes with the WiFi capabilities after the user has placed a check mark in an "I understand what is going to happen, please do it" type of disclaimer then I'd think it should be OK.
comment on: http://stackoverflow.com/a/26782231
type: Comment
score: 2

http://stackoverflow.com/q/26716458
tagged with: jsp
answer count: 3
has answer: http://stackoverflow.com/a/26716657
type: UnansweredQuestion
tagged with: spring
has body: I am not able to get the values from JSP to my Spring controller, below is the my code snippet. in JSP I have defined parameters like &lt;input type="hidden" id="categoryId" name="categoryId" value="&lt;c:out value="${category.categoryId}"/&gt;" /&gt; &lt;input type="hidden" id="sortBy" name="sortBy" value="&lt;c:out value="${requestScope.sortBy}"/&gt;" /&gt; &lt;input type="hidden" id="orderBy" name="orderBy" value="&lt;c:out value="${requestScope.orderBy}"/&gt;" /&gt; And my controller is looks like @RequestMapping(value = "category/listCategory.htm") public ModelAndView getList(HttpServletRequest request) { long longCurrentPage = CommonUtils.checkPaginationAttributes(request); String orderBy = request.getParameter(const_OrderBy); String sortBy = request.getParameter(const_SortBy); List&lt;Category&gt; categoryList = categoryService.getCategoryList(longCurrentPage, orderBy, sortBy); ... ... ... request.setAttribute("currentPage", new Long(longCurrentPage)); request.setAttribute(const_OrderBy, orderBy); request.setAttribute(const_SortBy, sortBy); ModelAndView modelandView = new ModelAndView("listCategory","categoryList",categoryList); From controller to JSP values are setting fine, while getting the same values from JSP is getting null's I also tried with public ModelAndView getList( @RequestParam(value = "orderBy", required = false, defaultValue = "") String orderBy, @RequestParam(value = "sortBy", required = false, defaultValue = "") String sortBy, @RequestParam(value = "oortBy", required = false, defaultValue = "") String oortBy, @RequestParam(value = "isPaginationClicked", required = false, defaultValue = "") String isPaginationClicked, @RequestParam(value = "currentPage", required = false, defaultValue = "") String currentPage) Still Im not getting values, Pls help.. thanks in Advance...
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/42023861
has answer: http://stackoverflow.com/a/26729902
type: Question
has answer: http://stackoverflow.com/a/26716874
score: 0
has title: not able to get parameters from jsp to spring controller

http://stackoverflow.com/comment/42103742
comment on: http://stackoverflow.com/q/26761130
type: Comment
has text: What do you then want to *do* with it in Eastern time? There are various different options depending on what you're doing with the data. Note that `2014-11-04T06:03:50-07:00` isn't so much "Pacific Time" as "UTC-7"... in other words, the value includes the UTC offset itself, so you don't need to assume a particular time zone.
type: QuestionComment
score: 2

http://stackoverflow.com/q/26751791
upvote count: 2
has body: Recently i have a requirement in which i need to put some beacons at different place on a Floor. I've to get notification on the basis of beacons devices once i enter from main door and i have to display path from my current position to beacons on a Floor plan (probably an image and need to draw a path). How can i achieve my current position and direction from placed Beacons. At the same time i have one more query about beacons that how much these devices are accurate in performance and locating regions. Am i missing something. If anybody have gone through this topic please help me so i can look forward in this solution.
tagged with: location
favorite count: 0
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/56791951
tagged with: android
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android-ibeacon
has title: How to get my location againts a Beacon on a floor Plan
type: Question
score: 2
has comment: http://stackoverflow.com/comment/57042515
tagged with: java

mapreduce
tags question: http://stackoverflow.com/q/26675751
type: Tag
tags question: http://stackoverflow.com/q/26707114
tags question: http://stackoverflow.com/q/26747113
tags question: http://stackoverflow.com/q/26821652
tags question: http://stackoverflow.com/q/26743762
tags question: http://stackoverflow.com/q/26728504
tag name: mapreduce
tags question: http://stackoverflow.com/q/26695749
tags question: http://stackoverflow.com/q/26825926
tags question: http://stackoverflow.com/q/26707676
tags question: http://stackoverflow.com/q/26804606
tags question: http://stackoverflow.com/q/26719946
tags question: http://stackoverflow.com/q/26767009
tags question: http://stackoverflow.com/q/26727423
tags question: http://stackoverflow.com/q/26716168
tags question: http://stackoverflow.com/q/26748811

http://stackoverflow.com/q/26827528
has comment: http://stackoverflow.com/comment/42223655
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/28653212
has title: Bloomberg API in Java
type: Question
accepted answer: http://stackoverflow.com/a/28653212
has body: I am trying to translate from bloomberg excel vba to bloomberg java api. For example, how to translate this sentence? =BDH("IBM US Equity","LAST_PRICE",Hourly_Start,Hourly_End,"BarTp=T","BarSz=60","Dir=V","Dts=S","Sort=D","Points=20") I am not especially not sure about the Hourly_Start part, can I do this? request.set("startDate","Hourly_Start"); Also, how to set the BarTp=T Dir=V part? Thanks a lot.
has comment: http://stackoverflow.com/comment/42223608
has comment: http://stackoverflow.com/comment/42223681
tagged with: bloomberg
score: 0
has comment: http://stackoverflow.com/comment/42223851
answer count: 1
tagged with: vba
has comment: http://stackoverflow.com/comment/42223808
has comment: http://stackoverflow.com/comment/42224081

http://stackoverflow.com/q/26717043
accepted answer: http://stackoverflow.com/a/26717197
answer count: 1
favorite count: 0
has title: Minimal Days In First Week of the Year in Java
tagged with: java.util.calendar
has answer: http://stackoverflow.com/a/26717197
tagged with: calendar
type: AnsweredQuestion
score: 2
tagged with: java
downvote count: 1
type: Question
has body: I am actually going through the utility class Calender. I find myself confused with, The methods getFirstDayOfWeek() returns the first day of the week; e.g., SUNDAY in the U.S., MONDAY in France. and getMinimalDaysInFirstWeek() returns the minimal days required in the first week of the year. e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1. If the minimal days required must be a full week, this method returns 7. I am living in India (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi. Daylight Saving time is not observed in this time zone. To get the Week of the year, i coded like this Calendar calendar = Calendar.getInstance(); System.out.println(calendar.get(Calendar.WEEK_OF_YEAR)); // returns 45 45 is only possible if Java treats WeekNumber FromDate ToDate Week 01 December 30, 2013 January 5, 2014 // December 30 is Monday Week 45 November 3, 2014(Monday) November 9, 2014 Does Java takes minimal days to be a full week to be 7? Because I can change it through setMinimalDaysInFirstWeek(). And what effect will it have?
upvote count: 3

http://stackoverflow.com/q/26714912
has title: Facebook notification when event happens on my server
tagged with: java
score: 0
answer count: 1
tagged with: javascript
tagged with: web
tagged with: facebook-graph-api
tagged with: facebook
has body: I'm new to FB API, and I'm completely lost through variety of them. I have Java web app, and FB login to it on my site. How can I send notification to user, when some event happens (for example, his good arrived, and we want to notify him)? Should I use Cavans application, or Graph API? Is it possible?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26715651
accepted answer: http://stackoverflow.com/a/26715651
type: Question

http://stackoverflow.com/a/26761460
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42104407
has body: I think the answer is 2. when b=a, in fact, a has a reference to b. when you debug your program on your eclipse, you will see a and b have a same id. They are one Object actually.
answers question: http://stackoverflow.com/q/26761083

http://stackoverflow.com/q/26751739
score: 0
has answer: http://stackoverflow.com/a/26885348
has title: Libgdx- How to scale animation
answer count: 1
has comment: http://stackoverflow.com/comment/42086927
has comment: http://stackoverflow.com/comment/42324406
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26885348
tagged with: java
type: Question
has body: I want to In the click the screen then Slide ya animated change the screen. this code has been only the change the image but it has not animated . I want to change the image on the click of screen is animated and then change.. Only change the image is code is bellow but how to animated is not know??? package com.check; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Screen; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.utils.ArrayMap; public class TutorialUI implements Screen, ApplicationListener{ private static final String TEXTURE_PATH = "data/animvs-logo.png"; private AssetManager assetManager; private SpriteBatch batch; private Stage stage; private boolean tuchb=true; private ArrayMap&lt;Integer, Item&gt; items; private ArrayMap&lt;Integer, Item&gt; itemsDisplayed; private Skin uiSkin; private Table scrollTable; private TextField textSearch; private String searchLastCriteria; TextButton button; TextButtonStyle textButtonStyle; TextureAtlas buttonAtlas; BitmapFont font; Texture logo,logo1,logo2; Window window; @Override public void create() { batch = new SpriteBatch(); stage = new Stag…
tagged with: libgdx

http://stackoverflow.com/a/27196821
has body: The solution would probably depend on the behavior requirements. How about the following scenario: users A and B started to change some values, then user A pressed Save button and saved data, after that user B did the same. User B got an error message saying something like "the data has been updated, please reload the page". He reloads the page and lose all changes he did :( Only after that he is able to save his changes, but he has to do it once again. Other possible scenario: users A and B accessing the page, but only the user who was the first will be able to save his work, other users will see message saying something like "someone else is editing the page, try again later". For the first scenario you can implement the following: each line of the table (in database) has a last-update-timestamp which is updated to current time each time this row is changed. Now, let's imagine user A get row with timestamp 1 when opened the page, user B was a little bit slower and got the same row with timestamp 2. But, he did his changes faster and pressed Save button first. Now, the row is saved in DB with timestamp let's say 5. User A is trying to save his changes, but the timestamp of his data is 1, which is different from 5 currently in DB. That means someone changed that data already and he should see error message I mentioned above. Second scenario is a little bit harder to implement. I think the best way to do this is to open transaction to DB which reads the row(s) we want; put some flag like "locked" to true for all of them; if some row is locked already, fails (or return available rows, depending on what you need). But, probably should fail; returns rows to jsp page; Now, if other user requested the same rows, transaction will fail and he will not be able to start changing data. User A should put these locked flags back to false when he saves the data. Important thing: these locks should have timeout to prevent situation when user opened the page and closed it without s…
downvote count: 0
answers question: http://stackoverflow.com/q/26677044
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26796454
has comment: http://stackoverflow.com/comment/42167049
type: UnansweredQuestion
tagged with: java
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/42167055
answer count: 2
tagged with: arrays
has body: I am trying to load a text file that contains characters and two numbers, something that looks like this 5 7 ++++M++ + + + ++ ++ + ++ + +X+++++ where the 5 and 7 correspond to number of rows and columns. I am trying to read this line by line and then translate the numbers into values in an array, however for some reason I fail to even Scanner inputFile = new Scanner(new FileReader(fid)); maze_r = inputFile.nextInt(); maze_c = inputFile.nextInt(); int counter = 0; while(inputFile.hasNextLine()){ rowArray = inputFile.nextLine(); System.out.print("\n"+rowArray); char index; for(int ind = 0; ind == (maze_c-1);ind++){ index = rowArray.charAt(ind); System.out.print(index); if(index == ' ') theMaze[counter][ind] = 0; if(index == '+') theMaze[counter][ind] = 1; if(index == 'M') theMaze[counter][ind] = 2; if(index == 'X') theMaze[counter][ind] = 3; } } System.out.print(Arrays.toString(theMaze)); } When I do this it prints out the rows as characters but will print a void for the array I have tried to make. I do not know what I am doing wrong, for some reason it will not compute the for loop in the while loop. When I wrote like a system.out.print inside the loop nothing printed. What am I doing wrong?
has answer: http://stackoverflow.com/a/26797724
has title: Trouble reading chars in string in Java
score: 0
tagged with: char
has comment: http://stackoverflow.com/comment/42167098
tagged with: string
has answer: http://stackoverflow.com/a/26796505

http://stackoverflow.com/a/26704897
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42078450
accepted answer of: http://stackoverflow.com/q/26698788
type: Answer
answers question: http://stackoverflow.com/q/26698788
has comment: http://stackoverflow.com/comment/42014891
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42078681
has body: What you are observing (jump to 21) is likely to be an implmentation detail of Ebean prior to 4.0.5. Ebean is using a 'fetch ahead' mechanism on the sequence. After 4.0.5 Ebean switched to use Postgres SERIAL by default (so by default you won't see this with Ebean/Postgres after 4.0.5). Refer: https://github.com/ebean-orm/avaje-ebeanorm/issues/97 That all said - 'incrementing EXACTLY by 1' is something you generally want to avoid as it becomes a concurrency issue (avoid making the autoincrement ID transactional as that introduces contention). When you need 'increment exactly by one' semantics (like cheque numbers etc) then you can look to create in batch in advance.

http://stackoverflow.com/comment/42034194
comment on: http://stackoverflow.com/q/26722140
score: 0
has text: Secondly, you'll either want to re-write just the lines you want to keep to a temporary file as you go then copy it back over the original, or read all lines into some array first, process them, remove whatever lines in memory, then write the full modified array back out all at once. You can't just delete an arbitrary line from a text file directly, unfortunately.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26742695
upvote count: 1
has answer: http://stackoverflow.com/a/26744083
tagged with: swing
answer count: 1
type: UnansweredQuestion
tagged with: japplet
has title: Trying to draw to applet in another class
downvote count: 0
score: 1
tagged with: applet
favorite count: 0
type: Question
tagged with: java
has body: Hi im a bit of a beginner to java programming and am trying to figure out how to draw a shape (oval) from another class to a java applet (I'm sure it's probably a simple problem) the class with the applet i want to draw to: import java.awt.*; import javax.swing.JApplet; public class PulsatingBalls extends JApplet{ private static final long serialVersionUID = 1L; public void init(){ getContentPane().setBackground( Color.black ); new ball(20, 20); } } and the ball class: import java.awt.Graphics; public class ball extends PulsatingBalls{ int x; int y; public ball(int y, int x){ this.x = x; this.y = y; repaint(); } public void paint(Graphics g){ g.drawOval(x, y, 50, 50); } }

http://stackoverflow.com/comment/42055536
comment on: http://stackoverflow.com/a/26734506
type: Comment
type: AnswerComment
has text: "an idea" won't be regarded as an answer. Actually, anyone can think of a solution, but you would have to realise it. ;)
score: 0

http://stackoverflow.com/q/26773124
has comment: http://stackoverflow.com/comment/42125764
has title: Bubble sorting arraylis is not working
has answer: http://stackoverflow.com/a/26773315
type: UnansweredQuestion
has body: I'm trying to bubble sort car make and year, where I would have the car year sorted and if two car makes are in the same year, then they are sorted alphabetically. My program works up to the point where I call BubbleSorted(). It's giving me an error java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 and I don't know why. My program seems to be correct. Below is my program. I have 3 classes(main, bubblesortCars, GetCarInfo). import java.util.ArrayList; import java.util.Scanner; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.FileReader; public class TheMain { public static void main(String[] args) { Scanner keyboard=new Scanner(System.in); int choice; boolean done = false; try{ String filename1 = "Demo.txt"; FileReader inputFile = new FileReader(filename1); //Instantiate the BufferedReader Class BufferedReader bufferReader = new BufferedReader(inputFile); ArrayList&lt;GetCarInfo&gt; CarList = new ArrayList(); //Variable to hold the one line data String line; StringTokenizer st; int i=0; // Read file line by line and print on the console while ((line = bufferReader.readLine()) != null) { st = new StringTokenizer(line, "\t"); st.nextToken(); st.nextToken(); String getMake = st.nextToken(); st.nextToken(); int getYear = Integer.parseInt(st.nextToken()); GetCarInfo temp; temp = new GetCarInfo(getMake, getYear); CarList.add(temp); } bufferReader.close(); BubbleSortCars Sorted = new BubbleSortCars(); Sorted.bubblesorted(CarList, 0, CarList.size()); } catch (Exception e) { e.printStackTrace(); } } } import java.util.ArrayList; public class BubbleSortCars { ArrayList &lt;GetCarInfo&gt; temp= new ArrayList(); public void bubblesorted(ArrayList &lt;GetCarInfo&gt; grabber, int began, int end){ for(int i =0; i&lt;end-began-1; i++){ for(int j=began; j&lt;(end-i-1); j++){ if(grabber.get(j).year &gt; grabber.get(j+1).year){ temp.set(j, grabber.get(j)); grabber.set(j,grabber.get(j+1)); grabber.set(j+1, temp.get(j)); System.out.println("Success"); …
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26773390
tagged with: bubble-sort
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/comment/59206554
has text: @TechCrunch, I edited the answer with code examples, hope it'll help you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27043703
type: Comment

http://stackoverflow.com/comment/42162169
has text: Order doesn't matter (much) when you're writing a class. You can put the methods and constructors in any order you like them to be. Grouping methods together logically is a good idea though, it makes your class easier to read.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26793095

http://stackoverflow.com/q/26685915
has answer: http://stackoverflow.com/a/26685946
has title: Program wont terminate - Java
has answer: http://stackoverflow.com/a/26685940
type: AnsweredQuestion
downvote count: 1
type: Question
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/26685940
answer count: 2
has comment: http://stackoverflow.com/comment/41969723
upvote count: 0
has body: I'm trying to use an if else statement for a menu selection in my program. Whenever I type in the number given to quit the application, the application still runs. I'm not sure what I should to do to fix this but any help would be greatly appreciated. Thanks in advance. import java.util.Scanner; public class Gradebook { public static void main(String[] args ){ Scanner input = new Scanner(System.in); System.out.println("(1) Average grades for a new student"); System.out.println("(2) Quit"); int selection = input.nextInt(); if( selection == 1) { System.out.println("Grades will be put in accordingly: \n Homework \n Quizzes \n Tests"); System.out.println("Once all grades have been put in, type -1 to continue"); String name = input.next(); } else{ System.out.println("Goodbye."); } int total = 0; int counter = 0; System.out.println("Please enter numeric homework grade or \"-1\" to quit: "); int grade = input.nextInt(); while( grade != -1) { total = total + grade; counter = counter + 1; grade= input.nextInt(); } if (counter &gt; 0) { double average = total / (double)counter; System.out.println("The average for Homework is: " + average); } else System.out.println("No grades were entered."); System.out.println("Please enter numeric Quiz grade or \"-1\" to quit: "); while( grade != -1) { total = total + grade; counter = counter + 1; grade = input.nextInt(); } if(counter &gt; 0) { double average = total / (double)counter; System.out.println("The average for Quizzes is: " + average); } else System.out.println("No grades were entered."); System.out.println("Please enter numeric Test grade or \"-1\" to quit: "); while(grade != -1) { total = total + grade; counter = counter + 1; grade = input.nextInt(); } if(counter &gt; 0) { double average = total / (double)counter; System.out.println("The average for Tests is: " + average); } else System.out.println("No grades were entered."); } }
possible better answer: http://stackoverflow.com/a/26685946
favorite count: 0

http://stackoverflow.com/a/26794675
score: 0
has body: You need to simply do this i.e, add an else part for characters other than y/n. Simply call the showPlayAgainMessage() function in the else part. You may do this for other required sections of your code. private void showPlayAgainMessage() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out.println("Do you want to play again? (y/n)"); try { if (playAgain.equals("y")) { startGame(); } else if (playAgain.equals("n")) { System.out.println(); System.out.println("Last chance. Play again? (y/n)"); playAgain = br.readLine(); if (playAgain.equals("y")) { System.out.println(); System.out.println("I really wish we had Minesweeper..."); System.out.println("Lots of Hangman though...Hangman? (y/n)"); playAgain = br.readLine(); // Lots of Hangman though...Hangman? Is y. if (playAgain.equals("y")) { startGame(); } // Lots of Hangman though...Hangman? Is n. else if (playAgain.equals("n")) { System.out.println(); System.out.println("ok..."); } } } else{ System.out.println("Sorry, invalid input. y/n required."); showPlayAgainMessage(); // this will prompt the user again for y/n if any other character is typed. } }catch(Exception e){ } }
has comment: http://stackoverflow.com/comment/42164992
type: Answer
answers question: http://stackoverflow.com/q/26794324

http://stackoverflow.com/comment/42087589
type: AnswerComment
comment on: http://stackoverflow.com/a/26694712
type: Comment
has text: The Root Context of the project is TestUseCase and Fetch.jsp is one of it's files. I do get the output of Fetch.jsp page but when i click on the Submit button i can't get the database i'm trying to connect here. There is where the error is showing up.localhost:8080/Sample type status report; message /Sample; description The requested resource is not available. Help me with this error.
score: 0

http://stackoverflow.com/q/26783408
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: Part of the project I've been working on requires serializing objects to JSON and passing them to the user. We will be using the Jackson library to do this. Previously I was using version 2.2.3, which was simple enough, but my manager wants to switch back to version 1.9.12. Shouldn't be a problem, 1.9.12 supports everything that we need, but just adding the dependency to the project causes it to basically implode. The dependency we add: org.codehaus.jackson jackson-mapper-asl 1.9.12 The project builds just fine. However, running the server causes it to throw this: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonGenerationException followed by about a page of information which I can provide if needed. Trying to load up a web page (which was working previously) causes it to generate a 5MB log file full of errors, and while the page itself loads some of the page entities come out wrong. A quick check of the compiled .war file shows that the jackson-mapper-asl.jar doesn't contain JsonGenerationException.class, but jackson-core-asl.jar (which I believe is added as part of the jackson-mapper-asl dependency, as it is not listed in the dependencies) does. I have commented out all of the code relying on Jackson, so the libraries are not used in any way in my code. My suspicion is that Spring is trying to create a JSON mapper for one of the servlets and is somehow crashing. However, I'm not sure why it can't find the dependency.
has comment: http://stackoverflow.com/comment/42144415
tagged with: jackson
has answer: http://stackoverflow.com/a/26786924
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42143934
tagged with: maven
has title: Adding jackson-core-asl to maven dependencies causes ClassNotFoundException
tagged with: spring-mvc

http://stackoverflow.com/a/26805962
answers question: http://stackoverflow.com/q/26805873
score: 0
has body: Use Integer.parseInt(String s) or Integer.parseInt(String s, int radix) to convert your Strings to Integers or primitive ints. For instance: try { String s = "42"; int i = Integer.parseInt(s); } catch (NumberFormatException nfe) { nfe.printStackTrace(); } You can also use Scanner.nextInt if that suits your context better.
type: Answer

http://stackoverflow.com/comment/42024310
type: AnswerComment
comment on: http://stackoverflow.com/a/26708423
score: 0
type: Comment
has text: `job.setNumReduceTask(0)` to remove reduce phase. But your problem is that you'r trying to write an Iterable rather than IntWritable to the context. Use `for(IntWritale val : values) { context.write(key, val);}`

http://stackoverflow.com/comment/42156111
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26751148
has text: You *sign* with the private key and *verify* with the public key. The Signature class supports that.

http://stackoverflow.com/a/77525155
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26768663
upvote count: 1
has body: This error occurred when you change package name in manifest file but not in main activity . remember when you changing package name then change it on 1 manifest file if your building flutter then change it on all 3 mode profile , debug , and release 2 main activity kotlin or java file 3 In build gradle change the application id

http://stackoverflow.com/q/26718792
answer count: 2
has body: Is there any way to make a Connection pool using this only: http://docs.oracle.com/javase/7/docs/api/javax/sql/package-summary.html ? In tomcat7 and MySQL i have a lot of problems with DBCP driver.
has title: Connection pool with javax MySQL
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26719522
has answer: http://stackoverflow.com/a/26719104
tagged with: mysql
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/42086630
comment on: http://stackoverflow.com/a/26750882
has text: I have gone through this document, but I am not getting any idea how can I connect my ESB to the active MQ.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26760093
has answer: http://stackoverflow.com/a/26760180
accepted answer: http://stackoverflow.com/a/26760180
has body: I have a ArrayList like this: [5, 181, 138, 95, 136, 179] what i wanted to do, is convert this list to double []. Something like this. double[] Fails = new double[]{5, 181, 138, 95, 136, 179}; This is my code: ArrayList&lt;String&gt; DatesList = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; FailList = new ArrayList&lt;String&gt;(); while (rs2.next()) { DatesList.add(rs2.getString("Date")); FailList.add(rs2.getString("fail")); } double[] Fails = new double[]{FailList}; //obviously it doesn't work.. Is there any way to convert from ArrayList to double[]?
has comment: http://stackoverflow.com/comment/42101640
duplicate of: http://stackoverflow.com/q/5374311
has comment: http://stackoverflow.com/comment/42101827
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42128954
has comment: http://stackoverflow.com/comment/42101911
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42101712
linked to: http://stackoverflow.com/q/5374311
tagged with: double
linked to: http://stackoverflow.com/q/5769669
has comment: http://stackoverflow.com/comment/42101803
type: AnsweredQuestion
has title: How can i convert from ArrayList<String> to double[]?
tagged with: java
has comment: http://stackoverflow.com/comment/42102053
type: Question

http://stackoverflow.com/a/26701821
has body: You should use putExtra() method of the Intent class. Put boolean extra in your MainActivity with key acceptors: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b1 = (Button) findViewById(R.id.button1); Button b2 = (Button) findViewById(R.id.button2); b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub startActivity(new Intent(MainActivity.this, NEXT.class).putExtra("acceptors", true); } }); b2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub startActivity(new Intent(MainActivity.this, NEXT.class).putExtra("acceptors", false)); } }); } } Then in your NEXT activity, get intent, and check whether you get acceptors or donors: public class NEXT extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.next); boolean isAcceptors = getIntent().getBooleanExtra("acceptors", false); if (isAcceptors) //did onClick="clicked" { setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.acceptors))); } else { setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.donars))); } } }
has comment: http://stackoverflow.com/comment/42431254
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26701709
type: Answer
answers question: http://stackoverflow.com/q/26701709

http://stackoverflow.com/comment/42210360
type: AnswerComment
has text: You can just copy that method (or leave it in the separate class) and then *call* `drawTextBox` using `'*'` and the return value of `generateLicensePlate`, instead of calling System.out.println(generateLicensePlate())`
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26819260

http://stackoverflow.com/comment/42042714
comment on: http://stackoverflow.com/q/26726868
type: Comment
type: QuestionComment
has text: @Matin: From an algorithmic-complexity perspective, no. From a pragmatic perspective, perhaps yes. But it would depend heavily on the mathematical properties of `distance`, for a start. (Specifically, does `dist(x,y)` and `dist(y,z)` tell you anything about `dist(x,z)`?)
score: 1

http://stackoverflow.com/comment/42130731
score: 0
has text: @UmaKalyani: I have no idea. Like you and Alnitak, I would expect this to be consistent. I'm sure it *is* deterministic, but I don't know what the variables are that make it inconsistent.
comment on: http://stackoverflow.com/q/26775923
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26734515
has answer: http://stackoverflow.com/a/26735317
has comment: http://stackoverflow.com/comment/42056196
type: AnsweredQuestion
score: 2
tagged with: java
has title: how do I calculate the points in a 5-point polygon
has comment: http://stackoverflow.com/comment/42056560
has body: I have a class Demo with a button and when the user clicks the button called polygon a polygon is drawn starting from the point where they hit, The code works fine in drawing but unfortunately it draws the polygon in the wrong place. The PolygonShape Class class PolygonShape { int x, y; private Polygon p; public PolygonShape(int x, int y) { // the x, y sent to this constructor //are the cordinates of the point where the user clicked this.x = x; this.y = y; } public void draw(Graphics g) { p = new Polygon(); for (int i = 0; i &lt; 5; i++) p.addPoint((int) (x + y * Math.cos(i * 2 * Math.PI / 5)), (int) (x + y * Math.sin(i * 2 * Math.PI / 5))); g.drawPolygon(p); } }
has comment: http://stackoverflow.com/comment/42056064
type: Question
has comment: http://stackoverflow.com/comment/42056080
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26735317
has comment: http://stackoverflow.com/comment/42056439
has answer: http://stackoverflow.com/a/26736105
has comment: http://stackoverflow.com/comment/42056533
possible better answer: http://stackoverflow.com/a/26736105
favorite count: 0
upvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/42056361

http://stackoverflow.com/a/26737594
has comment: http://stackoverflow.com/comment/42063044
answers question: http://stackoverflow.com/q/26737425
has comment: http://stackoverflow.com/comment/42063557
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42066376
has comment: http://stackoverflow.com/comment/42062868
has body: Just a thing, I guess: Cursor c = db.rawQuery("select * FROM mytable order by id", null); Toast.makeText(this, "Row count---"+c.getCount(), Toast.LENGTH_SHORT).show();//giving 500 record int ik= 0; if (c.moveToFirst()) { do { ik++; Log.i("CursorCheck", " increment---"+ik);//should count until the last one } while(c.moveToNext()) } Notice the c.moveToFirst(). Otherwise, a cursor can be at any inconvenient place. That way you ensure you get them from the beginning. I also changed your check to use Logs, otherwise, having 500 Toasts might be exhasperating
has comment: http://stackoverflow.com/comment/42063336
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42066414
type: Answer
accepted answer of: http://stackoverflow.com/q/26737425

android-activity
tags question: http://stackoverflow.com/q/26761090
tags question: http://stackoverflow.com/q/26734365
tags question: http://stackoverflow.com/q/26728782
tags question: http://stackoverflow.com/q/26832322
tags question: http://stackoverflow.com/q/26743524
tags question: http://stackoverflow.com/q/26739737
tags question: http://stackoverflow.com/q/26690028
tags question: http://stackoverflow.com/q/26735084
tags question: http://stackoverflow.com/q/26734229
tags question: http://stackoverflow.com/q/26681195
tag name: android-activity
tags question: http://stackoverflow.com/q/26695006
tags question: http://stackoverflow.com/q/26736562
tags question: http://stackoverflow.com/q/26829103
tags question: http://stackoverflow.com/q/26795775
tags question: http://stackoverflow.com/q/26692418
tags question: http://stackoverflow.com/q/26769632
tags question: http://stackoverflow.com/q/26788979
tags question: http://stackoverflow.com/q/26770269
tags question: http://stackoverflow.com/q/26677173
tags question: http://stackoverflow.com/q/26751168
type: Tag

http://stackoverflow.com/q/26726336
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/26726398
has body: I'm really confused and I ask for your help, after checking this lots of times. I have a MySQL table with quotes I need to show at the homepage of this website I'm creating. They are exhibited with this code here &lt;h:outputText value="#{fraseMB.aleatoria.frase}"&gt;&lt;/h:outputText&gt; &lt;h:outputText value=" (#{fraseMB.aleatoria.autor})"&gt;&lt;/h:outputText&gt; As you may see, the idea is to show the quote (frase, in Portuguese) and the author's name (autor, in Portuguese). This code is backed by the following application scoped bean: package net.isalicos.frase; import java.io.Serializable; import java.sql.SQLException; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ApplicationScoped; @ManagedBean(name="fraseMB") @ApplicationScoped public class Frase implements Serializable { private static final long serialVersionUID = -1211720749246194248L; private int contador; private FraseVO aleatoria; private FraseDAO dao; private List&lt;FraseVO&gt; lista; @PostConstruct public void init() { this.contador = 0; dao = new FraseDAO(); try { lista = dao.getList(); } catch (ClassNotFoundException | SQLException e) { } } public FraseVO getAleatoria() { if(this.contador &gt;= lista.size()) { contador = 0; } this.aleatoria = lista.get(contador); contador++; return this.aleatoria; } public void setAleatoria(FraseVO aleatoria) { this.aleatoria = aleatoria; } } As you may see, the idea is rotating the list. When it reaches the end, the counter (contador, in Portuguese) is reset to 0 and the quotes are shown from the beginning all over again. With lots of people accessing the site at the same time, things won't get too boring and predictable... The list of quotes is retrieved by a DAO object with the following code: private String queryBase() { String qry = "SELECT t1.id,t1.frase,t1.autor,t1.idioma"; qry += " FROM frases AS t1"; return qry; } public List&lt;FraseVO&gt; getList() throws ClassNotFoundExceptio…
has title: Application scoped bean generating a really weird result
tagged with: jsf
tagged with: java
tagged with: mysql
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26726398
downvote count: 0
answer count: 1
tagged with: javabeans
favorite count: 0
type: Question

http://stackoverflow.com/comment/42130856
has text: Use a `TreeMap` instead of a `HashMap`. It has methods like `firstKey`, `lastKey` and `subMap` which will help you.
score: 1
comment on: http://stackoverflow.com/q/26776106
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42143272
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26779962
has text: @Philipp The purpose is to "group" by the result. Which comes from [this answer](http://stackoverflow.com/a/26748424/2313887) which is acutally a very poor and contrived example of using `$let`. It is actually not much different to just use `{ "$hour": "$Date" }` in place of the `$$h` variable provided by the `$let` operation. Don't really want to compound poor advice or otherwise re-state using `BasicDBObject` notation for the 1000th time. Be my guest if you wish to do so.
type: Comment

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/26811587

http://stackoverflow.com/q/26742081
tagged with: mockito
possible better answer: http://stackoverflow.com/a/26742901
linked to: http://stackoverflow.com/q/16467685
has body: Is it possible to mock an object with Mockito which is called somewhere in the object hierarchy? Let's assume following classes: @Component Class A @Autowired B b method obtainSalaryA() calls b.calculateSalary() @Component Class B @Autowired C c method calculateSalary() calls c.getDatabaseSalary() @Component Class C getDatabaseSalary() In the unit test, I would like to unit test the method obtainSalary from class A, but mock C at the same time, so that I replace the return value of getDatabaseSalary() when this method is called in the hierarchy.
score: 0
answer count: 3
has title: Mockito: mock object in call hierarchy - chained call
has answer: http://stackoverflow.com/a/26742982
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26742814
accepted answer: http://stackoverflow.com/a/26742982
tagged with: java
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/26742901
tagged with: mocking

http://stackoverflow.com/comment/41992435
type: Comment
has text: Thanks, but isn't a binaray file accessible on a rooted device too?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26689492

http://stackoverflow.com/comment/42119212
type: Comment
has text: I've edited my question to make it clearer that I need a solution for EclipseLink. I am well aware that SCOPE_IDENTITY() will return the id - the problem is to get EclipseLink to do it.
comment on: http://stackoverflow.com/q/26767180
score: 0
type: QuestionComment

http://stackoverflow.com/a/26715989
type: Answer
answers question: http://stackoverflow.com/q/26715803
has body: I understand there's something in your code that's giving you nullpointerException when you run the program, but there's no need of it being in the main method, any method called by main may be giving the exception. Still, try this: Replace this line: for (int i=0; i&lt;shoppingList.getLength(); i++) { by this one: for (int i=0; i &lt; shoppingList.length(); i++) { if .length() doesn't work, maybe .size() will do. for (int i=0; i&lt;shoppingList.size(); i++) { If you are using eclipse, netbeans or any other environment, post which line is throwing the NullPointerException. We can't help you unless you give us more data.
score: 0

http://stackoverflow.com/comment/42162208
type: Comment
has text: `due to an error`: is this a secret error? If not, then add it to the question. And what is line `31` in `MainProgram`?
comment on: http://stackoverflow.com/q/26793599
score: 4
type: QuestionComment

http://stackoverflow.com/a/26763029
type: Answer
has body: If TimeZone.getDefault() doesn't return CST, then you server is not in CST timzone, or is not configured as such. The value returned from TimeZone.getDefault() is determined by: Use the user.timezone property value as the default time zone ID if it's available. Detect the platform time zone ID. The source of the platform time zone and ID mapping may vary with implementation. Use GMT as the last resort if the given or detected time zone ID is unknown. You can check your server configuration, or you can explicitly get the CST time zone: TimeZone timeZone = TimeZone.getTimeZone("CST");
answers question: http://stackoverflow.com/q/26761570
score: 0

http://stackoverflow.com/a/26803100
answers question: http://stackoverflow.com/q/26802642
has body: Yes, you're right. In short, there is a single entry point into the application (there may be more than one entry point) that routes incoming traffic, passing incoming data to methods as parameters. This is known as the front controller pattern. Spring's DispatcherServlet is an implementation of the front controller pattern. The Spring reference details the pattern as followed in Spring, and the pattern is listed among the core Java EE patterns.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26802642
type: Answer

http://stackoverflow.com/a/26758276
score: 2
accepted answer of: http://stackoverflow.com/q/26751006
upvote count: 2
answers question: http://stackoverflow.com/q/26751006
has body: First in a for loops is right to do for (int i = 0; i &lt;= words.size()-1; i++){} if you'r starting at 0 you end at length-1 what i have changed is PrintWriter fileOut = new PrintWriter("C:/Backwards.txt"); for (int i = 0; i &lt;= words.size()-1; i++) { for (int j = 0; j &lt;= words.get(i).length()-1; j++) { char ch = ' '; ch = words.get(i).charAt(j); ch ++; // +=1 morewords.add(ch); fileOut.print(ch); } fileOut.print(" "); } fileOut.close(); and it output right if i have understood right =) this is my code public static void main(String[] args) throws Exception { BufferedReader inChannel = new BufferedReader(new FileReader("C:/script.txt")); BufferedWriter outChannel = new BufferedWriter(new FileWriter("C:/output.txt")); String toParse = ""; while ( (toParse = inChannel.readLine()) != null ) { String toWrite = ""; for(int i=0; i!=toParse.length();i++) { char c = toParse.charAt(i); if(true) //check if must be encoded or not { c++; toWrite += c; } } outChannel.write(toWrite); outChannel.newLine(); } inChannel.close(); outChannel.close(); } hope helped
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42998807

http://stackoverflow.com/comment/42112903
type: QuestionComment
type: Comment
has text: `LinkedHashMap` retains the insert order, so iterating over its `values()` using enhanced for loop should give you the elements in the same order you have put them. If you need a counter just define it ouside the for loop in increment it inside.
comment on: http://stackoverflow.com/q/26765950
score: 0

http://stackoverflow.com/comment/42364005
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26828285
type: Comment
has text: @texasbruce without the cast the target type is just `Object`

http://stackoverflow.com/comment/42146221
type: Comment
type: QuestionComment
has text: like I said you are trying to update a UI element from a different thread
score: 0
comment on: http://stackoverflow.com/q/26783749

character-encoding
tags question: http://stackoverflow.com/q/26675140
tags question: http://stackoverflow.com/q/26799782
tag name: character-encoding
tags question: http://stackoverflow.com/q/26770380
tags question: http://stackoverflow.com/q/26729652
tags question: http://stackoverflow.com/q/26740370
tags question: http://stackoverflow.com/q/26777513
type: Tag
tags question: http://stackoverflow.com/q/26750711
tags question: http://stackoverflow.com/q/26690321
tags question: http://stackoverflow.com/q/26805472

http://stackoverflow.com/comment/42188224
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26807633
has text: This is one way to do it. Make your variables `public` so that you can access then directly like `PACKET.R_1_00`. Also you can try enums. http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
type: Comment

http://stackoverflow.com/comment/41947028
comment on: http://stackoverflow.com/a/26673632
score: 0
type: Comment
has text: Thanks. why did you use a class for User and Item? it seems that the class is just a set. So why don't you define this sets in the Rating calss?
type: AnswerComment

animation
tags question: http://stackoverflow.com/q/26808304
tags question: http://stackoverflow.com/q/26789377
tags question: http://stackoverflow.com/q/26701922
tags question: http://stackoverflow.com/q/26763408
tags question: http://stackoverflow.com/q/26815677
type: Tag
tags question: http://stackoverflow.com/q/26700130
tags question: http://stackoverflow.com/q/26801433
tags question: http://stackoverflow.com/q/26695151
tag name: animation
tags question: http://stackoverflow.com/q/26791028
tags question: http://stackoverflow.com/q/26695904
tags question: http://stackoverflow.com/q/26689800
tags question: http://stackoverflow.com/q/26814945
tags question: http://stackoverflow.com/q/26742647

http://stackoverflow.com/q/26820056
tagged with: chat
type: Question
has answer: http://stackoverflow.com/a/26840219
accepted answer: http://stackoverflow.com/a/26840219
score: 0
answer count: 1
tagged with: jtextpane
has title: Java Smileys Replacing String with Smiley
tagged with: jbutton
type: AnsweredQuestion
has body: I'm writing a Chat program. I designed a mock-up gui with smileys where when the user clicks on a smiley(jbutton) it prints it onto a textpane. I managed to add an advanced feature where when a user types in ":)" and sends it, it inserts the smiley instead of the string - using the insertIcon() method. The problem I have is that it only prints the smiley once rather than multiple times. So if I type "Hi :) My name is Jack :)" it only inserts the icon ONCE. Any suggestions? import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SmileyTesterGUI extends JFrame { JPanel main = new JPanel(); JPanel south = new JPanel(); JPanel messageCenter = new JPanel(); JPanel smileysNorth = new JPanel(); JTextField text; JTextPane tPane; Icon happy; Icon smile; Icon tongue; Icon veryHappy; Icon wink; Icon laugh; Icon sad; Icon verySad; Icon cry; public SmileyTesterGUI() { super("Smileys"); add(main); main.setLayout(new BorderLayout()); main.add(south, BorderLayout.SOUTH); south.setLayout(new BorderLayout()); south.add(messageCenter, BorderLayout.CENTER); south.add(smileysNorth, BorderLayout.NORTH); // textpane panel tPane = new JTextPane(); JScrollPane sPane = new JScrollPane(tPane); main.add(sPane); tPane.setEditable(false); // smileysPanel smileysNorth.setLayout(new GridLayout(1, 0)); JButton smiley1 = new JButton(); JButton smiley2 = new JButton(); JButton smiley3 = new JButton(); JButton smiley4 = new JButton(); JButton smiley5 = new JButton(); JButton smiley6 = new JButton(); JButton smiley7 = new JButton(); JButton smiley8 = new JButton(); JButton smiley9 = new JButton(); smileysNorth.add(smiley1); smileysNorth.add(smiley2); smileysNorth.add(smiley3); smileysNorth.add(smiley4); smileysNorth.add(smiley5); smileysNorth.add(smiley6); smileysNorth.add(smiley7); smileysNorth.add(smiley8); smileysNorth.add(smiley9); // set smileys(icon) to each button - pathed from personal directory happy = new ImageIcon(getClass().getResource("smileys/Smile1.png")); smiley1.…
tagged with: java

http://stackoverflow.com/a/64150087
type: Answer
answers question: http://stackoverflow.com/q/26680678
has body: The BPRequestVO Object instance used for mocking is different than Instance used while junit execution. The best way is to configure any instance of the object while mocking when(mockBPService.getProduct(someBPRequestVO)).thenReturn(invalidServiceResponse); Can be updated with when(mockBPService.getProduct(Mockito.any(BPRequestVO.class))).thenReturn(invalidServiceResponse);
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/26701727
tagged with: border-layout
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41997576
has comment: http://stackoverflow.com/comment/41997446
tagged with: gridbaglayout
answer count: 1
has title: how to make some specific widths and heights and some auto with jframes - Java
downvote count: 0
favorite count: 0
has body: I wanna make a jframe that looks something like this: As shown on image, I wanna have right side panel to have width of 200px and bottom panel height of 80px, then everything else to be auto, as I want the window to be resizable. Could someone please help me to achieve this? I've been trying with gridLayout, BorderLayout and others. I've seen something with insets, but can't figure it out.
has comment: http://stackoverflow.com/comment/41996900
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26702275
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26702275

http://stackoverflow.com/q/26787721
answer count: 2
has answer: http://stackoverflow.com/a/26787845
favorite count: 0
has body: Why do I get this exception? How to fix it? public class NQueen_Pro { // int[] Fitness; /* * int[] NQueens1; int[] NQueens2; int[] NQueens3; int[] NQueens4; */ int[][] NQueens; int[][] CrossOver; int[] Fitness; int nFitSelected; long startingTime ; /* * int[] CrossOver1; int[] CrossOver2; int[] CrossOver3; int[] CrossOver4; */ Random ran; int length; public NQueen_Pro(int n) { Fitness = new int[n]; /* * NQueens1 = new int[n]; NQueens2 = new int[n]; NQueens3 = new int[n]; * NQueens4 = new int[n]; */ NQueens = new int[n][n]; CrossOver = new int[n][n]; nFitSelected = 40; /* * CrossOver1 = new int[n]; CrossOver2 = new int[n]; CrossOver3 = new * int[n]; CrossOver4 = new int[n]; */ length = n; startingTime = System.currentTimeMillis(); ran = new Random(); while(true) genetics(); } public void fillValues() { for (int i = 0; i < length; i++) { for (int j = 0; j < length; j++) NQueens[i][j] = ran.nextInt(length); } } private void genetics() { fillValues(); for (int i = 0; i < length; i++) { countFitness(i, NQueens[i]); } ArrangeFromFitness(); CrossOver(); Mutate(); IsDone(); } private void IsDone() { /* * if (IsFit(CrossOver1)) print(CrossOver1); else if (IsFit(CrossOver2)) * print(CrossOver2); else if (IsFit(CrossOver3)) print(CrossOver3); * else if (IsFit(CrossOver4)) print(CrossOver4); else{ System.gc(); * generics(); } */ int gotFit = 0; for (int i = 0; i < nFitSelected; i++) { if (IsFit(CrossOver[i])) { print(CrossOver[i]); gotFit = 1; } } if (gotFit == 1) { System.out.println("Total Time : \"" + ((System.currentTimeMillis()-startingTime)/(float)1000) + "\" Seconds."); System.exit(1); } } private void print(int[] Array) { for (int i = 0; i < Array.length; i++) { for (int j = 0; j < Array.length; j++) { if (Array[i] == j) System.out.print(" Q "); else System.out.print(" - "); } System.out.println(); } } private boolean IsFit(int[] crossOver) { // Vertical Checking for (int i = 0; i < crossOver.length; i++) for (int j = i + 1; j < crossOver.length; j++) if (crossOver[i] =…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26787822
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
upvote count: 2
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42151902
type: Question
has comment: http://stackoverflow.com/comment/42151826
score: -1

http://stackoverflow.com/a/32437071
upvote count: 1
downvote count: 0
score: 1
has body: This is possible by wrapping the Combo inside a white composite and setting the composite's inherit mode to force. Composite composite = new Composite(parent, SWT.NONE); composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); composite.setBackgroundMode(SWT.INHERIT_FORCE); comboCombo = new Combo(composite, SWT.READ_ONLY);
answers question: http://stackoverflow.com/q/26731652
type: Answer
has comment: http://stackoverflow.com/comment/69893131

http://stackoverflow.com/comment/41975727
score: 0
type: Comment
type: QuestionComment
has text: @SalihErikci, `@RequestScoped` CDI annotation will not work as the Object has to last longer then a single `HTTP Request`.
comment on: http://stackoverflow.com/q/26688756

http://stackoverflow.com/comment/42150727
type: QuestionComment
has text: can any one share me project like that plz
score: 0
comment on: http://stackoverflow.com/q/26719773
type: Comment

http://stackoverflow.com/comment/42035900
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26722772
has text: @StuBlair Unless you can construct the `AttributedString` from the `String` in your method, there's no other option than the two you listed: get the iterator or ask for the string in advance. Both are quite awful but then `AttributedString` is a truly awful class.
type: Comment

http://stackoverflow.com/a/26826493
has comment: http://stackoverflow.com/comment/42222045
answers question: http://stackoverflow.com/q/26826482
has body: Remove semicolon (;) from the end of first line. Learn to format your code according specification int z; if (z==1) { //calculates area } if (z==2) { //calculates volume }
score: 0
type: Answer

http://stackoverflow.com/a/26824113
has body: Straightforward zero-filled matrix will cost you in any language: the amount allocated does not depend on what numbers you fill it with. Take a look at e.g. UJMP that provides sparse matrices support, and many algorithms. Probably other implementations exist. In general, if you find something to be difficult to implement but likely useful, google for open-source libraries. Chances are many wheels have been invented already.
has comment: http://stackoverflow.com/comment/42219545
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26824065
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26824065

http://stackoverflow.com/q/26787747
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42151849
type: Question
has title: SQL for Inserting an Image into an MS Access database using Java
linked to: http://stackoverflow.com/q/8046606
tagged with: sql
has body: I am trying to insert an image into an MS Access table using Java. The Access file is called AdvisorImage.accdb. The table is called Image, and it has 2 columns: ID and Picture. ID is a Long Text type, and Picture is an OLE Object type. My approach is this: I establish a database connection Convert the image to a byte array Create the SQL statement to save the byte array to the database Execute the SQL statement Close connection Here is the code that I've written so far: package com.database.access; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class dbAccess { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.accdb)};DBQ=C://Users/abcde/Documents/AdvisorImage.accdb;"; Connection conn = DriverManager.getConnection(database, "", ""); Statement s = conn.createStatement(); //convert file to byte array File file = new File("C://Users/abcde/Pictures/WW.PNG"); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; try { for(int readNum;(readNum = fis.read(buf)) != -1;) { bos.write(buf,0,readNum); System.out.println("read" + readNum + " bytes," ); } } catch (IOException ex) { System.out.println(ex); } byte[] bytes = bos.toByteArray(); //write to database String addRow = "INSERT INTO " + "Image(ID,Picture) VALUES ( " + String.valueOf((int) (Math.random() * 32767)) + ", "; } catch(Exception ex) { ex.printStackTrace(); } } } How would you frame that SQL statement (the String addRow) to specify and insert my byte array, called bytes, into the OLE column of the Image table? And then my add on question would be, how would you write the SQL and corresponding Java code to retrieve the byte array(s) from the table? Note: I know that i…
answer count: 1
downvote count: 0
tagged with: ms-access
favorite count: 0
has answer: http://stackoverflow.com/a/42142032
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42154657

http://stackoverflow.com/q/26711526
has comment: http://stackoverflow.com/comment/42019616
tagged with: java
linked to: http://stackoverflow.com/q/4118670
linked to: http://stackoverflow.com/q/43157
answer count: 2
has answer: http://stackoverflow.com/a/26715406
has comment: http://stackoverflow.com/comment/42017751
score: 0
has title: Streaming large files with spring mvc
has answer: http://stackoverflow.com/a/26715397
type: UnansweredQuestion
tagged with: resttemplate
tagged with: spring
has body: I'm trying to create an application that download and uploads large files, so I don't want the file contents to be stored in memory. On the mvc controller side I'm using an http message converter that converts to / from InputStream @Override public InputStream read(Class&lt;? extends InputStream&gt; clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { return inputMessage.getBody(); } @Override public void write(InputStream t, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { try { IOUtils.copy(t, outputMessage.getBody()); } finally { IOUtils.closeQuietly(t); } } This works well on the server side. On the client (RestTemplate) side I tried to use the same converter, but I got an exception that the stream has been closed (probably closed when the request was completed). Client side code: ResponseEntity&lt;InputStream&gt; res = rest.getForEntity(url, InputStream.class); // res.getBody() is closed I've also tried to copy the input stream into a buffer and create a new ByteArrayInputStream and return it to the RestTemplate client and it worked well, however it does require that the data will be read into memory which doesn't suite my demands. My question is how to keep the stream open until I process it without having to read it all into memory / file? Any idea will be appreciated. Regards, Shay
type: Question
tagged with: spring-mvc

http://stackoverflow.com/comment/42115734
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26766909
type: Comment
has text: that is, the above is giving me the last value in the db table for some reason. What if I wanted the first value?

http://stackoverflow.com/comment/42044150
type: QuestionComment
comment on: http://stackoverflow.com/q/26727788
type: Comment
score: 0
has text: I have chosen to close the other as a duplicate of this since this one has answers and is at least somewhat of an improvement, and I have chosen to close *this* one as a duplicate of an easily findable existing question on the general topic.

http://stackoverflow.com/a/26748050
answers question: http://stackoverflow.com/q/26747831
type: AcceptedAnswer
upvote count: 23
has comment: http://stackoverflow.com/comment/42081106
type: Answer
has body: To get an attribute from session use ${myattr}. To get a parameter from request use ${param.myparam}.
has comment: http://stackoverflow.com/comment/42080876
downvote count: 0
score: 23
accepted answer of: http://stackoverflow.com/q/26747831

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/26674731

http://stackoverflow.com/comment/42037555
score: 0
type: Comment
has text: Don't get me wrong, I appreciate your conclusion based on the Observation - but cause I'm a developer from the Heart, I'm not taking a 99.99999% solution :-)
comment on: http://stackoverflow.com/a/26723387
type: AnswerComment